[mlir][dxsa] Add dcl_resource_raw instruction#147
Open
tagolog wants to merge 1 commit into
Open
Conversation
asavonic
reviewed
May 28, 2026
|
|
||
| ```mlir | ||
| dxsa.dcl_resource_raw <type = resource, components = 0, index = [3]> | ||
| dxsa.dcl_resource_raw <type = resource, components = 0, index = [0, 0, 3]>, <space = 1> |
Contributor
There was a problem hiding this comment.
Index of dcl_resource_raw operand is fake: prior to Shader Model 5.1 it can only be 1D and means the resource number. For Shader Model 5.1 and later, index is always 3D and means [the resource number, lower bound, upper bound].
Can we define something like this instead?
dxsa.dcl_resource_raw <index = 1, lower_bound = 0, upper_bound = 3, space = 1>
It's all very confusing, especially since uses of t# resource use 2D indices and they work as regular indices [resource number, space index].
Author
There was a problem hiding this comment.
Fixed. I've used lbound and ubound as in dcl_constant_buffer
|
|
||
| std::optional<uint32_t> space; | ||
| auto indexArray = operand->getIndex(); | ||
| if (indexArray && indexArray.size() == 3) { |
Contributor
There was a problem hiding this comment.
We should emit a diagnostic if index dimension is not 1 or 3.
4304b0f to
2a869b0
Compare
Example:
dxsa.dcl_resource_raw <id = 3>
dxsa.dcl_resource_raw <id = 0, lbound = 0, ubound = 3, space = 1>
Signed-off-by: Vladimir Shiryaev <tagolog@users.noreply.github.com>
2a869b0 to
3bc3c92
Compare
asavonic
reviewed
Jun 1, 2026
| OptionalAttr<I32Attr>:$space); | ||
| let assemblyFormat = [{ | ||
| ` ` `<` `id` `=` $id | ||
| (`,` `lbound` `=` $lbound^ `,` `ubound` `=` $ubound |
Contributor
There was a problem hiding this comment.
What happens when lbound or ubound are not set?
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.
Example:
dxsa.dcl_resource_raw <type = resource, components = 0, index = [0, 0, 3]>, <space = 1>