Skip to content

Commit 6cc4aaf

Browse files
Further small improvements
Signed-off-by: Davide Grohmann <[email protected]> Change-Id: Ia9094697d013be1242dc4a617be9896856baf14a
1 parent 2203b12 commit 6cc4aaf

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGraphOps.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ def SPIRV_GraphConstantARMOp : SPIRV_GraphARMOp<"GraphConstant", [InGraphScope,
129129
```mlir
130130
%0 = spirv.ARM.GraphConstant { graph_constant_id = 42 : i32 } : !spirv.arm.tensor<2x3xi16>
131131
```
132+
133+
GraphConstantID is a unique identifier which is use to map the contants
134+
defined by GraphConstantARM in the SPIRV module with the one provided at
135+
shader creation time via the VkDataGraphPipelineShaderModuleCreateInfoARM.
136+
That Vulkan structure provides a list of VkDataGraphPipelineConstantARM
137+
which contains the bindings from id to data. (For more details see
138+
https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#graphs)
132139
}];
133140

134141
let arguments = (ins

mlir/lib/Dialect/SPIRV/IR/ArmGraphOps.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,11 @@ LogicalResult spirv::GraphARMOp::verifyBody() {
144144

145145
ValueTypeRange<OperandRange> graphOutputOperandTypes =
146146
op.getValue().getType();
147-
for (unsigned i = 0, size = graphOutputOperandTypes.size(); i < size; ++i) {
148-
Type graphOutputOperandType = graphOutputOperandTypes[i];
149-
Type grResultType = grType.getResult(i);
150-
if (graphOutputOperandType != grResultType)
147+
for (const auto [index, type] : llvm::enumerate(graphOutputOperandTypes)) {
148+
if (type != grType.getResult(index))
151149
return op.emitError("type of return operand ")
152-
<< i << " (" << graphOutputOperandType
153-
<< ") doesn't match graph result type (" << grResultType << ")";
150+
<< index << " (" << type << ") doesn't match graph result type ("
151+
<< grType.getResult(index) << ")";
154152
}
155153
return WalkResult::advance();
156154
});
@@ -196,12 +194,12 @@ LogicalResult spirv::GraphOutputsARMOp::verify() {
196194
<< getNumOperands() << " operands, but enclosing spirv.ARM.Graph (@"
197195
<< graph.getName() << ") returns " << results.size();
198196

199-
for (const auto &result : llvm::enumerate(results))
200-
if (getOperand(result.index()).getType() != result.value())
201-
return emitError() << "type of return operand " << result.index() << " ("
202-
<< getOperand(result.index()).getType()
197+
for (const auto &[index, result] : llvm::enumerate(results))
198+
if (getOperand(index).getType() != result)
199+
return emitError() << "type of return operand " << index << " ("
200+
<< getOperand(index).getType()
203201
<< ") doesn't match spirv.ARM.Graph result type ("
204-
<< result.value() << ")"
202+
<< result << ")"
205203
<< " in graph @" << graph.getName();
206204
return success();
207205
}

0 commit comments

Comments
 (0)