diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-03-30 19:23:09 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-30 23:23:09 +0000 |
| commit | ea7690558bca71ce3a9453adff4e0135352a352f (patch) | |
| tree | 3eb983d3f8e6b1c215f6d2818a0f3e793ecb4485 /source/core/slang-nvrtc-compiler.cpp | |
| parent | ad5b60c8b5868c69a979779f201748fb7837fdc9 (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/core/slang-nvrtc-compiler.cpp')
| -rw-r--r-- | source/core/slang-nvrtc-compiler.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/source/core/slang-nvrtc-compiler.cpp b/source/core/slang-nvrtc-compiler.cpp index 5d5a1ce0f..0e167bf80 100644 --- a/source/core/slang-nvrtc-compiler.cpp +++ b/source/core/slang-nvrtc-compiler.cpp @@ -10,6 +10,7 @@ #include "slang-io.h" #include "slang-shared-library.h" +#include "slang-semantic-version.h" namespace nvrtc { @@ -307,14 +308,30 @@ SlangResult NVRTCDownstreamCompiler::compile(const CompileOptions& options, RefP // This is arguably too much - but nvrtc does not appear to have a mechanism to switch off individual warnings. // I tried the -Xcudafe mechanism but that does not appear to work for nvrtc cmdLine.addArg("-w"); + } - // -#if 0 - cmdLine.addArg("-arch=compute_70"); -#else - // Needed for Warp intrinsics - cmdLine.addArg("-arch=compute_30"); -#endif + { + // Lowest supported is 3.0 + SemanticVersion version(3); + for (const auto& capabilityVersion : options.requiredCapabilityVersions) + { + if (capabilityVersion.kind == DownstreamCompiler::CapabilityVersion::Kind::CUDASM) + { + if (capabilityVersion.version > version) + { + version = capabilityVersion.version; + } + } + } + + StringBuilder builder; + builder << "-arch=compute_"; + builder << version.m_major; + + SLANG_ASSERT(version.m_minor >= 0 && version.m_minor <= 9); + builder << char('0' + version.m_minor); + + cmdLine.addArg(builder); } nvrtcProgram program = nullptr; |
