-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[DirectX] Allow llvm.assume intrinsic to pass on to DXIL #165311
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
fixes llvm#165051 Change is just to let the assume intrinsic pass on unmodified. Test is to confirm the DXIL disassembler doesn't blow up whe we generate DXIL with this intrinsic.
|
@llvm/pr-subscribers-backend-directx Author: Farzon Lotfi (farzonl) Changesfixes #165051 Change is just to let the assume intrinsic pass on unmodified. Test is to confirm the DXIL disassembler doesn't blow up whe we generate DXIL with this intrinsic. Full diff: https://github.com/llvm/llvm-project/pull/165311.diff 2 Files Affected:
diff --git a/llvm/lib/Target/DirectX/DXILOpLowering.cpp b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
index e46a393e50906..8720460cceb20 100644
--- a/llvm/lib/Target/DirectX/DXILOpLowering.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
@@ -904,6 +904,8 @@ class OpLowerer {
case Intrinsic::dx_resource_casthandle:
// NOTE: llvm.dbg.value is supported as is in DXIL.
case Intrinsic::dbg_value:
+ // NOTE: llvm.assume is supported as is in DXIL.
+ case Intrinsic::assume:
case Intrinsic::not_intrinsic:
if (F.use_empty())
F.eraseFromParent();
diff --git a/llvm/test/tools/dxil-dis/llvm_assume.ll b/llvm/test/tools/dxil-dis/llvm_assume.ll
new file mode 100644
index 0000000000000..f5be66c0d192f
--- /dev/null
+++ b/llvm/test/tools/dxil-dis/llvm_assume.ll
@@ -0,0 +1,11 @@
+; RUN: llc --filetype=obj %s -o - | dxil-dis -o - | FileCheck %s
+
+target triple = "dxil-pc-shadermodel6.7-library"
+
+define void @test_llvm_assume(i1 %0) {
+; CHECK-LABEL: test_llvm_assume
+; CHECK-NEXT: tail call void @llvm.assume(i1 %0)
+tail call void @llvm.assume(i1 %0)
+ret void
+}
+
|
|
Just a note, we will want to use the offload test suite to see if the AMD, Intel, Nvidia, and Qualcomm gpu drivers can handle the assume llvm intrinsic. If they can't we should just remove this intrinsic. But for now we will allow it to pass on so we can run experiments. I can confirm right now that the metal tests are working with |
fixes llvm#165051 Change is just to let the assume intrinsic pass on unmodified. Test is to confirm the DXIL disassembler doesn't blow up whe we generate DXIL with this intrinsic.
fixes llvm#165051 Change is just to let the assume intrinsic pass on unmodified. Test is to confirm the DXIL disassembler doesn't blow up whe we generate DXIL with this intrinsic.
fixes llvm#165051 This change reverts the experiment we did for llvm#165311 While some backends seem to support llvm.assume without validation The validator itself does not so it makes more sense to just remove it.
fixes llvm#165051 This change reverts the experiment we did for llvm#165311 While some backends seem to support llvm.assume without validation The validator itself does not so it makes more sense to just remove it.
fixes #165051
Change is just to let the assume intrinsic pass on unmodified. Test is to confirm the DXIL disassembler doesn't blow up whe we generate DXIL with this intrinsic.