-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[DirectX] Support the CBufferLoadLegacy operation #128699
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
; We use llc for this test so that we don't abort after the first error. | ||
; RUN: not llc %s -o /dev/null 2>&1 | FileCheck %s | ||
|
||
target triple = "dxil-pc-shadermodel6.6-compute" | ||
|
||
declare void @f32_user(float) | ||
declare void @f64_user(double) | ||
declare void @f16_user(half) | ||
|
||
; CHECK: error: | ||
; CHECK-SAME: in function four64 | ||
; CHECK-SAME: Type mismatch between intrinsic and DXIL op | ||
define void @four64() "hlsl.export" { | ||
%buffer = call target("dx.CBuffer", target("dx.Layout", {double}, 8, 0)) | ||
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, i1 false) | ||
|
||
%load = call {double, double, double, double} @llvm.dx.resource.load.cbufferrow.4( | ||
target("dx.CBuffer", target("dx.Layout", {double}, 8, 0)) %buffer, | ||
i32 0) | ||
%data = extractvalue {double, double, double, double} %load, 0 | ||
|
||
call void @f64_user(double %data) | ||
|
||
ret void | ||
} | ||
|
||
; CHECK: error: | ||
; CHECK-SAME: in function two32 | ||
; CHECK-SAME: Type mismatch between intrinsic and DXIL op | ||
define void @two32() "hlsl.export" { | ||
%buffer = call target("dx.CBuffer", target("dx.Layout", {float}, 4, 0)) | ||
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, i1 false) | ||
|
||
%load = call {float, float} @llvm.dx.resource.load.cbufferrow.2( | ||
target("dx.CBuffer", target("dx.Layout", {float}, 4, 0)) %buffer, | ||
i32 0) | ||
%data = extractvalue {float, float} %load, 0 | ||
|
||
call void @f32_user(float %data) | ||
|
||
ret void | ||
} | ||
|
||
declare { double, double, double, double } @llvm.dx.resource.load.cbufferrow.4.f64.f64.f64.f64.tdx.CBuffer_tdx.Layout_sl_f64s_8_0tt(target("dx.CBuffer", target("dx.Layout", { double }, 8, 0)), i32) | ||
declare { float, float } @llvm.dx.resource.load.cbufferrow.2.f32.f32.tdx.CBuffer_tdx.Layout_sl_f32s_4_0tt(target("dx.CBuffer", target("dx.Layout", { float }, 4, 0)), i32) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why
def CBufRetHalfTy : DXILOpParamType;
and notdef CBufRetHalfTy : HalfTy;
?To phrase another way it looks like you have to do these reassociations later in DXILEmitter via
.Case("CBufRetHalfTy", "OverloadKind::HALF")
because CBufRetHalfTy is a special type.Why do the overloads have to be cbuffer types like below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dx.op.cbufferLoadLegacy
returns a named structure containing elements that are half, float, double, int16, int32, or int64, but it names its overload based on the element type. So we have these types:and we have these overloads:
The DXILEmitter association is telling us what to name the overloads, and the overloads are cbuffer types in DXIL.td so that we return these structs and not, say, a single
half
.