Skip to content

Commit 842f144

Browse files
committed
Address code review comments
1 parent ecf8147 commit 842f144

3 files changed

Lines changed: 20 additions & 22 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -777,22 +777,22 @@ def DXSA_DclInterface : DXSA_Op<"dcl_interface"> {
777777
let summary = "declares function table pointers (interfaces)";
778778
let description = [{
779779
Declare an `array_length` of function table pointers (interfaces). Each
780-
table can be bound at runtime, and it should contain `table_length` function
781-
bodies.
780+
table can be bound at runtime, and it should contain `num_call_sites`
781+
function bodies.
782782

783783
Example:
784784
```mlir
785785
dxsa.dcl_function_body 0
786786
dxsa.dcl_function_body 1
787787
dxsa.dcl_function_table 0, <functions = [0, 1]>
788-
dxsa.dcl_interface 1, <access = dynamic, array_length = 1, table_length = 2, tables = [0]>
788+
dxsa.dcl_interface 1, <access = dynamic, array_length = 1, num_call_sites = 2, tables = [0]>
789789
```
790790
}];
791-
let arguments = (ins I32Attr:$index, DXSA_InterfaceAccessAttr:$access, I32Attr:$array_length, I32Attr:$table_length, DenseI32ArrayAttr:$tables);
791+
let arguments = (ins I32Attr:$index, DXSA_InterfaceAccessAttr:$access, I32Attr:$array_length, I32Attr:$num_call_sites, DenseI32ArrayAttr:$tables);
792792
let assemblyFormat = [{ $index `,` `<`
793793
`access` `=` $access `,`
794794
`array_length` `=` $array_length `,`
795-
`table_length` `=` $table_length `,`
795+
`num_call_sites` `=` $num_call_sites `,`
796796
`tables` `=` $tables `>` attr-dict
797797
}];
798798
}

mlir/lib/Target/DXSA/BinaryParser.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,11 @@ class DXBuilder {
647647
}
648648

649649
Instruction buildDclInterface(uint32_t index, dxsa::InterfaceAccess access,
650-
uint32_t arrayLength, uint32_t tableLength,
650+
uint32_t arrayLength, uint32_t numCallSites,
651651
ArrayRef<int32_t> tables, Location loc) {
652652
auto *ctx = builder.getContext();
653653
return dxsa::DclInterface::create(builder, loc, index, access, arrayLength,
654-
tableLength,
654+
numCallSites,
655655
DenseI32ArrayAttr::get(ctx, tables));
656656
}
657657

@@ -1220,37 +1220,35 @@ class Parser {
12201220

12211221
FailureOr<Instruction> parseDclInterface(uint32_t opcodeToken, Location loc) {
12221222
bool isDynamic = DECODE_D3D11_SB_INTERFACE_INDEXED_BIT(opcodeToken);
1223-
auto access = dxsa::symbolizeInterfaceAccess(isDynamic);
1224-
assert(access && "unhandled interface access kind"); // access kind is 1 bit
1223+
auto access = isDynamic ? dxsa::InterfaceAccess::dynamic
1224+
: dxsa::InterfaceAccess::immediate;
12251225

12261226
// Index of the interface (start index for an array).
12271227
auto index = parseToken();
12281228
FAILURE_IF_FAILED(index);
12291229

12301230
// Number of call sites (number of bodies in each table).
1231-
auto tableLength = parseToken();
1232-
FAILURE_IF_FAILED(tableLength);
1231+
auto numCallSites = parseToken();
1232+
FAILURE_IF_FAILED(numCallSites);
12331233

1234-
auto interfaceArrayLength = parseToken();
1235-
FAILURE_IF_FAILED(interfaceArrayLength);
1234+
auto packedLenghts = parseToken();
1235+
FAILURE_IF_FAILED(packedLenghts);
12361236

12371237
// Number of tables (variants).
1238-
uint32_t interfaceLength =
1239-
DECODE_D3D11_SB_INTERFACE_TABLE_LENGTH(*interfaceArrayLength);
1238+
auto tableLength = DECODE_D3D11_SB_INTERFACE_TABLE_LENGTH(*packedLenghts);
12401239

12411240
// Number of slots to be defined at runtime.
1242-
uint32_t arrayLength =
1243-
DECODE_D3D11_SB_INTERFACE_ARRAY_LENGTH(*interfaceArrayLength);
1241+
auto arrayLength = DECODE_D3D11_SB_INTERFACE_ARRAY_LENGTH(*packedLenghts);
12441242

12451243
SmallVector<int32_t, 16> tables;
1246-
tables.resize(interfaceLength);
1247-
for (uint32_t i = 0; i < interfaceLength; ++i) {
1244+
tables.resize(tableLength);
1245+
for (uint32_t i = 0; i < tableLength; ++i) {
12481246
auto tableIndex = parseToken();
12491247
FAILURE_IF_FAILED(tableIndex);
12501248
tables[i] = *tableIndex;
12511249
}
12521250

1253-
return builder.buildDclInterface(*index, *access, arrayLength, *tableLength,
1251+
return builder.buildDclInterface(*index, access, arrayLength, *numCallSites,
12541252
tables, loc);
12551253
}
12561254

mlir/test/Target/DXSA/dcl_interface.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
// CHECK-LABEL: module
44

5-
// CHECK-NEXT: dxsa.dcl_interface 0, <access = dynamic, array_length = 253, table_length = 1, tables = [0, 1]>
6-
// CHECK-NEXT: dxsa.dcl_interface 0, <access = immediate, array_length = 253, table_length = 1, tables = [0, 1]>
5+
// CHECK-NEXT: dxsa.dcl_interface 0, <access = dynamic, array_length = 253, num_call_sites = 1, tables = [0, 1]>
6+
// CHECK-NEXT: dxsa.dcl_interface 0, <access = immediate, array_length = 253, num_call_sites = 1, tables = [0, 1]>

0 commit comments

Comments
 (0)