summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-mangle.cpp
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-05-14 12:11:53 -0500
committerGitHub <noreply@github.com>2025-05-14 10:11:53 -0700
commit375ecfe2903b09f07abeba2eafb88d9a564c1458 (patch)
treea507ffcdbe118f5d69ffb3e6c341d8f954e0bfef /source/slang/slang-mangle.cpp
parent39c9e25f6d728e970b68a9452330e754991b4ac5 (diff)
support specialization constant sized array (#6871)
Close #6859 Goal of this PR We want to support an array whose size can be specialization constant for shared/global variable e.g. layout (constant_id = 0) const uint BLOCK_SIZE = 64; shared float buf_a[(BLOCK_SIZE + 5) * 4]; Overview of the solution: During IndexExpr check, we will loose the restriction to allow SpecConst passing, but the size parameter will not be a constant value because it cannot be folded into a constant, so we will make it follow the same logic as generic parameter value, and the size will be represented by FuncCallIntVal/PolynomialIntVal/DeclRefIntVal. During IR lowering, we will detect whether there is spec constant in the IntVal, and wrap the IRInst with a SpecConstRateType, and propagate the type though the lowering logic, such that the IntVal representing the array size will have SpecConstRateType. During spirv emit stage, if we detect that a IRInst has SpecConstRateType, we will emit it as SpecConstantOp. We have to implement new logic to emit OpSpecConstantOp, the existing emit logic doesn't support emitting OpSpecConstantOp, especially this op can embed arithmetic operation at global scope, where we can only emit arithmetic instruct at local. But there are only few instructs we need to support. Overview of the solution: This PR doesn't support generic, and we will create a separate PR to extend that, tracked in #6840.
Diffstat (limited to 'source/slang/slang-mangle.cpp')
-rw-r--r--source/slang/slang-mangle.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp
index f08ffd75d..056c7accb 100644
--- a/source/slang/slang-mangle.cpp
+++ b/source/slang/slang-mangle.cpp
@@ -323,7 +323,7 @@ void emitVal(ManglingContext* context, Val* val)
// to mangle in the constraints even when
// the whole thing is specialized...
}
- else if (auto genericParamIntVal = dynamicCast<GenericParamIntVal>(val))
+ else if (auto genericParamIntVal = dynamicCast<DeclRefIntVal>(val))
{
// TODO: we shouldn't be including the names of generic parameters
// anywhere in mangled names, since changing parameter names