Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erroneous f32 -> i32 casting on the CUDA backend #8487

Open
lucifer1004 opened this issue Mar 15, 2024 · 0 comments
Open

Erroneous f32 -> i32 casting on the CUDA backend #8487

lucifer1004 opened this issue Mar 15, 2024 · 0 comments

Comments

@lucifer1004
Copy link
Contributor

Describe the bug
f32 -> i32 casting yields erroneous results for certain inputs on the CUDA backend.

To Reproduce

import taichi as ti

ti.init(arch=ti.cuda)
x = ti.field(dtype=ti.f32, shape=(1,))

@ti.kernel
def test(T:ti.f32):
    x[0] = int(abs(T) / T)

errors = []
for t in range(1, 1025):
    test(t)
    if x[0] == 0:
        errors.append(t)

print(len(errors))
print(errors)

Log/Screenshots

[Taichi] version 1.7.0, llvm 16.0.0git, commit 2fd24490, linux, python 3.11.8
[Taichi] Starting on arch=cuda
104
[33, 37, 41, 47, 55, 66, 74, 75, 82, 94, 107, 109, 110, 115, 121, 132, 139, 148, 150, 159, 164, 188, 214, 218, 220, 227, 230, 235, 242, 245, 255, 264, 278, 296, 300, 318, 328, 376, 427, 428, 436, 440, 454, 460, 470, 477, 484, 490, 495, 497, 510, 515, 519, 528, 535, 543, 547, 555, 556, 567, 575, 592, 600, 619, 636, 647, 649, 656, 691, 749, 751, 752, 787, 791, 803, 819, 833, 854, 856, 867, 872, 879, 880, 887, 899, 908, 917, 920, 927, 933, 940, 953, 954, 968, 975, 980, 981, 987, 989, 990, 994, 1011, 1017, 1020]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant