From c99addbf2e8a0210b97dad2827045dad95765d08 Mon Sep 17 00:00:00 2001 From: Julius Ikkala Date: Sat, 11 Oct 2025 02:01:51 +0300 Subject: 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.) --- tests/language-feature/modules/module-name.slang | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') 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. -- cgit v1.2.3