From ea7690558bca71ce3a9453adff4e0135352a352f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 30 Mar 2020 19:23:09 -0400 Subject: 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 --- source/slang/slang-emit-cuda.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source/slang/slang-emit-cuda.cpp') 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(decoratedValue)) + { + decoratedValue = getSpecializedValue(specInst); + } + + for (auto decoration : decoratedValue->getDecorations()) + { + if( auto smDecoration = as(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); -- cgit v1.2.3