-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Assertion failure: pipeline_state_ != nullptr on metal #6221
Comments
Reopening since I'm see exactly the same issue on my M1 MacBook. What makes it more confusing is that if I change |
Adding this issue to v1.2.0 milestone since it affects many users on macos12, but it's indeed a bit hard to fix so I cannot guarantee a proper fix before that. |
FYI @jim19930609 and @k-ye helped investigate this issue and here're a few observations with another (maybe simpler) repro:
A few things worth trying:
|
@bobcao3 do you happen to have any insights on this issue? It's blocking us from upgrading mac M1 machine to macos12 and it's becoming a bottleneck in CI. Thanks a lot! |
Some follow-up investigation: This metal code snippet cannot work on macOS 12.x
The crash point seems to be inside an LLVM pass. I guess it crashes when attempting to automatically apply atomic add operation a top of the loop index |
Out of curiosity, where is the "atomic add" in the above code snippet? |
It's my guess that the Metal compiler is trying to apply automatic atomic add optimization, it might crash on other passes tho |
I've worked out a C++ reprod, code repository. This is likely a macOS compiler bug. It requires following conditions to reproduce the bug:
|
After some tinkering I found that if we annotate
Didn't test its performance though... |
For this second repro I found this numerically equivalent implementation working: import taichi as ti
@ti.kernel
def kernel4(l: ti.i32) -> ti.i32:
res = 1
for i in range(2):
res += (l - 1) * l // 2
return res
ti.init(arch=ti.metal,
print_ir=True,
log_level=ti.TRACE)
res = kernel4(3)
print(res) I guess the LLVM pass to transform summing loops into gaussian sum formula is broken in Apple's MSL compilation pipeline. We can implement it ourselves to workaround this issue. |
Issue: #6221 ### Brief Summary `kernel4` in `test_offline_cache.py` triggers a weird LLVM internal error on metal backend for macos12+. After moving metal runtime to gfxruntime by @PENGUINLIONG and #7201, this is now the only blocker for us to run full CI on macos ventura. As discussed with @PENGUINLIONG and @feisuzhu offline, let's disable this test to unblock CI and add it back once the issue is fixed.
…dev#7154) Issue: taichi-dev#6221 ### Brief Summary `kernel4` in `test_offline_cache.py` triggers a weird LLVM internal error on metal backend for macos12+. After moving metal runtime to gfxruntime by @PENGUINLIONG and taichi-dev#7201, this is now the only blocker for us to run full CI on macos ventura. As discussed with @PENGUINLIONG and @feisuzhu offline, let's disable this test to unblock CI and add it back once the issue is fixed.
Describe the bug
Run the following code failed:
Output:
The text was updated successfully, but these errors were encountered: