Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions mlir/include/mlir/Dialect/DXSA/IR/DXSAOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -819,4 +819,23 @@ def DXSA_DclHsJoinPhaseInstanceCount :
let assemblyFormat = "$count attr-dict";
}

def DXSA_DclHsForkPhaseInstanceCount :
DXSA_Op<"dcl_hs_fork_phase_instance_count"> {
let summary = "declares the Fork Phase instance count";
let description = [{
The `dxsa.dcl_hs_fork_phase_instance_count` operation declares
the Fork Phase instance count.

The `$count` must be a positive 32-bit unsigned integer in the range [1, 2^32 - 1].

Example:

```mlir
dxsa.dcl_hs_fork_phase_instance_count 42
```
}];
let arguments = (ins ConfinedAttr<UI32Attr, [DXSA_UIntNonZero]>:$count);
let assemblyFormat = "$count attr-dict";
}

#endif // DXSA_OPS
14 changes: 14 additions & 0 deletions mlir/lib/Target/DXSA/BinaryParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,11 @@ class DXBuilder {
builder, loc, builder.getUI32IntegerAttr(count));
}

Instruction buildDclHsForkPhaseInstanceCount(uint32_t count, Location loc) {
return dxsa::DclHsForkPhaseInstanceCount::create(
builder, loc, builder.getUI32IntegerAttr(count));
}

private:
MLIRContext *context;
ModuleOp module;
Expand Down Expand Up @@ -1240,6 +1245,12 @@ class Parser {
return builder.buildDclHsJoinPhaseInstanceCount(*count, loc);
}

FailureOr<Instruction> parseDclHsForkPhaseInstanceCount(Location loc) {
auto count = parseToken();
FAILURE_IF_FAILED(count);
return builder.buildDclHsForkPhaseInstanceCount(*count, loc);
}

OptionalParseResult parseDclInstruction(uint32_t opcodeToken, Location loc,
Instruction &out) {
FailureOr<Instruction> result;
Expand Down Expand Up @@ -1301,6 +1312,9 @@ class Parser {
case D3D11_SB_OPCODE_DCL_HS_JOIN_PHASE_INSTANCE_COUNT:
result = parseDclHsJoinPhaseInstanceCount(loc);
break;
case D3D11_SB_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT:
result = parseDclHsForkPhaseInstanceCount(loc);
break;
default:
return std::nullopt;
}
Expand Down
5 changes: 5 additions & 0 deletions mlir/test/Target/DXSA/dcl_hs_fork_phase_instance_count.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: mlir-translate --import-dxsa-bin %S/inputs/dcl_hs_fork_phase_instance_count.bin | FileCheck %s

// CHECK: module {
// CHECK-NEXT: dxsa.dcl_hs_fork_phase_instance_count 42
// CHECK-NEXT: }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: mlir-opt %s -split-input-file -verify-diagnostics

// expected-error@+1 {{attribute 'count' failed to satisfy constraint: 32-bit unsigned integer attribute whose value is non-zero}}
dxsa.dcl_hs_fork_phase_instance_count 0

// -----

// expected-error@+1 {{negative integer literal not valid for unsigned integer type}}
dxsa.dcl_hs_fork_phase_instance_count -1

// -----

// expected-error@+1 {{integer constant out of range for attribute}}
dxsa.dcl_hs_fork_phase_instance_count 4294967296
Binary file not shown.