apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators
https://tvm.apache.org/
Apache License 2.0
11.41k stars 3.4k forks source link

[Bugfix][CUDA vec codegen] fix cast fp16 to int8 #17129

Closed JackWeiw closed 5 days ago

JackWeiw commented 5 days ago

Currently CUDA dosen't support directly cast fp16 to (u)int8, however, we need firstly lift fp16 to fp32 using__half2float,then cast it to (u)int8. I don't know how often we need cast fp16 to int8, but i think there are some cases need cast fp16 to int8. If it's OK, i'd like to add more test case to complete this PR.