-
Notifications
You must be signed in to change notification settings - Fork 853
[SER] Validate 'reordercoherent' resource property #7429
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
7 commits
Select commit
Hold shift + click to select a range
fa72b3b
[SER] Validate 'reordercoherent' resource property
simoll 8a6955c
nfc: LLVM Coding Standards
simoll 562593a
Apply suggestions from code review
simoll e580147
chore: autopublish 2025-05-06T17:12:23Z
github-actions[bot] e614f46
Fix break in hctdb.py from earlier PR suggestion.
tex3d 5ab331c
Update generated DXIL.rst to unblock build
tex3d 2db3eb4
Fix expected msg in StructBufGlobalCoherentAndCounter
simoll 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
92 changes: 92 additions & 0 deletions
92
tools/clang/test/LitDXILValidation/ser_reordercoherent_invalid_incdec.ll
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,92 @@ | ||
| ; REQUIRES: dxil-1-9 | ||
| ; RUN: not %dxv %s 2>&1 | FileCheck %s | ||
|
|
||
| ; COM: Original HLSL source: | ||
| ; COM: reordercoherent RWStructuredBuffer<float> buffer; | ||
| ; COM: | ||
| ; COM: | ||
| ; COM: [Shader("raygeneration")] | ||
| ; COM: void | ||
| ; COM: main() | ||
| ; COM: { | ||
| ; COM: buffer.IncrementCounter(); | ||
| ; COM: buffer.DecrementCounter(); | ||
| ; COM: } | ||
|
|
||
| ; CHECK: error: reordercoherent cannot be used with append/consume buffers: 'buffer'. 'buffer' | ||
|
simoll marked this conversation as resolved.
Outdated
|
||
| ; CHECK-NEXT: Validation failed. | ||
|
|
||
| ; shader hash: 638950814a9023bf537d61dbb330a4c8 | ||
| ; | ||
| ; Buffer Definitions: | ||
| ; | ||
| ; Resource bind info for buffer | ||
| ; { | ||
| ; | ||
| ; float $Element; ; Offset: 0 Size: 4 | ||
| ; | ||
| ; } | ||
| ; | ||
| ; | ||
| ; Resource Bindings: | ||
| ; | ||
| ; Name Type Format Dim ID HLSL Bind Count | ||
| ; ------------------------------ ---------- ------- ----------- ------- -------------- ------ | ||
| ; buffer UAV struct r/w+cnt U0u4294967295,space4294967295 1 | ||
| ; | ||
| target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64" | ||
| target triple = "dxil-ms-dx" | ||
|
|
||
| %dx.types.Handle = type { i8* } | ||
| %dx.types.ResourceProperties = type { i32, i32 } | ||
| %"class.RWStructuredBuffer<float>" = type { float } | ||
|
|
||
| @"\01?buffer@@3V?$RWStructuredBuffer@M@@A" = external constant %dx.types.Handle, align 4 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| define void @"\01?main@@YAXXZ"() #0 { | ||
| %1 = load %dx.types.Handle, %dx.types.Handle* @"\01?buffer@@3V?$RWStructuredBuffer@M@@A", align 4 | ||
| %2 = call %dx.types.Handle @dx.op.createHandleForLib.dx.types.Handle(i32 160, %dx.types.Handle %1) ; CreateHandleForLib(Resource) | ||
| %3 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 102412, i32 4 }) ; AnnotateHandle(res,props) resource: reordercoherent RWStructuredBuffer<stride=4, counter> | ||
| %4 = call i32 @dx.op.bufferUpdateCounter(i32 70, %dx.types.Handle %3, i8 1) ; BufferUpdateCounter(uav,inc) | ||
| %5 = call %dx.types.Handle @dx.op.createHandleForLib.dx.types.Handle(i32 160, %dx.types.Handle %1) ; CreateHandleForLib(Resource) | ||
| %6 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %5, %dx.types.ResourceProperties { i32 102412, i32 4 }) ; AnnotateHandle(res,props) resource: reordercoherent RWStructuredBuffer<stride=4, counter> | ||
| %7 = call i32 @dx.op.bufferUpdateCounter(i32 70, %dx.types.Handle %6, i8 -1) ; BufferUpdateCounter(uav,inc) | ||
| ret void | ||
| } | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare i32 @dx.op.bufferUpdateCounter(i32, %dx.types.Handle, i8) #0 | ||
|
|
||
| ; Function Attrs: nounwind readnone | ||
| declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #1 | ||
|
|
||
| ; Function Attrs: nounwind readonly | ||
| declare %dx.types.Handle @dx.op.createHandleForLib.dx.types.Handle(i32, %dx.types.Handle) #2 | ||
|
|
||
| attributes #0 = { nounwind } | ||
| attributes #1 = { nounwind readnone } | ||
| attributes #2 = { nounwind readonly } | ||
|
|
||
| !dx.version = !{!0} | ||
| !dx.valver = !{!0} | ||
| !dx.shaderModel = !{!1} | ||
| !dx.resources = !{!2} | ||
| !dx.typeAnnotations = !{!6} | ||
| !dx.entryPoints = !{!10, !12} | ||
|
|
||
| !0 = !{i32 1, i32 9} | ||
| !1 = !{!"lib", i32 6, i32 9} | ||
| !2 = !{null, !3, null, null} | ||
| !3 = !{!4} | ||
| !4 = !{i32 0, %"class.RWStructuredBuffer<float>"* bitcast (%dx.types.Handle* @"\01?buffer@@3V?$RWStructuredBuffer@M@@A" to %"class.RWStructuredBuffer<float>"*), !"buffer", i32 -1, i32 -1, i32 1, i32 12, i1 false, i1 true, i1 false, !5} | ||
| !5 = !{i32 1, i32 4, i32 4, i1 true} | ||
| !6 = !{i32 1, void ()* @"\01?main@@YAXXZ", !7} | ||
| !7 = !{!8} | ||
| !8 = !{i32 1, !9, !9} | ||
| !9 = !{} | ||
| !10 = !{null, !"", null, !2, !11} | ||
| !11 = !{i32 0, i64 8589934608} | ||
| !12 = !{void ()* @"\01?main@@YAXXZ", !"\01?main@@YAXXZ", null, null, !13} | ||
| !13 = !{i32 8, i32 7, i32 5, !14} | ||
| !14 = !{i32 0} | ||
83 changes: 83 additions & 0 deletions
83
tools/clang/test/LitDXILValidation/ser_reordercoherent_invalid_sm.ll
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,83 @@ | ||
| ; REQUIRES: dxil-1-8 | ||
| ; RUN: not %dxv %s 2>&1 | FileCheck %s | ||
|
|
||
|
|
||
| ; CHECK: error: reordercoherent requires SM 6.9 or later. 'buf' | ||
| ; CHECK-NEXT: Function: ?main@@YAXXZ: error: reordercoherent requires SM 6.9 or later. | ||
| ; CHECK-NEXT: note: at '%3 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 69643, i32 0 })' in block '#0' of function '?main@@YAXXZ'. | ||
| ; CHECK-NEXT: Function: ?main@@YAXXZ: error: reordercoherent requires SM 6.9 or later. | ||
| ; CHECK-NEXT: note: at '%3 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 69643, i32 0 })' in block '#0' of function '?main@@YAXXZ'. | ||
| ; CHECK-NEXT: Validation failed. | ||
| ; COM: Original HLSL source: | ||
| ; COM: reordercoherent RWByteAddressBuffer buf; | ||
| ; COM: | ||
| ; COM: [Shader("raygeneration")] | ||
| ; COM: void main() | ||
| ; COM: { | ||
| ; COM: buf.Store(0, 11.f); | ||
| ; COM: } | ||
|
|
||
| ; shader hash: f7be6354830d1423764991adcfc26b0b | ||
| ; | ||
| ; Buffer Definitions: | ||
| ; | ||
| ; | ||
| ; Resource Bindings: | ||
| ; | ||
| ; Name Type Format Dim ID HLSL Bind Count | ||
| ; ------------------------------ ---------- ------- ----------- ------- -------------- ------ | ||
| ; buf UAV byte r/w U0u4294967295,space4294967295 1 | ||
| ; | ||
| target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64" | ||
| target triple = "dxil-ms-dx" | ||
|
|
||
| %dx.types.Handle = type { i8* } | ||
| %dx.types.ResourceProperties = type { i32, i32 } | ||
| %struct.RWByteAddressBuffer = type { i32 } | ||
|
|
||
| @"\01?buf@@3URWByteAddressBuffer@@A" = external constant %dx.types.Handle, align 4 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| define void @"\01?main@@YAXXZ"() #0 { | ||
| %1 = load %dx.types.Handle, %dx.types.Handle* @"\01?buf@@3URWByteAddressBuffer@@A", align 4 | ||
| %2 = call %dx.types.Handle @dx.op.createHandleForLib.dx.types.Handle(i32 160, %dx.types.Handle %1) ; CreateHandleForLib(Resource) | ||
| %3 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 69643, i32 0 }) ; AnnotateHandle(res,props) resource: reordercoherent RWByteAddressBuffer | ||
| call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %3, i32 0, i32 undef, float 1.100000e+01, float undef, float undef, float undef, i8 1, i32 4) ; RawBufferStore(uav,index,elementOffset,value0,value1,value2,value3,mask,alignment) | ||
| ret void | ||
| } | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare void @dx.op.rawBufferStore.f32(i32, %dx.types.Handle, i32, i32, float, float, float, float, i8, i32) #0 | ||
|
|
||
| ; Function Attrs: nounwind readnone | ||
| declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #1 | ||
|
|
||
| ; Function Attrs: nounwind readonly | ||
| declare %dx.types.Handle @dx.op.createHandleForLib.dx.types.Handle(i32, %dx.types.Handle) #2 | ||
|
|
||
| attributes #0 = { nounwind } | ||
| attributes #1 = { nounwind readnone } | ||
| attributes #2 = { nounwind readonly } | ||
|
|
||
| !dx.version = !{!0} | ||
| !dx.valver = !{!0} | ||
| !dx.shaderModel = !{!1} | ||
| !dx.resources = !{!2} | ||
| !dx.typeAnnotations = !{!3} | ||
| !dx.entryPoints = !{!4, !5} | ||
|
|
||
| !0 = !{i32 1, i32 8} | ||
| !1 = !{!"lib", i32 6, i32 8} | ||
| !2 = !{null, !6, null, null} | ||
| !3 = !{i32 1, void ()* @"\01?main@@YAXXZ", !7} | ||
| !4 = !{null, !"", null, !2, !8} | ||
| !5 = !{void ()* @"\01?main@@YAXXZ", !"\01?main@@YAXXZ", null, null, !9} | ||
| !6 = !{!10} | ||
| !7 = !{!11} | ||
| !8 = !{i32 0, i64 8589934608} | ||
| !9 = !{i32 8, i32 7, i32 5, !12} | ||
| !10 = !{i32 0, %struct.RWByteAddressBuffer* bitcast (%dx.types.Handle* @"\01?buf@@3URWByteAddressBuffer@@A" to %struct.RWByteAddressBuffer*), !"buf", i32 -1, i32 -1, i32 1, i32 11, i1 false, i1 false, i1 false, !13} | ||
| !11 = !{i32 1, !14, !14} | ||
| !12 = !{i32 0} | ||
| !13 = !{i32 4, i1 true} | ||
| !14 = !{} |
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.