@@ -79,7 +79,7 @@ The SPIR-V dialect adopts the following conventions for IR:
79
79
* The prefix for all SPIR-V types and operations are ` spv. ` .
80
80
* All instructions in an extended instruction set are further qualified with
81
81
the extended instruction set's prefix. For example, all operations in the
82
- GLSL extended instruction set is has the prefix of ` spv.GLSL. ` .
82
+ GLSL extended instruction set have the prefix of ` spv.GLSL. ` .
83
83
* Ops that directly mirror instructions in the specification have ` CamelCase `
84
84
names that are the same as the instruction opnames (without the ` Op `
85
85
prefix). For example, ` spv.FMul ` is a direct mirror of ` OpFMul ` in the
@@ -93,7 +93,7 @@ The SPIR-V dialect adopts the following conventions for IR:
93
93
* Ops with ` _snake_case ` names are those that have no corresponding
94
94
instructions (or concepts) in the binary format. They are introduced to
95
95
satisfy MLIR structural requirements. For example, ` spv._module_end ` and
96
- ` spv._merge ` . They maps to no instructions during (de)serialization.
96
+ ` spv._merge ` . They map to no instructions during (de)serialization.
97
97
98
98
(TODO: consider merging the last two cases and adopting ` spv.mlir. ` prefix for
99
99
them.)
@@ -148,7 +148,7 @@ instructions are represented in the SPIR-V dialect:
148
148
#### Use MLIR attributes for metadata
149
149
150
150
* Requirements for capabilities, extensions, extended instruction sets,
151
- addressing model, and memory model is conveyed using ` spv.module `
151
+ addressing model, and memory model are conveyed using ` spv.module `
152
152
attributes. This is considered better because these information are for the
153
153
execution environment. It's easier to probe them if on the module op itself.
154
154
* Annotations/decoration instructions are "folded" into the instructions they
@@ -172,17 +172,17 @@ instructions are represented in the SPIR-V dialect:
172
172
* Normal constants are not placed in ` spv.module ` 's region; they are localized
173
173
into functions. This is to make functions in the SPIR-V dialect to be
174
174
isolated and explicit capturing. Constants are cheap to duplicate given
175
- attributes are uniqued in ` MLIRContext ` .
175
+ attributes are made unique in ` MLIRContext ` .
176
176
177
177
#### Adopt symbol-based global variables and specialization constant
178
178
179
179
* Global variables are defined with the ` spv.globalVariable ` op. They do not
180
180
generate SSA values. Instead they have symbols and should be referenced via
181
- symbols. To use a global variables in a function block, ` spv._address_of ` is
182
- needed to turn the symbol into a SSA value.
181
+ symbols. To use global variables in a function block, ` spv._address_of ` is
182
+ needed to turn the symbol into an SSA value.
183
183
* Specialization constants are defined with the ` spv.specConstant ` op. Similar
184
184
to global variables, they do not generate SSA values and have symbols for
185
- reference, too. ` spv._reference_of ` is needed to turn the symbol into a SSA
185
+ reference, too. ` spv._reference_of ` is needed to turn the symbol into an SSA
186
186
value for use in a function block.
187
187
188
188
The above choices enables functions in the SPIR-V dialect to be isolated and
@@ -415,13 +415,13 @@ functions or non-SPIR-V operations. `spv.module` verifies these requirements.
415
415
416
416
A major difference between the SPIR-V dialect and the SPIR-V specification for
417
417
functions is that the former are isolated and require explicit capturing, while
418
- the latter allow implicit capturing. In SPIR-V specification, functions can
418
+ the latter allows implicit capturing. In SPIR-V specification, functions can
419
419
refer to SSA values (generated by constants, global variables, etc.) defined in
420
420
modules. The SPIR-V dialect adjusted how constants and global variables are
421
421
modeled to enable isolated functions. Isolated functions are more friendly to
422
422
compiler analyses and transformations. This also enables the SPIR-V dialect to
423
423
better utilize core infrastructure: many functionalities in the core
424
- infrastructure requires ops to be isolated, e.g., the
424
+ infrastructure require ops to be isolated, e.g., the
425
425
[ greedy pattern rewriter] [ GreedyPatternRewriter ] can only act on ops isolated
426
426
from above.
427
427
@@ -742,23 +742,23 @@ func @foo() -> () {
742
742
SPIR-V supports versions, extensions, and capabilities as ways to indicate the
743
743
availability of various features (types, ops, enum cases) on target hardware.
744
744
For example, non-uniform group operations were missing before v1.3, and they
745
- require special capabilites like ` GroupNonUniformArithmetic ` to be used. These
745
+ require special capabilities like ` GroupNonUniformArithmetic ` to be used. These
746
746
availability information relates to [ target environment] ( #target-environment )
747
747
and affects the legality of patterns during dialect conversion.
748
748
749
749
SPIR-V ops' availability requirements are modeled with
750
750
[ op interfaces] [ MlirOpInterface ] :
751
751
752
- * ` QueryMinVersionInterface ` and ` QueryMaxVersionInterface ` for vesion
752
+ * ` QueryMinVersionInterface ` and ` QueryMaxVersionInterface ` for version
753
753
requirements
754
754
* ` QueryExtensionInterface ` for extension requirements
755
755
* ` QueryCapabilityInterface ` for capability requirements
756
756
757
- These interface declarations are auto-generated from TableGen defintions
757
+ These interface declarations are auto-generated from TableGen definitions
758
758
included in [ ` SPIRVBase.td ` ] [ MlirSpirvBase ] . At the moment all SPIR-V ops
759
- implements the above interfaces.
759
+ implement the above interfaces.
760
760
761
- SPIR-V ops' availability implemention methods are automatically synthesized
761
+ SPIR-V ops' availability implementation methods are automatically synthesized
762
762
from the availability specification on each op and enum attribute in TableGen.
763
763
An op needs to look into not only the opcode but also operands to derive its
764
764
availability requirements. For example, ` spv.ControlBarrier ` requires no
@@ -917,9 +917,9 @@ interface.
917
917
Although the main objective of the SPIR-V dialect is to act as a proper IR for
918
918
compiler transformations, being able to serialize to and deserialize from the
919
919
binary format is still very valuable for many good reasons. Serialization
920
- enables the artifacts of SPIR-V compilation to be consumed by a execution
920
+ enables the artifacts of SPIR-V compilation to be consumed by an execution
921
921
environment; deserialization allows us to import SPIR-V binary modules and run
922
- transformations on them. So serialization and deserialization is supported from
922
+ transformations on them. So serialization and deserialization are supported from
923
923
the very beginning of the development of the SPIR-V dialect.
924
924
925
925
The serialization library provides two entry points, ` mlir::spirv::serialize() `
@@ -1009,21 +1009,21 @@ Standard scalar types are converted to their corresponding SPIR-V scalar types.
1009
1009
it will be unconditionally converted to 32-bit. This should be switched to
1010
1010
properly emulating non-32-bit scalar types.)
1011
1011
1012
- [ Standard index Type ] [ MlirIndexType ] need special handling since they are not
1012
+ [ Standard index type ] [ MlirIndexType ] need special handling since they are not
1013
1013
directly supported in SPIR-V. Currently the ` index ` type is converted to ` i32 ` .
1014
1014
1015
1015
(TODO: Allow for configuring the integer width to use for ` index ` types in the
1016
1016
SPIR-V dialect)
1017
1017
1018
1018
SPIR-V only supports vectors of 2/3/4 elements; so
1019
- [ standard vector types] [ MlirVectorType ] of these length can be converted
1019
+ [ standard vector types] [ MlirVectorType ] of these lengths can be converted
1020
1020
directly.
1021
1021
1022
1022
(TODO: Convert other vectors of lengths to scalars or arrays)
1023
1023
1024
1024
[ Standard memref types] [ MlirMemrefType ] with static shape and stride are
1025
1025
converted to ` spv.ptr<spv.struct<spv.array<...>>> ` s. The resultant SPIR-V array
1026
- types has the same element type as the source memref and its number of elements
1026
+ types have the same element type as the source memref and its number of elements
1027
1027
is obtained from the layout specification of the memref. The storage class of
1028
1028
the pointer type are derived from the memref's memory space with
1029
1029
` SPIRVTypeConverter::getStorageClassForMemorySpace() ` .
@@ -1068,7 +1068,7 @@ returns an SSA value generated from an `spv._address_of` operation.
1068
1068
1069
1069
### Current conversions to SPIR-V
1070
1070
1071
- Using the above infrastructure, conversion are implemented from
1071
+ Using the above infrastructure, conversions are implemented from
1072
1072
1073
1073
* [ Standard Dialect] [ MlirStandardDialect ] : Only arithmetic and logical
1074
1074
operations conversions are implemented.
@@ -1240,7 +1240,7 @@ static LogicalResult verify(spirv::<spirv-op-symbol>Op op);
1240
1240
1241
1241
See any such function in [ ` SPIRVOps.cpp ` ] [ MlirSpirvOpsCpp ] as an example.
1242
1242
1243
- If no additional verification is needed, one need to add the following to
1243
+ If no additional verification is needed, one needs to add the following to
1244
1244
the op's Op Definition Spec:
1245
1245
1246
1246
```
0 commit comments