-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
Describe the bug
All conditional statements are ignored in any @ti.func called from any @ti.real_func. Code is executed as though all conditions evaluate to True. This happens on both Linux and Windows, both on gpu and cpu backends.
To Reproduce
A minimal reproducer:
import taichi as ti
ti.init(arch=ti.cpu)
@ti.func
def f_test() -> float:
foo = 0.
if False: foo = 1.
return foo
@ti.real_func
def rf_test() -> float:
return f_test()
@ti.kernel
def kern_test() -> float:
return rf_test()
print(kern_test()) # Prints 1.0Log/Screenshots
$ python my_sample_code.py
[Taichi] version 1.7.0, llvm 15.0.4, commit 2fd24490, linux, python 3.8.13
[Taichi] Starting on arch=x64
...
[Taichi] version 1.7.0, llvm 15.0.1, commit 2fd24490, win, python 3.8.17
[Taichi] Starting on arch=cuda
...
Additional comments
I assume this is a bug, unless I've badly misunderstood what is and is not UB. I still feel like I'm somehow responsible for this, but I haven't found anything to indicate that what I'm doing is forbidden. The code in this example calls func from real_func:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Untriaged