diff options
| author | Julius Ikkala <julius.ikkala@gmail.com> | 2025-10-11 02:01:51 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-10 23:01:51 +0000 |
| commit | c99addbf2e8a0210b97dad2827045dad95765d08 (patch) | |
| tree | efb5b88febc2285362acf11ffea28146951e0b2d /tests | |
| parent | 462ea4e66569efa978e4057ea2d041c69d4a729b (diff) | |
Allow entry points with missing numthreads on CPU targets (#8678)
Several tests have compute entry points without a `[numthreads(x,y,z)]`
decoration. Currently, none of these tests run on the CPU target, as
they crash the compiler. I took a look at the SPIR-V emitter, which
falls back to a workgroup size of (1,1,1):
https://github.com/shader-slang/slang/blob/1e0908bd7107dfbdac912b693c3ab9bd6e1dc8b3/source/slang/slang-ir-spirv-legalize.cpp#L1635-L1643
To match this behaviour, this PR implements a fallback solution that
makes `emitCalcGroupExtents()` emit (1,1,1).
This PR is both a question and a suggestion; I'm not sure the approach
here is at all reasonable. Personally, I'd just like to explicitly add
`[numthreads(1,1,1)]` to all such tests, but I don't know if it's
actually legal and supported to not have a `numthreads`. So the
implementation here is a bit conservative.
I ran across these when I went through tests for the upcoming LLVM
target. These were the final blockers to get all autodiff and
language-features tests passing (not counting the ones using things like
wave intrinsics and barriers etc.)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/language-feature/modules/module-name.slang | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/language-feature/modules/module-name.slang b/tests/language-feature/modules/module-name.slang index 32e8c70d2..933435f7f 100644 --- a/tests/language-feature/modules/module-name.slang +++ b/tests/language-feature/modules/module-name.slang @@ -1,5 +1,6 @@ //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -output-using-type //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu -shaderobj -output-using-type // Test that decls with the same name as the module are allowed. |
