From 1bbcf25af514a9ae24f7006747177f2d1b3b7c0d Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 11 Mar 2024 14:42:14 -0700 Subject: Link-time specialization fixes. (#3734) * Fix method synthesis logic for static differentiable methods. * Support link-time constants in thread group size reflection. --- source/slang/slang-reflection-api.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source/slang/slang-reflection-api.cpp') diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 7af3ce0a3..d91dd5858 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -2811,12 +2811,18 @@ SLANG_API void spReflectionEntryPoint_getComputeThreadGroupSize( auto numThreadsAttribute = entryPointFunc.getDecl()->findModifier(); if (numThreadsAttribute) { - if (auto cint = as(numThreadsAttribute->x)) + if (auto cint = entryPointLayout->program->tryFoldIntVal(numThreadsAttribute->x)) sizeAlongAxis[0] = (SlangUInt)cint->getValue(); - if (auto cint = as(numThreadsAttribute->y)) + else if (numThreadsAttribute->x) + sizeAlongAxis[0] = 0; + if (auto cint = entryPointLayout->program->tryFoldIntVal(numThreadsAttribute->y)) sizeAlongAxis[1] = (SlangUInt)cint->getValue(); - if (auto cint = as(numThreadsAttribute->z)) + else if (numThreadsAttribute->y) + sizeAlongAxis[1] = 0; + if (auto cint = entryPointLayout->program->tryFoldIntVal(numThreadsAttribute->z)) sizeAlongAxis[2] = (SlangUInt)cint->getValue(); + else if (numThreadsAttribute->z) + sizeAlongAxis[2] = 0; } // -- cgit v1.2.3