Skip to content

Commit a2597b3

Browse files
committed
[mlir][dxsa] Add dcl_input_siv instruction
Example: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z, w>, index = [0]>, <position> Signed-off-by: Vladimir Shiryaev <tagolog@users.noreply.github.com>
1 parent cdfb680 commit a2597b3

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,24 @@ def DXSA_DclIndexRange : DXSA_Op<"dcl_index_range"> {
759759
let hasVerifier = 1;
760760
}
761761

762+
def DXSA_DclInputSiv : DXSA_Op<"dcl_input_siv"> {
763+
let summary = "declares an input register as a System Interpreted Value";
764+
let description = [{
765+
The `dxsa.dcl_input_siv` operation declares an input register
766+
that expects a System Interpreted Value to be provided
767+
from the upstream Stage.
768+
769+
Example:
770+
771+
```mlir
772+
dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z, w>, index = [0]>, <position>
773+
```
774+
}];
775+
let arguments = (ins DXSA_InlineOperandAttr:$operand,
776+
DXSA_SystemValueNameAttr:$name);
777+
let assemblyFormat = "$operand `,` $name attr-dict";
778+
}
779+
762780
def DXSA_DclOutputSgv : DXSA_Op<"dcl_output_sgv"> {
763781
let summary = "declares an output as a System Generated Value";
764782
let description = [{

mlir/lib/Target/DXSA/BinaryParser.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,12 @@ class DXBuilder {
651651
builder.getI32IntegerAttr(count));
652652
}
653653

654+
Instruction buildDclInputSiv(dxsa::InlineOperandAttr operand,
655+
dxsa::SystemValueName name, Location loc) {
656+
auto nameAttr = dxsa::SystemValueNameAttr::get(builder.getContext(), name);
657+
return dxsa::DclInputSiv::create(builder, loc, operand, nameAttr);
658+
}
659+
654660
Instruction buildDclOutputSgv(dxsa::InlineOperandAttr operand,
655661
dxsa::SystemValueName name, Location loc) {
656662
auto nameAttr = dxsa::SystemValueNameAttr::get(builder.getContext(), name);
@@ -1275,6 +1281,14 @@ class Parser {
12751281
return builder.buildDclIndexRange(*operand, *count, loc);
12761282
}
12771283

1284+
FailureOr<Instruction> parseDclInputSiv(Location loc) {
1285+
auto operand = parseInlineOperand();
1286+
FAILURE_IF_FAILED(operand);
1287+
auto name = parseSystemValueName(getLocation());
1288+
FAILURE_IF_FAILED(name);
1289+
return builder.buildDclInputSiv(*operand, *name, loc);
1290+
}
1291+
12781292
FailureOr<Instruction> parseDclOutputSgv(Location loc) {
12791293
auto operand = parseInlineOperand();
12801294
FAILURE_IF_FAILED(operand);
@@ -1441,6 +1455,9 @@ class Parser {
14411455
case D3D10_SB_OPCODE_DCL_INDEX_RANGE:
14421456
result = parseDclIndexRange(loc);
14431457
break;
1458+
case D3D10_SB_OPCODE_DCL_INPUT_SIV:
1459+
result = parseDclInputSiv(loc);
1460+
break;
14441461
case D3D10_SB_OPCODE_DCL_OUTPUT_SGV:
14451462
result = parseDclOutputSgv(loc);
14461463
break;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: mlir-translate --import-dxsa-bin %S/inputs/dcl_input_siv.bin | FileCheck %s
2+
3+
// CHECK: module {
4+
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z, w>, index = [0]>, <position>
5+
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y, z>, index = [1]>, <clipDistance>
6+
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x, y>, index = [2]>, <cullDistance>
7+
// CHECK-NEXT: dxsa.dcl_input_siv <type = input, components = 4, mask = <x>, index = [3]>, <finalQuadUInsideTessFactor>
8+
// CHECK-NEXT: }
64 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)