summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-cuda.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-03-30 19:23:09 -0400
committerGitHub <noreply@github.com>2020-03-30 23:23:09 +0000
commitea7690558bca71ce3a9453adff4e0135352a352f (patch)
tree3eb983d3f8e6b1c215f6d2818a0f3e793ecb4485 /source/slang/slang-emit-cuda.cpp
parentad5b60c8b5868c69a979779f201748fb7837fdc9 (diff)
CUDA version handling (#1301)
* render feature for CUDA compute model. * Use SemanticVersion type. * Enable CUDA wave tests that require CUDA SM 7.0. Provide mechanism for DownstreamCompiler to specify version numbers. * Enabled wave-equality.slang * Make CUDA SM version major version not just a single digit. * Fix assert. * DownstreamCompiler::Version -> CapabilityVersion
Diffstat (limited to 'source/slang/slang-emit-cuda.cpp')
-rw-r--r--source/slang/slang-emit-cuda.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/slang/slang-emit-cuda.cpp b/source/slang/slang-emit-cuda.cpp
index 64cb240fc..a728df755 100644
--- a/source/slang/slang-emit-cuda.cpp
+++ b/source/slang/slang-emit-cuda.cpp
@@ -375,6 +375,32 @@ bool CUDASourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu
return Super::tryEmitInstExprImpl(inst, inOuterPrec);
}
+void CUDASourceEmitter::handleCallExprDecorationsImpl(IRInst* funcValue)
+{
+ // Does this function declare any requirements on GLSL version or
+ // extensions, which should affect our output?
+
+ auto decoratedValue = funcValue;
+ while (auto specInst = as<IRSpecialize>(decoratedValue))
+ {
+ decoratedValue = getSpecializedValue(specInst);
+ }
+
+ for (auto decoration : decoratedValue->getDecorations())
+ {
+ if( auto smDecoration = as<IRRequireCUDASMVersionDecoration>(decoration))
+ {
+ SemanticVersion version;
+ version.setFromInteger(SemanticVersion::IntegerType(smDecoration->getCUDASMVersion()));
+
+ if (version > m_extensionTracker->m_smVersion)
+ {
+ m_extensionTracker->m_smVersion = version;
+ }
+ }
+ }
+}
+
void CUDASourceEmitter::emitLayoutDirectivesImpl(TargetRequest* targetReq)
{
SLANG_UNUSED(targetReq);