diff options
| -rw-r--r-- | docs/user-guide/a3-02-reference-capability-atoms.md | 12 | ||||
| -rw-r--r-- | source/slang/slang-capabilities.capdef | 20 | ||||
| -rw-r--r-- | source/slang/slang-compiler.cpp | 33 | ||||
| -rw-r--r-- | tests/diagnostics/local-line.slang | 2 | ||||
| -rw-r--r-- | tools/gfx/cuda/cuda-device.cpp | 2 |
5 files changed, 51 insertions, 18 deletions
diff --git a/docs/user-guide/a3-02-reference-capability-atoms.md b/docs/user-guide/a3-02-reference-capability-atoms.md index 4f4a1a12b..12cda6bed 100644 --- a/docs/user-guide/a3-02-reference-capability-atoms.md +++ b/docs/user-guide/a3-02-reference-capability-atoms.md @@ -7,12 +7,12 @@ Capability Atoms ### Sections: -1. [Targets](#targets) -2. [Stages](#stages) -3. [Versions](#versions) -4. [Extensions](#extensions) -5. [Compound Capabilities](#compound-capabilities) -6. [Other](#other) +1. [Targets](#Targets) +2. [Stages](#Stages) +3. [Versions](#Versions) +4. [Extensions](#Extensions) +5. [Compound Capabilities](#Compound-Capabilities) +6. [Other](#Other) Targets ---------------------- diff --git a/source/slang/slang-capabilities.capdef b/source/slang/slang-capabilities.capdef index fafcb214f..9d1a11f07 100644 --- a/source/slang/slang-capabilities.capdef +++ b/source/slang/slang-capabilities.capdef @@ -1812,43 +1812,43 @@ alias GLSL_430_SPIRV_1_0 = _GLSL_430 + GLSL_420_SPIRV_1_0 | GLSL_420_SPIRV_1_0; // /// cuda 1.0 and related capabilities of other targets. /// [Version] -alias cuda_sm_1_0 = _cuda_sm_1_0 | sm_4_0; +alias cuda_sm_1_0 = _cuda_sm_1_0; /// cuda 2.0 and related capabilities of other targets. /// [Version] -alias cuda_sm_2_0 = _cuda_sm_2_0 | sm_4_1; +alias cuda_sm_2_0 = _cuda_sm_2_0 | cuda_sm_1_0 | sm_4_0; /// cuda 3.0 and related capabilities of other targets. /// [Version] -alias cuda_sm_3_0 = _cuda_sm_3_0 | sm_6_0; +alias cuda_sm_3_0 = _cuda_sm_3_0 | cuda_sm_2_0; /// cuda 3.5 and related capabilities of other targets. /// [Version] -alias cuda_sm_3_5 = _cuda_sm_3_5 | sm_6_0; +alias cuda_sm_3_5 = _cuda_sm_3_5 | cuda_sm_3_0; /// cuda 4.0 and related capabilities of other targets. /// [Version] -alias cuda_sm_4_0 = _cuda_sm_4_0 | sm_6_0; +alias cuda_sm_4_0 = _cuda_sm_4_0 | cuda_sm_3_5; /// cuda 5.0 and related capabilities of other targets. /// [Version] -alias cuda_sm_5_0 = _cuda_sm_5_0 | sm_6_0; +alias cuda_sm_5_0 = _cuda_sm_5_0 | cuda_sm_4_0; /// cuda 6.0 and related capabilities of other targets. /// [Version] -alias cuda_sm_6_0 = _cuda_sm_6_0 | sm_6_0; +alias cuda_sm_6_0 = _cuda_sm_6_0 | cuda_sm_5_0 | sm_4_1; /// cuda 7.0 and related capabilities of other targets. /// [Version] -alias cuda_sm_7_0 = _cuda_sm_7_0 | sm_5_1; +alias cuda_sm_7_0 = _cuda_sm_7_0 | cuda_sm_6_0; /// cuda 8.0 and related capabilities of other targets. /// [Version] -alias cuda_sm_8_0 = _cuda_sm_8_0 | sm_5_1; +alias cuda_sm_8_0 = _cuda_sm_8_0 | cuda_sm_7_0; /// cuda 9.0 and related capabilities of other targets. /// [Version] -alias cuda_sm_9_0 = _cuda_sm_9_0 | sm_5_1; +alias cuda_sm_9_0 = _cuda_sm_9_0 | cuda_sm_8_0 | sm_5_0; // Metal profile capabilities // diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 15f22630c..d6659e707 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -1418,6 +1418,39 @@ SlangResult CodeGenContext::emitWithDownstreamForEntryPoints(ComPtr<IArtifact>& } } + CapabilitySet targetCaps = getTargetCaps(); + for (auto atomSets : targetCaps.getAtomSets()) + { + for (auto atomVal : atomSets) + { + auto atom = CapabilityAtom(atomVal); + switch (atom) + { + default: + break; + +#define CASE(KIND, NAME, VERSION) \ + case CapabilityAtom::NAME: \ + requiredCapabilityVersions.add(DownstreamCompileOptions::CapabilityVersion{ \ + DownstreamCompileOptions::CapabilityVersion::Kind::KIND, \ + VERSION}); \ + break + + CASE(CUDASM, _cuda_sm_1_0, SemanticVersion(1, 0)); + CASE(CUDASM, _cuda_sm_2_0, SemanticVersion(2, 0)); + CASE(CUDASM, _cuda_sm_3_0, SemanticVersion(3, 0)); + CASE(CUDASM, _cuda_sm_4_0, SemanticVersion(4, 0)); + CASE(CUDASM, _cuda_sm_5_0, SemanticVersion(5, 0)); + CASE(CUDASM, _cuda_sm_6_0, SemanticVersion(6, 0)); + CASE(CUDASM, _cuda_sm_7_0, SemanticVersion(7, 0)); + CASE(CUDASM, _cuda_sm_8_0, SemanticVersion(8, 0)); + CASE(CUDASM, _cuda_sm_9_0, SemanticVersion(9, 0)); + +#undef CASE + } + } + } + // Set the file sytem and source manager, as *may* be used by downstream compiler options.fileSystemExt = getFileSystemExt(); options.sourceManager = getSourceManager(); diff --git a/tests/diagnostics/local-line.slang b/tests/diagnostics/local-line.slang index 07b139516..8874aec1e 100644 --- a/tests/diagnostics/local-line.slang +++ b/tests/diagnostics/local-line.slang @@ -2,7 +2,7 @@ //TEST:SIMPLE_LINE:-entry computeMain -target dxil -profile cs_6_0 //TEST:SIMPLE_LINE:-entry computeMain -target dxbc -stage compute //TEST:SIMPLE_LINE:-entry computeMain -target shader-dll -stage compute -//TEST:SIMPLE_LINE:-entry computeMain -target ptx -stage compute +//TEST:SIMPLE_LINE:-entry computeMain -capability cuda_sm_8_0 -target ptx -stage compute //TEST:SIMPLE_LINE(filecheck=CHECK):-entry computeMain -target spirv -stage compute -emit-spirv-via-glsl //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer diff --git a/tools/gfx/cuda/cuda-device.cpp b/tools/gfx/cuda/cuda-device.cpp index a62f41ada..129ea793f 100644 --- a/tools/gfx/cuda/cuda-device.cpp +++ b/tools/gfx/cuda/cuda-device.cpp @@ -149,7 +149,7 @@ SLANG_NO_THROW SlangResult SLANG_MCALL DeviceImpl::initialize(const Desc& desc) desc.extendedDescCount, desc.extendedDescs, SLANG_PTX, - "sm_5_1", + "cuda_sm_5_0", makeArray(slang::PreprocessorMacroDesc{"__CUDA_COMPUTE__", "1"}).getView())); SLANG_RETURN_ON_FAIL(RendererBase::initialize(desc)); |
