Skip to content

[mlir][dxsa] Add dcl_resource_raw instruction#147

Open
tagolog wants to merge 1 commit into
access-softek:dxsa-mlirfrom
tagolog:dxsa-mlir-dcl_resource_raw
Open

[mlir][dxsa] Add dcl_resource_raw instruction#147
tagolog wants to merge 1 commit into
access-softek:dxsa-mlirfrom
tagolog:dxsa-mlir-dcl_resource_raw

Conversation

@tagolog
Copy link
Copy Markdown

@tagolog tagolog commented May 28, 2026

Example:
dxsa.dcl_resource_raw <type = resource, components = 0, index = [0, 0, 3]>, <space = 1>

@tagolog tagolog requested a review from asavonic May 28, 2026 02:03

```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>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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].

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed. I've used lbound and ubound as in dcl_constant_buffer

Comment thread mlir/lib/Target/DXSA/BinaryParser.cpp Outdated

std::optional<uint32_t> space;
auto indexArray = operand->getIndex();
if (indexArray && indexArray.size() == 3) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should emit a diagnostic if index dimension is not 1 or 3.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed.

@tagolog tagolog force-pushed the dxsa-mlir-dcl_resource_raw branch from 4304b0f to 2a869b0 Compare May 29, 2026 03:55
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>
@tagolog tagolog force-pushed the dxsa-mlir-dcl_resource_raw branch from 2a869b0 to 3bc3c92 Compare May 29, 2026 04:03
@tagolog tagolog requested a review from asavonic May 29, 2026 21:36
OptionalAttr<I32Attr>:$space);
let assemblyFormat = [{
` ` `<` `id` `=` $id
(`,` `lbound` `=` $lbound^ `,` `ubound` `=` $ubound
Copy link
Copy Markdown
Contributor

@asavonic asavonic Jun 1, 2026

Choose a reason for hiding this comment

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

What happens when lbound or ubound are not set?

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.

2 participants