From ef41dfc605f7868c0ccc7dde05982232b7d49589 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 10 Jan 2020 15:00:13 -0500 Subject: WIP: CPU like CUDA binding (#1164) * CUDA generated first test compiles. * WIP on enabling CUDA in render-test. * Detect CUDA_PATH environmental variable to build build cuda support into render-test. Added WIP cuda-compute-util.cpp/h Added CUDA as a renderer type. * Fix libraries needed for cuda in premake. * Added -enable-cuda premake option. Defaults to false. * Creates CUDA device, loads PTX and finds entry point. * Fix some erroneous cruft from slang-cuda-prelude.h * Made CUDA use C++ like ABI for generated code. Fix small bug in C++ output semantics. --- source/slang/slang-emit-cpp.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source/slang/slang-emit-cpp.h') diff --git a/source/slang/slang-emit-cpp.h b/source/slang/slang-emit-cpp.h index d71983c92..df1dec380 100644 --- a/source/slang/slang-emit-cpp.h +++ b/source/slang/slang-emit-cpp.h @@ -37,6 +37,18 @@ public: int colCount; }; + struct GlobalParamInfo + { + typedef GlobalParamInfo ThisType; + bool operator<(const ThisType& rhs) const { return offset < rhs.offset; } + bool operator==(const ThisType& rhs) const { return offset == rhs.offset; } + bool operator!=(const ThisType& rhs) const { return !(*this == rhs); } + + IRInst* inst; + UInt offset; + UInt size; + }; + virtual void useType(IRType* type); virtual void emitCall(const HLSLIntrinsic* specOp, IRInst* inst, const IRUse* operands, int numOperands, const EmitOpInfo& inOuterPrec); virtual void emitTypeDefinition(IRType* type); @@ -69,12 +81,17 @@ protected: // Replaceable for classes derived from CPPSourceEmitter virtual SlangResult calcTypeName(IRType* type, CodeGenTarget target, StringBuilder& out); + void emitIntrinsicCallExpr( IRCall* inst, IRTargetIntrinsicDecoration* targetIntrinsic, EmitOpInfo const& inOuterPrec); + void _emitForwardDeclarations(const List& actions); + void _calcGlobalParams(const List& actions, List& outParams, IRGlobalParam** outEntryPointGlobalParams); + void _emitUniformStateMembers(const List& actions, IRGlobalParam** outEntryPointGlobalParams); + void _emitVecMatMulDefinition(const UnownedStringSlice& funcName, const HLSLIntrinsic* specOp); void _emitAryDefinition(const HLSLIntrinsic* specOp); @@ -119,6 +136,8 @@ protected: HLSLIntrinsic* _addIntrinsic(HLSLIntrinsic::Op op, IRType* returnType, IRType*const* argTypes, Index argTypeCount); + static bool _isVariable(IROp op); + Dictionary m_typeNameMap; Dictionary m_intrinsicNameMap; -- cgit v1.2.3