-
Notifications
You must be signed in to change notification settings - Fork 646
Generate differentiated error codes for buffer oob checking #4097
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
2ad0145 to
52a07e5
Compare
|
@dnovillo Can someone at Google please review? |
|
@greg-lunarg I'll review today. |
| static const int kInstErrorBindlessUninit = 1; | ||
| static const int kInstErrorBuffAddrUnallocRef = 2; | ||
| static const int kInstErrorBindlessBuffOOB = 3; | ||
| // Deleted: static const int kInstErrorBindlessBuffOOB = 3; |
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.
Suggest to just delete the line. It can be recovered from revision control if needed later.
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.
Thank you for the careful review! :)
Since this is a public header and I have deleted a previously used code, I did this so if there are problems between the instrumentation and the tool using this instrumentation around this change, it is a little more clear what the problem is ie. that the constant was purposely removed.
Rather than delete this line, I am going to add another comment line explaining things better. Let me know if you still have a problem with this.
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.
Oh, so the value 3 is now reserved in the sense that you need backwards compatibility?
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.
In that case, is there a way for us to at some point remove this line? Or do we have to have this value reserved for ever?
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.
Incidentally, I still don't see the changes you are referring to :)
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.
Can you see the new line at 174?
The comment will eventually go away. It is just there for the transitional period.
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.
I was expecting this rationale in the comment. Otherwise, looking at this code without the context of our conversation will tempt anyone to just get rid of the line.
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.
OK. I have added the rationale. Let me know if this is good.
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.
This change is breaking the validation layers which use the old value. Can we please leave the old value in place, add the new values, update downstream and then remove the old value?
52a07e5 to
883eee9
Compare
|
@dnovillo I think I have now addressed all your concerns. Please have another look! |
| static const int kInstErrorBindlessUninit = 1; | ||
| static const int kInstErrorBuffAddrUnallocRef = 2; | ||
| static const int kInstErrorBindlessBuffOOB = 3; | ||
| // Deleted: static const int kInstErrorBindlessBuffOOB = 3; |
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.
I was expecting this rationale in the comment. Otherwise, looking at this code without the context of our conversation will tempt anyone to just get rid of the line.
| ;CHECK: OpStore %97 %48 | ||
| ;CHECK: %99 = OpIAdd %uint %59 %uint_10 | ||
| ;CHECK: %100 = OpAccessChain %_ptr_StorageBuffer_uint %54 %uint_1 %99 | ||
| ;CHECK: OpStore %100 %49 |
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.
I know this is pre-existing code. However, would it make sense to check a few key elements instead of having CHECKs sprinkled all over the place? May facilitate maintenance in the future. No need to do this now, just wondering if all these CHECKs actually provide value.
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.
Yes, I haven't done a lot to keep these minimal. The thinking was to use CHECK-NOT and CHECK as sort of a -/+ diff format so people, especially maintainers can see exactly the substitutions that are being done. The idea is to use this as a two-fer: documentation and tests at the same time.
This is not to say that some clean up can't be done or wouldn't be helpful. I can probably get rid of definitions of uint_* since these are pretty self explanatory. A number of type declarations could probably be removed as well since their names are so self-explanatory. There is also replication between tests, for instance, the auxiliary functions that are created to read and write the special validation buffers.
I will follow this PR up with a cleanup PR.
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.
SG. Thanks!
This allows the GPU-AV layer to differentiate between errors with uniform buffers versus storage buffers and map these to the relevant VUIDs.
883eee9 to
6a7e784
Compare
dnovillo
left a comment
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.
Thanks! LGTM.
|
I'm going to revert this as it breaks the validation layers by removing |
|
@dj2 FWIW, even if we undeleted the old error code, this version is only generating the new error codes, so the layer would still not work. It is not correct to build the layers with any version of glslang and spirv-tools not specified through known-good. |
* Deprecate WebGPU SPIRV support Roll third_party/spirv-tools/ 1bb80d2..ee39b5d (16 commits) KhronosGroup/SPIRV-Tools@1bb80d2...ee39b5d $ git log 1bb80d2..ee39b5d --date=short --no-merges --format='%ad %ae %s' 2021-01-15 46493288+sfricke-samsung spirv-val: Add Vulkan Addressing Model check (KhronosGroup#4107) 2021-01-14 rharrison Remove WebGPU support (KhronosGroup#4108) 2021-01-14 46493288+sfricke-samsung spirv-val: Vulkan atomic storage class (KhronosGroup#4079) 2021-01-13 jaebaek Avoid integrity check failures caused by propagating line instructions (KhronosGroup#4096) 2021-01-13 pierremoreau Linker usability improvements (KhronosGroup#4084) 2021-01-12 dj2 Revert "Generate differentiated error codes for buffer oob checking (KhronosGroup#4097)" (KhronosGroup#4100) 2021-01-11 greg Generate differentiated error codes for buffer oob checking (KhronosGroup#4097) 2021-01-07 dneto use std::string::empty() to test for emptiness (KhronosGroup#4098) 2021-01-07 46493288+sfricke-samsung spirv-val: Label standalone Vulkan VUID (KhronosGroup#4091) 2021-01-06 46493288+sfricke-samsung spirv-val: Add Vulkan decroation VUID (KhronosGroup#4090) 2021-01-06 stevenperron Fix binding number calculation in desc sroa (KhronosGroup#4095) 2021-01-06 stevenperron Build deps: dump ini from 1.3.5 to 1.3.7 in tools/sva (KhronosGroup#4092) 2021-01-06 46493288+sfricke-samsung spirv-val: Add Vulkan FP Mode VUID (KhronosGroup#4088) 2021-01-06 46493288+sfricke-samsung spirv-val: Fix Vulkan image sampled check (KhronosGroup#4085) 2021-01-06 46493288+sfricke-samsung spirv-val: Add Vulkan ForwardPointer VUID (KhronosGroup#4089) 2021-01-06 46493288+sfricke-samsung spirv-val: Add Vulkan ImageTexelPointer format check (KhronosGroup#4087) Created with: roll-dep third_party/spirv-tools Fixes KhronosGroup#1166 * Retain the public API enums * Fix implicit fallthrough
This allows the GPU-AV layer to differentiate between errors with
uniform buffers versus storage buffers and map these to the relevant
VUIDs.