Name Strings
SPV_ARM_graph
Contact
To report problems with this extension, please open a new issue at:
Contributors
-
Kevin Petit, Arm Ltd.
Notice
Copyright (c) 2022-2025 Arm Ltd.
Status
Complete.
Version
Last Modified Date |
2025-06-18 |
Revision |
1 |
Dependencies
This extension is written against the SPIR-V Specification, Version 1.6 Revision 2.
This extension requires SPIR-V 1.0.
This extension requires SPV_ARM_tensors.
Overview
This extension adds support for graphs to SPIR-V. Graphs provide a construct to express dataflow computations operating on full resources (only tensors are supported with this extension but graphs could also be used with images). This extension does not define any operations for use within graphs.
Extension Name
To use this extension within a SPIR-V module, the following OpExtension must be present in the module:
OpExtension "SPV_ARM_graph"
Modifications to the SPIR-V Specification, Version 1.6
Terms
Graph: A dataflow graph defined by an OpGraphARM. A graph may consume inputs and produces at least one output.
Graph entry point: An OpGraphARM exposed to the execution environment using a OpGraphEntryPointARM instruction.
Graph Interface Type: An OpTypeTensorARM, OpTypeArray of OpTypeTensorARM, or OpTypeRuntimeArray of OpTypeTensorARM.
Logical Layout of a Module
This extension changes the logical layout of modules as follows:
Add a new section after 11 Function definitions where graph definitions and entry points reside. A graph definition is as follows:
-
Graph definition, using OpGraphARM.
-
Graph input values are defined using OpGraphInputARM instructions.
-
Body instructions.
-
Graph output values are set using OpGraphSetOutputARM instructions.
-
Graph end, using OpGraphEndARM.
Validation Rules
Modify Section 2.16.1 Universal Validation Rules:
Change:
"There is at least one OpEntryPoint instruction, unless the Linkage capability is being used."
to:
"There is at least one OpEntryPoint instruction, unless the *Linkage* or *GraphARM* capability is declared."
Add the following rules:
-
The value of the GraphConstantID operand of OpGraphConstantARM must be unique within a given module, i.e. no two graph constants are allowed to have the same GraphConstantID.
-
If the GraphARM capability is declared, there must be at least one OpGraphEntryPointARM instruction.
-
Two OpGraphInputARM instructions with the same InputIndex must not be part of the same graph definition unless ElementIndex is present in both with different values.
-
Two OpGraphSetOutputARM instructions with the same OutputIndex must not be part of the same graph definition unless ElementIndex is present in both with different values.
-
A graph definition must contain at least one OpGraphSetOutputARM.
-
A graph definition may only contain one of the following instructions:
-
OpGraphInputARM
-
OpGraphSetOutputARM
-
OpExtInst
-
OpCompositeExtract
-
Capabilities
Modify Section 3.31, "Capability", adding these rows to the Capability table:
Capability | Implicitly Declares | |
---|---|---|
4191 |
GraphARM |
Instructions
Add the following new instructions:
OpTypeGraphARM |
Capability: |
|||
4+ variable |
4190 |
Result <id> |
Literal |
<id> |
OpGraphConstantARM |
Capability: |
|||
4 |
4181 |
<id> |
Result <id> |
Literal |
OpGraphEntryPointARM |
Capability: |
|||
4+ variable |
4182 |
<id> |
Literal |
<id>,<id>,… |
OpGraphARM |
Capability: |
||
3 |
4183 |
<id> |
Result <id> |
OpGraphInputARM |
Capability: |
||||
4+ |
4184 |
<id> |
Result <id> |
InputIndex <id> |
Optional ElementIndex <id> |
OpGraphSetOutputARM |
Capability: |
|||
4+ |
4185 |
<id> |
<id> |
Optional <id> |
OpGraphEndARM |
Capability: |
3 |
4186 |
Issues
1) What should the type of graphs represent? Should it carry the type of the graph constants used by a graph?
RESOLVED: The type of graphs carries the number of inputs and outputs as well as their type. Inputs and outputs of tensor type may themselves encode the rank and shape of the tensors. The types of the graph constants used is not part of the type of a graph.
2) What types of resources should be supported as graph inputs, outputs and constants?
RESOLVED: This extension only adds support for OpTypeTensorARM and arrays of OpTypeTensorARM.
3) How should graph outputs be handled?
RESOLVED: OpGraphSetOutputARM instructions are used to assign values to individual graph outputs or elements of graph outputs of array type.
Previous drafts have used the following mechanisms:
-
A single per graph OpGraphSetOutputsARM return-style instruction to set all outputs, e.g.
OpGraphSetOutputsARM %out1 %out1
. This did not extend well to outputs of array type. -
OpGraphOutputARM instructions to forward-declare the ID for individual outputs. These were required to appear after all OpGraphInputARM instructions and IDs for outputs were then assigned by an intruction as part of the graph body. This former approach was abandonned to allow defining graphs that have one or more outputs directly connected to an input and because forward declarations are generally best avoided.
Revision History
Rev | Date | Author | Changes |
---|---|---|---|
1 |
2025-06-18 |
Kevin Petit |
Initial revision |