-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[HLSL][NFC] Update resource metadata tests to not use obsolete annotations #130222
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 1 commit
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
; RUN: opt -S -dxil-translate-metadata < %s | FileCheck %s | ||
; RUN: opt -S --passes="dxil-pretty-printer" < %s 2>&1 | FileCheck %s --check-prefix=PRINT | ||
; RUN: llc %s --filetype=asm -o - < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,PRINT | ||
|
||
target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" | ||
target triple = "dxil-pc-shadermodel6.6-compute" | ||
|
||
%__cblayout_CB1 = type <{ float, i32, double, <2 x i32> }> | ||
@CB1.cb = external constant target("dx.CBuffer", target("dx.Layout", %__cblayout_CB1, 24, 0, 4, 8, 16)) | ||
|
||
%__cblayout_CB2 = type <{ float, double, float, half, i16, i64, i32 }> | ||
@CB2.cb = external constant target("dx.CBuffer", target("dx.Layout", %__cblayout_CB2, 36, 0, 8, 16, 20, 22, 24, 32)) | ||
|
||
%__cblayout_CB3 = type <{ double, <3 x float>, float, <3 x double>, half, <2 x double>, float, <3 x half>, <3 x half> }> | ||
@CB3.cb = external constant target("dx.CBuffer", target("dx.Layout", %__cblayout_CB3, 96, 0, 16, 28, 32, 56, 64, 80, 84, 90)) | ||
|
||
; PRINT:; Resource Bindings: | ||
; PRINT-NEXT:; | ||
; PRINT-NEXT:; Name Type Format Dim ID HLSL Bind Count | ||
; PRINT-NEXT:; ------------------------------ ---------- ------- ----------- ------- -------------- ------ | ||
; PRINT-NEXT:; cbuffer NA NA CB0 cb0 1 | ||
; PRINT-NEXT:; cbuffer NA NA CB1 cb1 1 | ||
; PRINT-NEXT:; cbuffer NA NA CB2 cb5,space15 1 | ||
|
||
define void @test() #0 { | ||
|
||
; cbuffer CB1 : register(b0) { | ||
; float a; | ||
; int b; | ||
; double c; | ||
; int2 d; | ||
; } | ||
%CB1.cb_h = call target("dx.CBuffer", target("dx.Layout", %__cblayout_CB1, 24, 0, 4, 8, 16)) | ||
@llvm.dx.resource.handlefrombinding.tdx.CBuffer_tdx.Layout_s___cblayout_CB1s_24_0_4_8_16tt( | ||
i32 0, i32 0, i32 1, i32 0, i1 false) | ||
store target("dx.CBuffer", target("dx.Layout", %__cblayout_CB1, 24, 0, 4, 8, 16)) %CB1.cb_h, ptr @CB1.cb, align 4 | ||
|
||
; cbuffer CB2 : register(b0) { | ||
; float a; | ||
; double b; | ||
; float c; | ||
; half d; | ||
; uint16_t e; | ||
; int64_t f; | ||
; int g; | ||
;} | ||
|
||
%CB2.cb_h = call target("dx.CBuffer", target("dx.Layout", %__cblayout_CB2, 36, 0, 8, 16, 20, 22, 24, 32)) | ||
@llvm.dx.resource.handlefrombinding.tdx.CBuffer_tdx.Layout_s___cblayout_CB2s_36_0_8_16_20_22_24_32tt( | ||
i32 0, i32 1, i32 1, i32 0, i1 false) | ||
store target("dx.CBuffer", target("dx.Layout", %__cblayout_CB2, 36, 0, 8, 16, 20, 22, 24, 32)) %CB2.cb_h, ptr @CB2.cb, align 4 | ||
|
||
; cbuffer CB3 : register(b5) { | ||
; double B0; | ||
; float3 B1; | ||
; float B2; | ||
; double3 B3; | ||
; half B4; | ||
; double2 B5; | ||
; float B6; | ||
; half3 B7; | ||
; half3 B8; | ||
; } | ||
%CB3.cb_h = call target("dx.CBuffer", target("dx.Layout", %__cblayout_CB3, 96, 0, 16, 28, 32, 56, 64, 80, 84, 90)) | ||
@llvm.dx.resource.handlefrombinding.tdx.CBuffer_tdx.Layout_s___cblayout_CB3s_96_0_16_28_32_56_64_80_84_90tt( | ||
i32 15, i32 5, i32 1, i32 0, i1 false) | ||
store target("dx.CBuffer", target("dx.Layout", %__cblayout_CB3, 96, 0, 16, 28, 32, 56, 64, 80, 84, 90)) %CB3.cb_h, ptr @CB3.cb, align 4 | ||
|
||
ret void | ||
} | ||
|
||
attributes #0 = { noinline nounwind "hlsl.shader"="compute" } | ||
|
||
; CHECK: !dx.resources = !{[[ResList:[!][0-9]+]]} | ||
|
||
; CHECK: [[ResList]] = !{null, null, [[CBList:[!][0-9]+]], null} | ||
; CHECK: [[CBList]] = !{![[CB1:[0-9]+]], ![[CB2:[0-9]+]], ![[CB3:[0-9]+]]} | ||
; CHECK: ![[CB1]] = !{i32 0, ptr @0, !"", i32 0, i32 0, i32 1, i32 24, null} | ||
; CHECK: ![[CB2]] = !{i32 1, ptr @1, !"", i32 0, i32 1, i32 1, i32 36, null} | ||
; CHECK: ![[CB3]] = !{i32 2, ptr @2, !"", i32 15, i32 5, i32 1, i32 96, null} |
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,103 @@ | ||
; RUN: opt -S -dxil-translate-metadata < %s | FileCheck %s | ||
; RUN: opt -S --passes="dxil-pretty-printer" < %s 2>&1 | FileCheck %s --check-prefix=PRINT | ||
; RUN: llc %s --filetype=asm -o - < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,PRINT | ||
|
||
target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" | ||
target triple = "dxil-pc-shadermodel6.6-compute" | ||
|
||
%"class.hlsl::Buffer" = type { target("dx.TypedBuffer", <4 x half>, 0, 0, 0) } | ||
%"class.hlsl::Buffer.1" = type { target("dx.TypedBuffer", <2 x float>, 0, 0, 0) } | ||
%"class.hlsl::Buffer.2" = type { target("dx.TypedBuffer", double, 0, 0, 0) } | ||
%"class.hlsl::Buffer.3" = type { target("dx.TypedBuffer", i32, 0, 0, 1) } | ||
%"class.hlsl::ByteAddressBuffer" = type { target("dx.RawBuffer", i8, 0, 0) } | ||
%"class.hlsl::StructuredBuffer" = type { target("dx.RawBuffer", i16, 0, 0) } | ||
%"class.hlsl::Buffer.4" = type { target("dx.TypedBuffer", i64, 0, 0, 0) } | ||
|
||
@Zero = internal global %"class.hlsl::Buffer" poison, align 4 | ||
@One = internal global %"class.hlsl::Buffer.1" poison, align 4 | ||
@Two = internal global %"class.hlsl::Buffer.2" poison, align 4 | ||
@Three = internal global %"class.hlsl::Buffer.3" poison, align 4 | ||
@Four = internal global %"class.hlsl::ByteAddressBuffer" poison, align 4 | ||
@Five = internal global %"class.hlsl::StructuredBuffer" poison, align 4 | ||
@Six = internal global %"class.hlsl::Buffer.4" poison, align 4 | ||
|
||
; PRINT:; Resource Bindings: | ||
; PRINT-NEXT:; | ||
; PRINT-NEXT:; Name Type Format Dim ID HLSL Bind Count | ||
; PRINT-NEXT:; ------------------------------ ---------- ------- ----------- ------- -------------- ------ | ||
; PRINT-NEXT:; SRV f16 buf T0 t0 1 | ||
; PRINT-NEXT:; SRV f32 buf T1 t1 1 | ||
; PRINT-NEXT:; SRV f64 buf T2 t2 1 | ||
; PRINT-NEXT:; SRV i32 buf T3 t3 1 | ||
; PRINT-NEXT:; SRV byte r/o T4 t5 1 | ||
; PRINT-NEXT:; SRV struct r/o T5 t6 1 | ||
; PRINT-NEXT:; SRV u64 buf T6 t10,space2 1 | ||
|
||
define void @test() #0 { | ||
; RWBuffer<half4> Buf : register(u0) | ||
hekota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
%Zero_h = call target("dx.TypedBuffer", <4 x half>, 0, 0, 0) | ||
@llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v4f16_0_0_0t( | ||
i32 0, i32 0, i32 1, i32 0, i1 false) | ||
store target("dx.TypedBuffer", <4 x half>, 0, 0, 0) %Zero_h, ptr @Zero, align 4 | ||
|
||
; RWBuffer<float4> Buf : register(u1) | ||
%One_h = call target("dx.TypedBuffer", <2 x float>, 0, 0, 0) | ||
@llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v2f32_0_0_0t( | ||
i32 0, i32 1, i32 1, i32 0, i1 false) | ||
store target("dx.TypedBuffer", <2 x float>, 0, 0, 0) %One_h, ptr @One, align 4 | ||
|
||
; RWBuffer<double> Two : register(u2); | ||
%Two_h = call target("dx.TypedBuffer", double, 0, 0, 0) | ||
@llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f64_0_0_0t( | ||
i32 0, i32 2, i32 1, i32 0, i1 false) | ||
store target("dx.TypedBuffer", double, 0, 0, 0) %Two_h, ptr @Two, align 4 | ||
|
||
; RWBuffer<int4> Three : register(u3); | ||
%Three_h = call target("dx.TypedBuffer", <4 x i32>, 0, 0, 1) | ||
@llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_i32_0_0_1t( | ||
i32 0, i32 3, i32 1, i32 0, i1 false) | ||
store target("dx.TypedBuffer", <4 x i32>, 0, 0, 1) %Three_h, ptr @Three, align 4 | ||
|
||
; ByteAddressBuffer Four : register(u4) | ||
%Four_h = call target("dx.RawBuffer", i8, 0, 0) | ||
@llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i8_0_0t( | ||
i32 0, i32 5, i32 1, i32 0, i1 false) | ||
store target("dx.RawBuffer", i8, 0, 0) %Four_h, ptr @Four, align 4 | ||
|
||
; StructuredBuffer<int16_t> Five : register(u6); | ||
%Five_h = call target("dx.RawBuffer", i16, 0, 0) | ||
@llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i16_0_0t( | ||
i32 0, i32 6, i32 1, i32 0, i1 false) | ||
store target("dx.RawBuffer", i16, 0, 0) %Five_h, ptr @Five, align 4 | ||
|
||
; RWBuffer<double> Two : register(u2); | ||
%Six_h = call target("dx.TypedBuffer", i64, 0, 0, 0) | ||
@llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f64_0_0_0t( | ||
i32 2, i32 10, i32 1, i32 0, i1 false) | ||
store target("dx.TypedBuffer", i64, 0, 0, 0) %Six_h, ptr @Six, align 4 | ||
|
||
ret void | ||
} | ||
|
||
attributes #0 = { noinline nounwind "hlsl.shader"="compute" } | ||
|
||
; CHECK: !dx.resources = !{[[ResList:[!][0-9]+]]} | ||
|
||
; CHECK: [[ResList]] = !{[[SRVList:[!][0-9]+]], null, null, null} | ||
; CHECK: [[SRVList]] = !{![[Zero:[0-9]+]], ![[One:[0-9]+]], ![[Two:[0-9]+]], | ||
; CHECK-SAME: ![[Three:[0-9]+]], ![[Four:[0-9]+]], ![[Five:[0-9]+]], | ||
; CHECK-SAME: ![[Six:[0-9]+]]} | ||
|
||
; CHECK: ![[Zero]] = !{i32 0, ptr @0, !"", i32 0, i32 0, i32 1, i32 10, i32 0, ![[Half:[0-9]+]]} | ||
; CHECK: ![[Half]] = !{i32 0, i32 8} | ||
; CHECK: ![[One]] = !{i32 1, ptr @1, !"", i32 0, i32 1, i32 1, i32 10, i32 0, ![[Float:[0-9]+]]} | ||
; CHECK: ![[Float]] = !{i32 0, i32 9} | ||
; CHECK: ![[Two]] = !{i32 2, ptr @2, !"", i32 0, i32 2, i32 1, i32 10, i32 0, ![[Double:[0-9]+]]} | ||
; CHECK: ![[Double]] = !{i32 0, i32 10} | ||
; CHECK: ![[Three]] = !{i32 3, ptr @3, !"", i32 0, i32 3, i32 1, i32 10, i32 0, ![[I32:[0-9]+]]} | ||
; CHECK: ![[I32]] = !{i32 0, i32 4} | ||
; CHECK: ![[Four]] = !{i32 4, ptr @4, !"", i32 0, i32 5, i32 1, i32 11, i32 0, null} | ||
; CHECK: ![[Five]] = !{i32 5, ptr @5, !"", i32 0, i32 6, i32 1, i32 12, i32 0, ![[FiveStride:[0-9]+]]} | ||
; CHECK: ![[FiveStride]] = !{i32 1, i32 2} | ||
; CHECK: ![[Six]] = !{i32 6, ptr @6, !"", i32 2, i32 10, i32 1, i32 10, i32 0, ![[U64:[0-9]+]]} | ||
; CHECK: ![[U64]] = !{i32 0, i32 7} |
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.