summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-08 16:33:04 -0800
committerGitHub <noreply@github.com>2024-03-08 16:33:04 -0800
commit21502874666c282a3c5fa1f802deff27fab4e93b (patch)
tree7fdfb184872f77c6aaaa3c738b651cd908e97b54 /source
parentbc3dc0e82d52faa45ffe73448e86208f137b8536 (diff)
Add documentation for uniformity analysis. (#3721)
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-diagnostic-defs.h4
-rw-r--r--source/slang/slang-ir-uniformity.cpp6
2 files changed, 8 insertions, 2 deletions
diff --git a/source/slang/slang-diagnostic-defs.h b/source/slang/slang-diagnostic-defs.h
index 2ced9180e..d8cff1a9a 100644
--- a/source/slang/slang-diagnostic-defs.h
+++ b/source/slang/slang-diagnostic-defs.h
@@ -719,8 +719,8 @@ DIAGNOSTIC(42001, Error, invalidUseOfTorchTensorTypeInDeviceFunc, "invalid use o
DIAGNOSTIC(45001, Error, unresolvedSymbol, "unresolved external symbol '$0'.")
-DIAGNOSTIC(41201, Warning, expectDynamicUniformArgument, "argument for '$0' is not a dynamic uniform.")
-DIAGNOSTIC(41201, Warning, expectDynamicUniformValue, "value stored at this location must be dynamic uniform.")
+DIAGNOSTIC(41201, Warning, expectDynamicUniformArgument, "argument for '$0' might not be a dynamic uniform, use `asDynamicUniform()` to silence this warning.")
+DIAGNOSTIC(41201, Warning, expectDynamicUniformValue, "value stored at this location must be dynamic uniform, use `asDynamicUniform()` to silence this warning.")
//
// 5xxxx - Target code generation.
diff --git a/source/slang/slang-ir-uniformity.cpp b/source/slang/slang-ir-uniformity.cpp
index 9c463f530..d29c0735a 100644
--- a/source/slang/slang-ir-uniformity.cpp
+++ b/source/slang/slang-ir-uniformity.cpp
@@ -310,6 +310,9 @@ namespace Slang
auto ifElse = as<IRIfElse>(user);
visitControlDependentBlock(ifElse->getTrueBlock());
visitControlDependentBlock(ifElse->getFalseBlock());
+ // Mark phi nodes as non-uniform if any of its incoming values are non-uniform.
+ for (auto param : ifElse->getAfterBlock()->getParams())
+ addToWorkList(param);
break;
}
case kIROp_Switch:
@@ -318,6 +321,9 @@ namespace Slang
for (UInt c = 0; c < switchInst->getCaseCount(); c++)
visitControlDependentBlock(switchInst->getCaseLabel(c));
visitControlDependentBlock(switchInst->getDefaultLabel());
+ // Mark phi nodes as non-uniform if any of its incoming values are non-uniform.
+ for (auto param : switchInst->getBreakLabel()->getParams())
+ addToWorkList(param);
break;
}
case kIROp_Call: