From 6e6a876a6b5ad3d2ef402757d2e20641f5a2b49b Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 12 Dec 2019 11:39:19 -0500 Subject: Slang compiles CUDA source via NVRTC (#1151) * CPPCompiler -> DownstreamCompiler * Added DownstreamCompileResult to start abstraction such that we don't need files. * * Split out slang-blob.cpp * Made CompileResult hold a DownstreamCompileResult - for access to binary or ISlangSharedLibrary * Keep temporary files in scope. * Add a hash to the hex dump stream. * Move all file tracking into DownstreamCompiler. * WIP support for nvrtc. * WIP: Adding support for nvrtc compiler. Adding enum types, wiring up the nvrtc into slang. * Fix remaining CPPCompiler references. * Fix order issue on target string matching. * Use ISlangSharedLibrary for nvrtc. * Use DownstreamCompiler for nvrtc. * WIP first pass at compilation win nvrtc. * Added testing if file is on file system into CommandLineDownstreamCompiler. Added sourceContentsPath. * Make test cuda-compile.cu work by just compiling not comparing output. * Fix warning on clang. --- source/slang/slang-check.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source/slang/slang-check.cpp') diff --git a/source/slang/slang-check.cpp b/source/slang/slang-check.cpp index 3586fcf25..db69a3155 100644 --- a/source/slang/slang-check.cpp +++ b/source/slang/slang-check.cpp @@ -121,11 +121,11 @@ namespace Slang return func; } - DownstreamCompilerSet* Session::requireCPPCompilerSet() + DownstreamCompilerSet* Session::requireDownstreamCompilerSet() { - if (cppCompilerSet == nullptr) + if (downstreamCompilerSet == nullptr) { - cppCompilerSet = new DownstreamCompilerSet; + downstreamCompilerSet = new DownstreamCompilerSet; typedef DownstreamCompiler::CompilerType CompilerType; DownstreamCompilerUtil::InitializeSetDesc desc; @@ -134,10 +134,12 @@ namespace Slang desc.paths[int(CompilerType::Clang)] = m_downstreamCompilerPaths[int(PassThroughMode::Clang)]; desc.paths[int(CompilerType::VisualStudio)] = m_downstreamCompilerPaths[int(PassThroughMode::VisualStudio)]; - DownstreamCompilerUtil::initializeSet(desc, cppCompilerSet); + desc.sharedLibraries[int(CompilerType::NVRTC)] = getOrLoadSharedLibrary(SharedLibraryType::NVRTC, nullptr); + + DownstreamCompilerUtil::initializeSet(desc, downstreamCompilerSet); } - SLANG_ASSERT(cppCompilerSet); - return cppCompilerSet; + SLANG_ASSERT(downstreamCompilerSet); + return downstreamCompilerSet; } TypeCheckingCache* Session::getTypeCheckingCache() -- cgit v1.2.3