-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[DirectX] only allow intrinsics defined in DXIL.td #128613
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
Changes from 2 commits
69f0295
3aacbd7
f19dcf6
d40e8ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -770,8 +770,14 @@ class OpLowerer { | |
continue; | ||
Intrinsic::ID ID = F.getIntrinsicID(); | ||
switch (ID) { | ||
default: | ||
case Intrinsic::dx_resource_casthandle: | ||
case Intrinsic::not_intrinsic: | ||
continue; | ||
default: { | ||
DiagnosticInfoUnsupported Diag(F, "Unknown intrinsic?"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably include the name of the intrinsic in the error message here. It'd also be nice to have a debug location, but I suspect there isn't really anywhere we can grab a reasonable one from so I guess we'll do without. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The intrinsic name seems to already be encoded this is the error string i see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps "Unsupported intrinsic for DXIL lowering", but this seems informative enough. |
||
M.getContext().diagnose(Diag); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also set HasErrors here? It doesn't actually matter, since we won't leave the casthandles in an inconsistent state and we don't key anything else off of that, but it seems weird not to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add it for consistency. We don't seem to be able to do multiple Diagnostic errors per test case. Ie I can only invoke There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's because you're using |
||
break; | ||
} | ||
#define DXIL_OP_INTRINSIC(OpCode, Intrin, ...) \ | ||
case Intrin: \ | ||
HasErrors |= replaceFunctionWithOp( \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,7 +286,7 @@ declare <3 x half> @llvm.dx.nclamp.v3f16(<3 x half>, <3 x half>, <3 x half>) | |
declare <4 x float> @llvm.dx.nclamp.v4f32(<4 x float>, <4 x float>, <4 x float>) | ||
declare <2 x double> @llvm.dx.nclamp.v2f64(<2 x double>, <2 x double>, <2 x double>) | ||
declare <4 x i32> @llvm.dx.sclamp.v4i32(<4 x i32>, <4 x i32>, <4 x i32>) | ||
declare <3 x i16> @llvm.dx.uclamp.v3i32(<3 x i16>, <3 x i32>, <3 x i16>) | ||
declare <3 x i16> @llvm.dx.uclamp.v3i16(<3 x i16>, <3 x i16>, <3 x i16>) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's just to make the declaration match the function that is actually used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well one its a typo. but it broke when I changed to error by default.There was no uclamp.v3i32 usage only a declare. There was a uclamp.v3i16 usage but no declare. If we had a use then after the |
||
declare <4 x i32> @llvm.dx.uclamp.v4i32(<4 x i32>, <4 x i32>, <4 x i32>) | ||
declare <2 x i64> @llvm.dx.uclamp.v2i64(<2 x i64>, <2 x i64>, <2 x i64>) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
; RUN: not opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
; CHECK: error: <unknown>:0:0: in function llvm.vector.reduce.and.v4i32 i32 (<4 x i32>): Unknown intrinsic? | ||
define i32 @fn_and(<4 x i32> %0) local_unnamed_addr #0 { | ||
%2 = tail call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> %0) | ||
ret i32 %2 | ||
} | ||
|
||
declare i32 @llvm.vector.reduce.and.v4i32(<4 x i32>) | ||
|
||
attributes #0 = { convergent norecurse nounwind "hlsl.export"} |
Uh oh!
There was an error while loading. Please reload this page.