Skip to content

[mlir][dxsa] Add raster instructions#202

Open
kuilpd wants to merge 2 commits into
dxsa-mlirfrom
kuilpd/dxsa-add-deriv_rtxy_ops
Open

[mlir][dxsa] Add raster instructions#202
kuilpd wants to merge 2 commits into
dxsa-mlirfrom
kuilpd/dxsa-add-deriv_rtxy_ops

Conversation

@kuilpd

@kuilpd kuilpd commented Jun 25, 2026

Copy link
Copy Markdown

Add instructions:
deriv_rtx
deriv_rty
deriv_rtx_coarse
deriv_rty_coarse
deriv_rtx_fine
deriv_rty_fine
lod

@kuilpd kuilpd requested review from asavonic and tagolog June 25, 2026 18:49
@@ -0,0 +1,210 @@
//===- DXSADoubleRasterOps.td - DXSA raster ops -*- tablegen -*-===//

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
//===- DXSADoubleRasterOps.td - DXSA raster ops -*- tablegen -*-===//
//===- DXSARasterOps.td - DXSA raster ops -*- tablegen -*-===//

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

With the latest PRs, I've introduced a new approach to test files that was approved by Anton.

Can we combine all deriv-related tests to a single test file raster_ops.test and run mlir-translate with --split-input-file option?
atomic_ops.test

// RUN: mlir-translate --split-input-file --import-dxsa-hex %s | FileCheck %s
// RUN: mlir-translate --split-input-file --import-dxsa-hex %s | mlir-opt --split-input-file --verify-roundtrip

// CHECK-LABEL: dxsa.module {
// CHECK-NEXT:   dxsa.atomic_and u<0>, r<0>, r<1, <x>>
// CHECK-NEXT: }
0x070000a9, 0x0011e000, 0x00000000, 0x00100e46, 0x00000000, 0x0010000a, 0x00000001

// -----

// CHECK-LABEL: dxsa.module {
// CHECK-NEXT:   dxsa.atomic_and g<0>, r<2>, r<3, <x>>
// CHECK-NEXT: }
0x070000a9, 0x0011f000, 0x00000000, 0x00100e46, 0x00000002, 0x0010000a, 0x00000003

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Notice that all latest PRs use .test extension for test files.
Refer #180 for more details.

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.

Unified the test, but now there's so much cases there, is that okay?


// CHECK: dxsa.module {

// CHECK-NEXT: dxsa.deriv_rtx_coarse r<0>, v<1>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion (non-blocking): add a precise case for each of instructions. Base operation already supports it, but a hex line with the precise modifier would confirm the full import path for these ops.

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.

Added the cases

@kuilpd kuilpd changed the title [mlir][dxsa] Add deriv_rtx/y_coarse and deriv_rtx/y_fine instructions [mlir][dxsa] Add raster instructions Jun 27, 2026
@kuilpd

kuilpd commented Jun 27, 2026

Copy link
Copy Markdown
Author

I'm still not sure if deriv_rtx and deriv_rty are supported in DX11, they're not in the documentation. The only reference I could find is this, so I took the description from there:
https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/deriv-rtx--sm4---asm-

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