-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[HLSL] Use HLSLToolChain for Vulkan #110306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The options are not translated correctly when targeting Vulkan using the dxc driver mode. Resuing the translator used for HLSL. Fixes problem 2 in llvm#108567.
@llvm/pr-subscribers-hlsl @llvm/pr-subscribers-clang Author: Steven Perron (s-perron) ChangesThe options are not translated correctly when targeting Vulkan using the dxc Fixes problem 2 in #108567. Full diff: https://github.com/llvm/llvm-project/pull/110306.diff 3 Files Affected:
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index d0c8bdba0ede95..fba6a8853c3960 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6481,6 +6481,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
case llvm::Triple::ZOS:
TC = std::make_unique<toolchains::ZOS>(*this, Target, Args);
break;
+ case llvm::Triple::Vulkan:
case llvm::Triple::ShaderModel:
TC = std::make_unique<toolchains::HLSLToolChain>(*this, Target, Args);
break;
diff --git a/clang/test/CodeGenHLSL/entry.hlsl b/clang/test/CodeGenHLSL/entry.hlsl
index ec4254e76fb66b..cd3bf948df48c4 100644
--- a/clang/test/CodeGenHLSL/entry.hlsl
+++ b/clang/test/CodeGenHLSL/entry.hlsl
@@ -2,6 +2,10 @@
// RUN: dxil-pc-shadermodel6.3-compute %s -hlsl-entry foo \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
+// RUN: spirv-unknown-vulkan-compute %s -hlsl-entry foo \
+// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+
// Make sure not mangle entry.
// CHECK:define void @foo()
// Make sure add function attribute and numthreads attribute.
diff --git a/clang/test/Driver/dxc_E.hlsl b/clang/test/Driver/dxc_E.hlsl
index 05cfca685c9a65..07715a2e2259af 100644
--- a/clang/test/Driver/dxc_E.hlsl
+++ b/clang/test/Driver/dxc_E.hlsl
@@ -1,4 +1,5 @@
// RUN: not %clang_dxc -Efoo -Tlib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s
+// RUN: not %clang_dxc -Efoo -Tlib_6_7 -spirv foo.hlsl -### %s 2>&1 | FileCheck %s
// Make sure E option flag which translated into "-hlsl-entry".
// CHECK:"-hlsl-entry" "foo"
|
@llvm/pr-subscribers-clang-driver Author: Steven Perron (s-perron) ChangesThe options are not translated correctly when targeting Vulkan using the dxc Fixes problem 2 in #108567. Full diff: https://github.com/llvm/llvm-project/pull/110306.diff 3 Files Affected:
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index d0c8bdba0ede95..fba6a8853c3960 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6481,6 +6481,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
case llvm::Triple::ZOS:
TC = std::make_unique<toolchains::ZOS>(*this, Target, Args);
break;
+ case llvm::Triple::Vulkan:
case llvm::Triple::ShaderModel:
TC = std::make_unique<toolchains::HLSLToolChain>(*this, Target, Args);
break;
diff --git a/clang/test/CodeGenHLSL/entry.hlsl b/clang/test/CodeGenHLSL/entry.hlsl
index ec4254e76fb66b..cd3bf948df48c4 100644
--- a/clang/test/CodeGenHLSL/entry.hlsl
+++ b/clang/test/CodeGenHLSL/entry.hlsl
@@ -2,6 +2,10 @@
// RUN: dxil-pc-shadermodel6.3-compute %s -hlsl-entry foo \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
+// RUN: spirv-unknown-vulkan-compute %s -hlsl-entry foo \
+// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+
// Make sure not mangle entry.
// CHECK:define void @foo()
// Make sure add function attribute and numthreads attribute.
diff --git a/clang/test/Driver/dxc_E.hlsl b/clang/test/Driver/dxc_E.hlsl
index 05cfca685c9a65..07715a2e2259af 100644
--- a/clang/test/Driver/dxc_E.hlsl
+++ b/clang/test/Driver/dxc_E.hlsl
@@ -1,4 +1,5 @@
// RUN: not %clang_dxc -Efoo -Tlib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s
+// RUN: not %clang_dxc -Efoo -Tlib_6_7 -spirv foo.hlsl -### %s 2>&1 | FileCheck %s
// Make sure E option flag which translated into "-hlsl-entry".
// CHECK:"-hlsl-entry" "foo"
|
The options are not translated correctly when targeting Vulkan using the dxc
driver mode. Resuing the translator used for HLSL.
Fixes problem 2 in #108567.