Skip to content

[mlir][dxsa] Add dcl constant buffer instruction#133

Merged
tagolog merged 1 commit into
access-softek:dxsa-mlirfrom
tagolog:dxsa-mlir-dcl_constant_buffer-and-other-ops
May 29, 2026
Merged

[mlir][dxsa] Add dcl constant buffer instruction#133
tagolog merged 1 commit into
access-softek:dxsa-mlirfrom
tagolog:dxsa-mlir-dcl_constant_buffer-and-other-ops

Conversation

@tagolog
Copy link
Copy Markdown

@tagolog tagolog commented May 21, 2026

Example:
dxsa.dcl_constant_buffer <slot = 0, size = 1>,
dxsa.dcl_constant_buffer <id = 0, lbound = 0, ubound = 3, size = 4, space = 1>,

@tagolog tagolog requested a review from asavonic May 21, 2026 05:34
Comment thread mlir/lib/Target/DXSA/BinaryParser.cpp
if (!accessPattern)
return emitError(loc, "unknown constant buffer access pattern: ")
<< rawAccessPattern;
auto operand = parseInlineOperand();
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.

The operand for dcl_constantBuffer is fake - it can only be D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER, and we only need indices from it. The second index is also fake: it defines size of a buffer. Other properties of operands are meaningless - components, mask, swizzle. I don't think they are used for this instruction.

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

Comment thread mlir/lib/Dialect/DXSA/IR/DXSA.cpp Outdated
LogicalResult
InlineOperandAttr::verify(function_ref<InFlightDiagnostic()> emitError,
::mlir::dxsa::InlineOperandType /*type*/,
uint32_t components,
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.

Do we verify that components can only be 0, 1, or 4?

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.

I plan to handle this in the separate PR that refines operands.

Comment thread mlir/lib/Target/DXSA/BinaryParser.cpp Outdated
Comment thread mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td
Comment thread mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td
@tagolog tagolog force-pushed the dxsa-mlir-dcl_constant_buffer-and-other-ops branch 2 times, most recently from 62108d3 to d14c5f0 Compare May 25, 2026 04:48
@tagolog tagolog changed the title Dxsa mlir dcl constant buffer and other ops [mlir][dxsa] Add dcl constant buffer instruction May 25, 2026
@tagolog tagolog requested a review from asavonic May 25, 2026 05:39
Copy link
Copy Markdown
Contributor

@asavonic asavonic left a comment

Choose a reason for hiding this comment

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

LGTM.

Comment thread mlir/lib/Target/DXSA/BinaryParser.cpp
Comment thread mlir/lib/Target/DXSA/BinaryParser.cpp Outdated
@tagolog tagolog force-pushed the dxsa-mlir-dcl_constant_buffer-and-other-ops branch from d14c5f0 to 01b2595 Compare May 29, 2026 04:38
Example:
  dxsa.dcl_constant_buffer <slot = 0, size = 1>, <immediateIndexed>
  dxsa.dcl_constant_buffer <id = 0, lbound = 0, ubound = 3, size = 4, space = 1>, <dynamicIndexed>

Signed-off-by: Vladimir Shiryaev <tagolog@users.noreply.github.com>
@tagolog tagolog force-pushed the dxsa-mlir-dcl_constant_buffer-and-other-ops branch from 01b2595 to 43f84ee Compare May 29, 2026 05:00
@tagolog tagolog merged commit cdfb680 into access-softek:dxsa-mlir May 29, 2026
5 checks passed
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