Skip to content
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

Validate presence of Stride operand to OpCooperativeMatrix{Load,Store}KHR #5777

Merged
merged 4 commits into from
Aug 29, 2024

Conversation

kpet
Copy link
Contributor

@kpet kpet commented Aug 28, 2024

The specification requires the Stride operand for the RowMajorKHR and ColumnMajorKHR layouts.

Change-Id: I51084b9b8dedebf9cab7ae25334ee56b75ef0126

The specification requires the Stride operand for the RowMajorKHR and
ColumnMajorKHR layouts.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Change-Id: I51084b9b8dedebf9cab7ae25334ee56b75ef0126
Copy link
Contributor

@alan-baker alan-baker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was re-reading the extension it struck me that we don't explicitly say how to interpret stride. I agree with the implication here that stride should interpreted as unsigned, but there is an ambiguity in my mind in the spec arising from the description of the memory layouts:

... OpCooperativeMatrixLoadKHR or OpCooperativeMatrixStoreKHR. Stride must be greater than 0 when passed to OpCooperativeMatrixStoreKHR and must be greater than or equal to 0 when passed to OpCooperativeMatrixLoadKHR.

If it is unsigned why say greater or equal to 0? Might be worth a clarification to the spec.

source/val/validate_memory.cpp Outdated Show resolved Hide resolved
source/val/validate_memory.cpp Outdated Show resolved Hide resolved
source/val/validate_memory.cpp Show resolved Hide resolved
kpet and others added 2 commits August 28, 2024 17:32
Co-authored-by: alan-baker <alanbaker@google.com>
Change-Id: I06d7308c4a2b62d26d69e88e03bfa009a7f8fff3
@kpet
Copy link
Contributor Author

kpet commented Aug 28, 2024

Thanks for the review!

Agree the spec could be improved. I've created KhronosGroup/SPIRV-Registry#279 to discuss spec clarifications.

If you're fine with deferring further improvements to the validation of the Stride operand to a separate change (my intent was only to catch the absence of it when required with this change) then this change should now be ready for another review. If you think we should do it all in this PR, then we'll need to wait for KhronosGroup/SPIRV-Registry#279 to be resolved.

@jeffbolznv
Copy link
Contributor

I ran this against the CTS cooperative matrix tests, and didn't have any issues.

Copy link
Contributor

@alan-baker alan-baker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting bot needs fixed.

source/val/validate_memory.cpp Outdated Show resolved Hide resolved
Change-Id: I9cbabec0ed2172dcd228cc385551cb7a5b79df1a
@alan-baker
Copy link
Contributor

The shaderc failure appears entirely unrelated to this change.

@alan-baker alan-baker merged commit b21dda0 into KhronosGroup:main Aug 29, 2024
23 of 24 checks passed
Keenuts pushed a commit to Keenuts/SPIRV-Tools that referenced this pull request Nov 12, 2024
…}KHR (KhronosGroup#5777)

* Validate Stride operand to OpCooperativeMatrix{Load,Store}KHR

The specification requires the Stride operand for the RowMajorKHR and
ColumnMajorKHR layouts.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Change-Id: I51084b9b8dedebf9cab7ae25334ee56b75ef0126

* Update source/val/validate_memory.cpp

Co-authored-by: alan-baker <alanbaker@google.com>

* add test to exercise memory layout from spec constant and fix validation

Change-Id: I06d7308c4a2b62d26d69e88e03bfa009a7f8fff3

* format fixes

Change-Id: I9cbabec0ed2172dcd228cc385551cb7a5b79df1a

---------

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Co-authored-by: alan-baker <alanbaker@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants