From b3e6f1b2cffa8def593e97a00576eeba0f947ebc Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 25 Mar 2020 16:45:56 -0400 Subject: Unroll target improvements (#1291) * Add unroll support for CUDA, and preliminary for C++. Document [unroll] support. * Fix loop-unroll to run on CPU, and test on CPU and elsewhere. Fix bug in emitting loop unroll condition. * Improved comment. * Added support for vk/glsl loop unrolling. --- source/slang/slang-emit-cpp.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/slang/slang-emit-cpp.cpp') diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp index bece6c2d0..8f59da214 100644 --- a/source/slang/slang-emit-cpp.cpp +++ b/source/slang/slang-emit-cpp.cpp @@ -1868,6 +1868,15 @@ void CPPSourceEmitter::emitIntrinsicCallExprImpl( return Super::emitIntrinsicCallExprImpl(inst, targetIntrinsic, inOuterPrec); } +void CPPSourceEmitter::emitLoopControlDecorationImpl(IRLoopControlDecoration* decl) +{ + if (decl->getMode() == kIRLoopControl_Unroll) + { + // This relies on a suitable definition in slang-cpp-prelude.h or defined in C++ compiler invocation. + m_writer->emit("SLANG_UNROLL\n"); + } +} + bool CPPSourceEmitter::_tryEmitInstExprAsIntrinsic(IRInst* inst, const EmitOpInfo& inOuterPrec) { HLSLIntrinsic* specOp = m_intrinsicSet.add(inst); -- cgit v1.2.3