Skip to content

Commit d7b8e52

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

4 files changed

Lines changed: 40 additions & 0 deletions

File tree

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,4 +754,21 @@ def DXSA_DclOutputSgv : DXSA_Op<"dcl_output_sgv"> {
754754
let assemblyFormat = "$operand `,` $name attr-dict";
755755
}
756756

757+
def DXSA_DclOutputSiv : DXSA_Op<"dcl_output_siv"> {
758+
let summary = "declares an output as a System Interpreted Value";
759+
let description = [{
760+
The `dxsa.dcl_output_siv` operation declares an output to be written
761+
that represents a System Interpreted Value.
762+
763+
Example:
764+
765+
```mlir
766+
dxsa.dcl_output_siv <type = output, components = 4, mask = <x, y, z, w>, index = [3]>, <position>
767+
```
768+
}];
769+
let arguments = (ins DXSA_InlineOperandAttr:$operand,
770+
DXSA_SystemValueNameAttr:$name);
771+
let assemblyFormat = "$operand `,` $name attr-dict";
772+
}
773+
757774
#endif // DXSA_OPS

mlir/lib/Target/DXSA/BinaryParser.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,12 @@ class DXBuilder {
647647
return dxsa::DclOutputSgv::create(builder, loc, operand, nameAttr);
648648
}
649649

650+
Instruction buildDclOutputSiv(dxsa::InlineOperandAttr operand,
651+
dxsa::SystemValueName name, Location loc) {
652+
auto nameAttr = dxsa::SystemValueNameAttr::get(builder.getContext(), name);
653+
return dxsa::DclOutputSiv::create(builder, loc, operand, nameAttr);
654+
}
655+
650656
private:
651657
MLIRContext *context;
652658
ModuleOp module;
@@ -1202,6 +1208,14 @@ class Parser {
12021208
return builder.buildDclOutputSgv(*operand, *name, loc);
12031209
}
12041210

1211+
FailureOr<Instruction> parseDclOutputSiv(Location loc) {
1212+
auto operand = parseInlineOperand();
1213+
FAILURE_IF_FAILED(operand);
1214+
auto name = parseSystemValueName(getLocation());
1215+
FAILURE_IF_FAILED(name);
1216+
return builder.buildDclOutputSiv(*operand, *name, loc);
1217+
}
1218+
12051219
OptionalParseResult parseDclInstruction(uint32_t opcodeToken, Location loc,
12061220
Instruction &out) {
12071221
FailureOr<Instruction> result;
@@ -1254,6 +1268,9 @@ class Parser {
12541268
case D3D10_SB_OPCODE_DCL_OUTPUT_SGV:
12551269
result = parseDclOutputSgv(loc);
12561270
break;
1271+
case D3D10_SB_OPCODE_DCL_OUTPUT_SIV:
1272+
result = parseDclOutputSiv(loc);
1273+
break;
12571274
default:
12581275
return std::nullopt;
12591276
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: mlir-translate --import-dxsa-bin %S/inputs/dcl_output_siv.bin | FileCheck %s
2+
3+
// CHECK: module {
4+
// CHECK-NEXT: dxsa.dcl_output_siv <type = output, components = 4, mask = <x, y, z, w>, index = [0]>, <position>
5+
// CHECK-NEXT: dxsa.dcl_output_siv <type = output, components = 4, mask = <x>, index = [1]>, <clipDistance>
6+
// CHECK-NEXT: }
32 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)