[CodeGen][CUDA] Fix bugs (#5209)
authorWei Pan <60017475+wpan11nv@users.noreply.github.com>
Fri, 3 Apr 2020 06:57:40 +0000 (23:57 -0700)
committerGitHub <noreply@github.com>
Fri, 3 Apr 2020 06:57:40 +0000 (02:57 -0400)
commit316ce055ce11ae5ecb2d02a1438df26a5ef4ef4a
treeb57f48fbb79c602ec90c2e9e34e9a5055b22d825
parent6e1cd8256e461deca51e45e7aae33088e8f5b966
[CodeGen][CUDA] Fix bugs (#5209)

- Support vectorized casts

- It is incorrect to extract elements from int8x4 with

   0x000000ff & (x >> i * 8)

  as this value is of type int in C/C++. If this expression
  is used for sign extensions, the sign bit will be wrong.
  Simply use C style casts instead and sign bits will just work.

Signed-off-by: Wei Pan <weip@nvidia.com>
src/target/source/codegen_cuda.cc
src/target/source/codegen_cuda.h
tests/python/unittest/test_target_codegen_cuda.py