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

ti.solve with singular A silently break control flow on GPU with debug=False #6615

Open
YouJiacheng opened this issue Nov 15, 2022 · 0 comments
Assignees
Labels
potential bug Something that looks like a bug but not yet confirmed

Comments

@YouJiacheng
Copy link

import taichi as ti

ti.init(arch=ti.gpu)

bar = ti.Matrix.field(3, 3, ti.float32, shape=16)
zoo = ti.Vector.field(3, ti.float32, shape=16)

bar.fill(0)
zoo.fill(1)

bar[0] = ti.Matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])

@ti.kernel
def foo():
    for i in bar:
        res = ti.solve(bar[i], zoo[i], ti.float32)
        print(i)
foo()

The output is

[Taichi] version 1.2.1, llvm 10.0.0, commit 12ab828a, win, python 3.10.6
[Taichi] Starting on arch=cuda
[W 11/15/22 20:39:33.769 20600] [C:/Users/Administrator/actions-runner/_work/taichi/taichi/taichi/runtime/llvm/llvm_offline_cache.cpp:load_meta_data@138] Lock C:/taichi_cache/ticache/llvm/metadata.lock failed
0
[W 11/15/22 20:39:36.234 20600] [taichi/util/offline_cache.h:run@185] Lock C:/taichi_cache/ticache/llvm/metadata.lock failed
[W 11/15/22 20:39:36.482 20600] [C:/Users/Administrator/actions-runner/_work/taichi/taichi/taichi/runtime/llvm/llvm_offline_cache.cpp:dump@316] Lock C:/taichi_cache/ticache/llvm/metadata.lock failed

print(i) is executed only if A is not singular.
This is far out of my expectation, and completely different from CPU.
According to the document:
image
taichi should ignore assertion and produce non-sense result(e.g. NaN), instead of breaking control flow.

With debug=True, I can get nice error message.
But all 16 print(i) are executed on CPU, while only 1 print(i)(i=0) is executed on GPU.

@YouJiacheng YouJiacheng added the potential bug Something that looks like a bug but not yet confirmed label Nov 15, 2022
@taichi-gardener taichi-gardener moved this to Untriaged in Taichi Lang Nov 15, 2022
@PENGUINLIONG PENGUINLIONG moved this from Untriaged to Todo in Taichi Lang Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential bug Something that looks like a bug but not yet confirmed
Projects
Status: Todo
Development

No branches or pull requests

3 participants