wgsl: Limit dynamic indexes to references to matrices and arrays.#1801
Merged
dneto0 merged 1 commit intogpuweb:mainfrom Jun 3, 2021
Merged
wgsl: Limit dynamic indexes to references to matrices and arrays.#1801dneto0 merged 1 commit intogpuweb:mainfrom
dneto0 merged 1 commit intogpuweb:mainfrom
Conversation
Contributor
kvark
reviewed
Jun 3, 2021
61dbc5e to
a4b5977
Compare
Contributor
Fixes gpuweb#1782. Note that dynamic indexing of vectors is allowed, since SPIR-V does have the OpVectorExtractDynamic instruction.
a4b5977 to
29b7e09
Compare
Contributor
kvark
approved these changes
Jun 3, 2021
dneto0
approved these changes
Jun 3, 2021
| Note: Reflecting the limitations of the languages WGSL is meant to be translated | ||
| into, it is only possible to use dynamically computed indices to subscript | ||
| references to matrices. A matrix not behind a reference may only be indexed by a | ||
| `const_expr`. To work around this restriction, consider storing the matrix in a |
| |e|: mat|N|x|M|<|T|><br> | ||
| |i|: [INT] | ||
| |i|: [INT]<br> | ||
| |i| is a `const_expr` expression |
Contributor
There was a problem hiding this comment.
While working through #1792, I realized we don't have a defined term for const_expr and we probably need one. (that's for later.) This is great for now though.
jimblandy
added a commit
to jimblandy/naga
that referenced
this pull request
Jun 4, 2021
This makes Naga IR validation impose the restrictions added to WGSL in gpuweb/gpuweb#1801. Remove code in the SPIR-V writer to spill arrays to temporary variables in order to index them dynamically. If such IR is encountered, treat it as a failure of validation.
jimblandy
added a commit
to jimblandy/naga
that referenced
this pull request
Jun 4, 2021
This makes Naga IR validation impose the restrictions added to WGSL in gpuweb/gpuweb#1801. Remove code in the SPIR-V writer to spill arrays to temporary variables in order to index them dynamically. If such IR is encountered, treat it as a failure of validation.
kvark
pushed a commit
to gfx-rs/naga
that referenced
this pull request
Jun 4, 2021
…#949) This makes Naga IR validation impose the restrictions added to WGSL in gpuweb/gpuweb#1801. Remove code in the SPIR-V writer to spill arrays to temporary variables in order to index them dynamically. If such IR is encountered, treat it as a failure of validation.
ben-clayton
pushed a commit
to ben-clayton/Tint
that referenced
this pull request
Jun 21, 2021
Dynamic indexes are limited to references to matrices and arrays gpuweb/gpuweb#1801 Bug: tint:867 Change-Id: I114daa053c8a4ffd23ce784ac4538567a551cc21 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54701 Kokoro: Kokoro <[email protected]> Reviewed-by: Ben Clayton <[email protected]> Commit-Queue: Ben Clayton <[email protected]> Auto-Submit: Sarah Mashayekhi <[email protected]>
ben-clayton
pushed a commit
to ben-clayton/Tint
that referenced
this pull request
Jun 21, 2021
gpuweb/gpuweb#1801 indexes must be of type 'i32' or 'u32' Bug: tint:867 Change-Id: Ie5bfacf87af5a06d5428dc510145e96fb156c42e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54720 Kokoro: Kokoro <[email protected]> Auto-Submit: Sarah Mashayekhi <[email protected]> Reviewed-by: Antonio Maiorano <[email protected]> Reviewed-by: Ben Clayton <[email protected]>
2 tasks
ben-clayton
pushed a commit
to ben-clayton/gpuweb
that referenced
this pull request
Sep 6, 2022
Useful for configuring global parameters for running tests, and for registering hooks to receive callbacks back from the test runner.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1782.
Note that dynamic indexing of vectors is allowed, since SPIR-V does have the
OpVectorExtractDynamic instruction.
At present, this simply requires that indices for subscripting arrays and
matrices by value must be i32 or u32 literals. Once #1272 is resolved, then that
will provide a more flexible concept of "constant" that we can use instead.