Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGraphOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ def SPIRV_GraphConstantARMOp : SPIRV_GraphARMOp<"GraphConstant", [InGraphScope,
```mlir
%0 = spirv.ARM.GraphConstant { graph_constant_id = 42 : i32 } : !spirv.arm.tensor<2x3xi16>
```

GraphConstantID is a unique identifier which is use to map the contants
defined by GraphConstantARM in the SPIRV module with the one provided at
shader creation time via the VkDataGraphPipelineShaderModuleCreateInfoARM.
That Vulkan structure provides a list of VkDataGraphPipelineConstantARM
which contains the bindings from id to data. (For more details see
https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#graphs)
}];

let arguments = (ins
Expand Down
20 changes: 9 additions & 11 deletions mlir/lib/Dialect/SPIRV/IR/ArmGraphOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,11 @@ LogicalResult spirv::GraphARMOp::verifyBody() {

ValueTypeRange<OperandRange> graphOutputOperandTypes =
op.getValue().getType();
for (unsigned i = 0, size = graphOutputOperandTypes.size(); i < size; ++i) {
Type graphOutputOperandType = graphOutputOperandTypes[i];
Type grResultType = grType.getResult(i);
if (graphOutputOperandType != grResultType)
for (const auto [index, type] : llvm::enumerate(graphOutputOperandTypes)) {
if (type != grType.getResult(index))
return op.emitError("type of return operand ")
<< i << " (" << graphOutputOperandType
<< ") doesn't match graph result type (" << grResultType << ")";
<< index << " (" << type << ") doesn't match graph result type ("
<< grType.getResult(index) << ")";
}
return WalkResult::advance();
});
Expand Down Expand Up @@ -196,12 +194,12 @@ LogicalResult spirv::GraphOutputsARMOp::verify() {
<< getNumOperands() << " operands, but enclosing spirv.ARM.Graph (@"
<< graph.getName() << ") returns " << results.size();

for (const auto &result : llvm::enumerate(results))
if (getOperand(result.index()).getType() != result.value())
return emitError() << "type of return operand " << result.index() << " ("
<< getOperand(result.index()).getType()
for (const auto &[index, result] : llvm::enumerate(results))
if (getOperand(index).getType() != result)
return emitError() << "type of return operand " << index << " ("
<< getOperand(index).getType()
<< ") doesn't match spirv.ARM.Graph result type ("
<< result.value() << ")"
<< result << ")"
<< " in graph @" << graph.getName();
return success();
}
Expand Down
Loading