diff --git a/mlir/docs/Dialects/SPIR-V.md b/mlir/docs/Dialects/SPIR-V.md --- a/mlir/docs/Dialects/SPIR-V.md +++ b/mlir/docs/Dialects/SPIR-V.md @@ -180,7 +180,7 @@ generate SSA values. Instead they have symbols and should be referenced via symbols. To use global variables in a function block, `spv.mlir.addressof` is needed to turn the symbol into an SSA value. -* Specialization constants are defined with the `spv.specConstant` op. Similar +* Specialization constants are defined with the `spv.SpecConstant` op. Similar to global variables, they do not generate SSA values and have symbols for reference, too. `spv.mlir.referenceof` is needed to turn the symbol into an SSA value for use in a function block. @@ -989,7 +989,7 @@ `spv.globalVariable` into an SSA value. * Every use of a `OpSpecConstant` instruction will materialize a `spv.mlir.referenceof` op to turn the symbol of the corresponding - `spv.specConstant` into an SSA value. + `spv.SpecConstant` into an SSA value. * `OpPhi` instructions are converted to block arguments. * Structured control flow are placed inside `spv.selection` and `spv.loop`. diff --git a/mlir/docs/SPIRVToLLVMDialectConversion.md b/mlir/docs/SPIRVToLLVMDialectConversion.md --- a/mlir/docs/SPIRVToLLVMDialectConversion.md +++ b/mlir/docs/SPIRVToLLVMDialectConversion.md @@ -640,7 +640,7 @@ * spv.MemoryBarrier * spv.mlir.referenceof * spv.SMod -* spv.specConstant +* spv.SpecConstant * spv.Unreachable * spv.VectorExtractDynamic diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td --- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td @@ -562,7 +562,7 @@ // ----- -def SPV_SpecConstantOp : SPV_Op<"specConstant", [InModuleScope, Symbol]> { +def SPV_SpecConstantOp : SPV_Op<"SpecConstant", [InModuleScope, Symbol]> { let summary = "The op that declares a SPIR-V specialization constant"; let description = [{ @@ -579,7 +579,7 @@ ``` - spv-spec-constant-op ::= `spv.specConstant` symbol-ref-id + spv-spec-constant-op ::= `spv.SpecConstant` symbol-ref-id `spec_id(` integer `)` `=` attribute-value (`:` spirv-type)? ``` @@ -590,8 +590,8 @@ #### Example: ```mlir - spv.specConstant @spec_const1 = true - spv.specConstant @spec_const2 spec_id(5) = 42 : i32 + spv.SpecConstant @spec_const1 = true + spv.SpecConstant @spec_const2 spec_id(5) = 42 : i32 ``` }]; @@ -609,23 +609,23 @@ // ----- -def SPV_SpecConstantCompositeOp : SPV_Op<"specConstantComposite", [ +def SPV_SpecConstantCompositeOp : SPV_Op<"SpecConstantComposite", [ InModuleScope, Symbol]> { let summary = "Declare a new composite specialization constant."; let description = [{ This op declares a SPIR-V composite specialization constant. This covers the `OpSpecConstantComposite` SPIR-V instruction. Scalar constants are - covered by `spv.specConstant`. + covered by `spv.SpecConstant`. A constituent of a spec constant composite can be: - A symbol referring of another spec constant. - The SSA ID of a non-specialization constant (i.e. defined through - `spv.specConstant`). + `spv.SpecConstant`). - The SSA ID of a `spv.undef`. ``` - spv-spec-constant-composite-op ::= `spv.specConstantComposite` symbol-ref-id ` (` + spv-spec-constant-composite-op ::= `spv.SpecConstantComposite` symbol-ref-id ` (` symbol-ref-id (`, ` symbol-ref-id)* `) :` composite-type ``` @@ -636,10 +636,10 @@ #### Example: ```mlir - spv.specConstant @sc1 = 1 : i32 - spv.specConstant @sc2 = 2.5 : f32 - spv.specConstant @sc3 = 3.5 : f32 - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct + spv.SpecConstant @sc1 = 1 : i32 + spv.SpecConstant @sc2 = 2.5 : f32 + spv.SpecConstant @sc3 = 3.5 : f32 + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct ``` TODO Add support for constituents that are: diff --git a/mlir/include/mlir/Dialect/SPIRV/Linking/ModuleCombiner.h b/mlir/include/mlir/Dialect/SPIRV/Linking/ModuleCombiner.h --- a/mlir/include/mlir/Dialect/SPIRV/Linking/ModuleCombiner.h +++ b/mlir/include/mlir/Dialect/SPIRV/Linking/ModuleCombiner.h @@ -44,7 +44,7 @@ /// - If 2 spv.globalVariable's have either the same descriptor set + binding /// or the same build_in attribute value, then replace one of them using the /// other. -/// - If 2 spv.specConstant's have the same spec_id attribute value, then +/// - If 2 spv.SpecConstant's have the same spec_id attribute value, then /// replace one of them using the other. /// - If 2 spv.func's are identical replace one of them using the other. /// diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp @@ -2067,7 +2067,7 @@ if (!initOp || !isa(initOp)) { return varOp.emitOpError("initializer must be result of a " - "spv.specConstant or spv.globalVariable op"); + "spv.SpecConstant or spv.globalVariable op"); } } @@ -2644,7 +2644,7 @@ if (!specConstOp && !specConstCompositeOp) return referenceOfOp.emitOpError( - "expected spv.specConstant or spv.SpecConstantComposite symbol"); + "expected spv.SpecConstant or spv.SpecConstantComposite symbol"); if (referenceOfOp.reference().getType() != constType) return referenceOfOp.emitOpError("result type mismatch with the referenced " @@ -2814,7 +2814,7 @@ } //===----------------------------------------------------------------------===// -// spv.specConstant +// spv.SpecConstant //===----------------------------------------------------------------------===// static ParseResult parseSpecConstantOp(OpAsmParser &parser, @@ -3390,7 +3390,7 @@ } //===----------------------------------------------------------------------===// -// spv.specConstantComposite +// spv.SpecConstantComposite //===----------------------------------------------------------------------===// static ParseResult parseSpecConstantCompositeOp(OpAsmParser &parser, diff --git a/mlir/test/Dialect/SPIRV/IR/memory-ops.mlir b/mlir/test/Dialect/SPIRV/IR/memory-ops.mlir --- a/mlir/test/Dialect/SPIRV/IR/memory-ops.mlir +++ b/mlir/test/Dialect/SPIRV/IR/memory-ops.mlir @@ -508,7 +508,7 @@ // ----- spv.module Logical GLSL450 { - spv.specConstant @sc = 42 : i32 + spv.SpecConstant @sc = 42 : i32 // CHECK-LABEL: @variable_init_spec_constant spv.func @variable_init_spec_constant() -> () "None" { %0 = spv.mlir.referenceof @sc : i32 diff --git a/mlir/test/Dialect/SPIRV/IR/structure-ops.mlir b/mlir/test/Dialect/SPIRV/IR/structure-ops.mlir --- a/mlir/test/Dialect/SPIRV/IR/structure-ops.mlir +++ b/mlir/test/Dialect/SPIRV/IR/structure-ops.mlir @@ -316,7 +316,7 @@ // ----- spv.module Logical GLSL450 { - spv.specConstant @sc = 4.0 : f32 + spv.SpecConstant @sc = 4.0 : f32 // CHECK: spv.globalVariable @var initializer(@sc) : !spv.ptr spv.globalVariable @var initializer(@sc) : !spv.ptr } @@ -324,7 +324,7 @@ // ----- // Allow initializers coming from other module-like ops -spv.specConstant @sc = 4.0 : f32 +spv.SpecConstant @sc = 4.0 : f32 // CHECK: spv.globalVariable @var initializer(@sc) spv.globalVariable @var initializer(@sc) : !spv.ptr @@ -369,7 +369,7 @@ // ----- spv.module Logical GLSL450 { - // expected-error @+1 {{op initializer must be result of a spv.specConstant or spv.globalVariable op}} + // expected-error @+1 {{op initializer must be result of a spv.SpecConstant or spv.globalVariable op}} spv.globalVariable @var0 initializer(@var1) : !spv.ptr } @@ -527,11 +527,11 @@ //===----------------------------------------------------------------------===// spv.module Logical GLSL450 { - spv.specConstant @sc1 = false - spv.specConstant @sc2 = 42 : i64 - spv.specConstant @sc3 = 1.5 : f32 + spv.SpecConstant @sc1 = false + spv.SpecConstant @sc2 = 42 : i64 + spv.SpecConstant @sc3 = 1.5 : f32 - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i1, i64, f32)> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i1, i64, f32)> // CHECK-LABEL: @reference spv.func @reference() -> i1 "None" { @@ -570,7 +570,7 @@ // ----- // Allow taking reference of spec constant in other module-like ops -spv.specConstant @sc = 5 : i32 +spv.SpecConstant @sc = 5 : i32 func @reference_of() { // CHECK: spv.mlir.referenceof @sc %0 = spv.mlir.referenceof @sc : i32 @@ -579,8 +579,8 @@ // ----- -spv.specConstant @sc = 5 : i32 -spv.specConstantComposite @scc (@sc) : !spv.array<1 x i32> +spv.SpecConstant @sc = 5 : i32 +spv.SpecConstantComposite @scc (@sc) : !spv.array<1 x i32> func @reference_of_composite() { // CHECK: spv.mlir.referenceof @scc : !spv.array<1 x i32> @@ -593,7 +593,7 @@ spv.module Logical GLSL450 { spv.func @foo() -> () "None" { - // expected-error @+1 {{expected spv.specConstant or spv.SpecConstantComposite symbol}} + // expected-error @+1 {{expected spv.SpecConstant or spv.SpecConstantComposite symbol}} %0 = spv.mlir.referenceof @sc : i32 spv.Return } @@ -602,7 +602,7 @@ // ----- spv.module Logical GLSL450 { - spv.specConstant @sc = 42 : i32 + spv.SpecConstant @sc = 42 : i32 spv.func @foo() -> () "None" { // expected-error @+1 {{result type mismatch with the referenced specialization constant's type}} %0 = spv.mlir.referenceof @sc : f32 @@ -613,8 +613,8 @@ // ----- spv.module Logical GLSL450 { - spv.specConstant @sc = 42 : i32 - spv.specConstantComposite @scc (@sc) : !spv.array<1 x i32> + spv.SpecConstant @sc = 42 : i32 + spv.SpecConstantComposite @scc (@sc) : !spv.array<1 x i32> spv.func @foo() -> () "None" { // expected-error @+1 {{result type mismatch with the referenced specialization constant's type}} %0 = spv.mlir.referenceof @scc : f32 @@ -625,172 +625,172 @@ // ----- //===----------------------------------------------------------------------===// -// spv.specConstant +// spv.SpecConstant //===----------------------------------------------------------------------===// spv.module Logical GLSL450 { - // CHECK: spv.specConstant @sc1 = false - spv.specConstant @sc1 = false - // CHECK: spv.specConstant @sc2 spec_id(5) = 42 : i64 - spv.specConstant @sc2 spec_id(5) = 42 : i64 - // CHECK: spv.specConstant @sc3 = 1.500000e+00 : f32 - spv.specConstant @sc3 = 1.5 : f32 + // CHECK: spv.SpecConstant @sc1 = false + spv.SpecConstant @sc1 = false + // CHECK: spv.SpecConstant @sc2 spec_id(5) = 42 : i64 + spv.SpecConstant @sc2 spec_id(5) = 42 : i64 + // CHECK: spv.SpecConstant @sc3 = 1.500000e+00 : f32 + spv.SpecConstant @sc3 = 1.5 : f32 } // ----- spv.module Logical GLSL450 { // expected-error @+1 {{SpecId cannot be negative}} - spv.specConstant @sc2 spec_id(-5) = 42 : i64 + spv.SpecConstant @sc2 spec_id(-5) = 42 : i64 } // ----- spv.module Logical GLSL450 { // expected-error @+1 {{default value bitwidth disallowed}} - spv.specConstant @sc = 15 : i4 + spv.SpecConstant @sc = 15 : i4 } // ----- spv.module Logical GLSL450 { // expected-error @+1 {{default value can only be a bool, integer, or float scalar}} - spv.specConstant @sc = dense<[2, 3]> : vector<2xi32> + spv.SpecConstant @sc = dense<[2, 3]> : vector<2xi32> } // ----- func @use_in_function() -> () { // expected-error @+1 {{op must appear in a module-like op's block}} - spv.specConstant @sc = false + spv.SpecConstant @sc = false return } // ----- //===----------------------------------------------------------------------===// -// spv.specConstantComposite +// spv.SpecConstantComposite //===----------------------------------------------------------------------===// spv.module Logical GLSL450 { // expected-error @+1 {{result type must be a composite type}} - spv.specConstantComposite @scc2 (@sc1, @sc2, @sc3) : i32 + spv.SpecConstantComposite @scc2 (@sc1, @sc2, @sc3) : i32 } //===----------------------------------------------------------------------===// -// spv.specConstantComposite (spv.array) +// spv.SpecConstantComposite (spv.array) //===----------------------------------------------------------------------===// // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = 1.5 : f32 - spv.specConstant @sc2 = 2.5 : f32 - spv.specConstant @sc3 = 3.5 : f32 - // CHECK: spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.array<3 x f32> - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.array<3 x f32> + spv.SpecConstant @sc1 = 1.5 : f32 + spv.SpecConstant @sc2 = 2.5 : f32 + spv.SpecConstant @sc3 = 3.5 : f32 + // CHECK: spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.array<3 x f32> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.array<3 x f32> } // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = false - spv.specConstant @sc2 spec_id(5) = 42 : i64 - spv.specConstant @sc3 = 1.5 : f32 + spv.SpecConstant @sc1 = false + spv.SpecConstant @sc2 spec_id(5) = 42 : i64 + spv.SpecConstant @sc3 = 1.5 : f32 // expected-error @+1 {{has incorrect number of operands: expected 4, but provided 3}} - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.array<4 x f32> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.array<4 x f32> } // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = 1 : i32 - spv.specConstant @sc2 = 2.5 : f32 - spv.specConstant @sc3 = 3.5 : f32 + spv.SpecConstant @sc1 = 1 : i32 + spv.SpecConstant @sc2 = 2.5 : f32 + spv.SpecConstant @sc3 = 3.5 : f32 // expected-error @+1 {{has incorrect types of operands: expected 'f32', but provided 'i32'}} - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.array<3 x f32> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.array<3 x f32> } //===----------------------------------------------------------------------===// -// spv.specConstantComposite (spv.struct) +// spv.SpecConstantComposite (spv.struct) //===----------------------------------------------------------------------===// // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = 1 : i32 - spv.specConstant @sc2 = 2.5 : f32 - spv.specConstant @sc3 = 3.5 : f32 - // CHECK: spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i32, f32, f32)> - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i32, f32, f32)> + spv.SpecConstant @sc1 = 1 : i32 + spv.SpecConstant @sc2 = 2.5 : f32 + spv.SpecConstant @sc3 = 3.5 : f32 + // CHECK: spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i32, f32, f32)> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i32, f32, f32)> } // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = 1 : i32 - spv.specConstant @sc2 = 2.5 : f32 - spv.specConstant @sc3 = 3.5 : f32 + spv.SpecConstant @sc1 = 1 : i32 + spv.SpecConstant @sc2 = 2.5 : f32 + spv.SpecConstant @sc3 = 3.5 : f32 // expected-error @+1 {{has incorrect number of operands: expected 2, but provided 3}} - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i32, f32)> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i32, f32)> } // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = 1.5 : f32 - spv.specConstant @sc2 = 2.5 : f32 - spv.specConstant @sc3 = 3.5 : f32 + spv.SpecConstant @sc1 = 1.5 : f32 + spv.SpecConstant @sc2 = 2.5 : f32 + spv.SpecConstant @sc3 = 3.5 : f32 // expected-error @+1 {{has incorrect types of operands: expected 'i32', but provided 'f32'}} - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i32, f32, f32)> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spv.struct<(i32, f32, f32)> } //===----------------------------------------------------------------------===// -// spv.specConstantComposite (vector) +// spv.SpecConstantComposite (vector) //===----------------------------------------------------------------------===// // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = 1.5 : f32 - spv.specConstant @sc2 = 2.5 : f32 - spv.specConstant @sc3 = 3.5 : f32 - // CHECK: spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : vector<3xf32> - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : vector<3 x f32> + spv.SpecConstant @sc1 = 1.5 : f32 + spv.SpecConstant @sc2 = 2.5 : f32 + spv.SpecConstant @sc3 = 3.5 : f32 + // CHECK: spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : vector<3xf32> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : vector<3 x f32> } // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = false - spv.specConstant @sc2 spec_id(5) = 42 : i64 - spv.specConstant @sc3 = 1.5 : f32 + spv.SpecConstant @sc1 = false + spv.SpecConstant @sc2 spec_id(5) = 42 : i64 + spv.SpecConstant @sc3 = 1.5 : f32 // expected-error @+1 {{has incorrect number of operands: expected 4, but provided 3}} - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : vector<4xf32> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : vector<4xf32> } // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = 1 : i32 - spv.specConstant @sc2 = 2.5 : f32 - spv.specConstant @sc3 = 3.5 : f32 + spv.SpecConstant @sc1 = 1 : i32 + spv.SpecConstant @sc2 = 2.5 : f32 + spv.SpecConstant @sc3 = 3.5 : f32 // expected-error @+1 {{has incorrect types of operands: expected 'f32', but provided 'i32'}} - spv.specConstantComposite @scc (@sc1, @sc2, @sc3) : vector<3xf32> + spv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : vector<3xf32> } //===----------------------------------------------------------------------===// -// spv.specConstantComposite (spv.coopmatrix) +// spv.SpecConstantComposite (spv.coopmatrix) //===----------------------------------------------------------------------===// // ----- spv.module Logical GLSL450 { - spv.specConstant @sc1 = 1.5 : f32 + spv.SpecConstant @sc1 = 1.5 : f32 // expected-error @+1 {{unsupported composite type}} - spv.specConstantComposite @scc (@sc1) : !spv.coopmatrix<8x16xf32, Device> + spv.SpecConstantComposite @scc (@sc1) : !spv.coopmatrix<8x16xf32, Device> } //===----------------------------------------------------------------------===// @@ -816,7 +816,7 @@ // ----- spv.module Logical GLSL450 { - spv.specConstant @sc = 42 : i32 + spv.SpecConstant @sc = 42 : i32 spv.func @foo() -> i32 "None" { // CHECK: [[SC:%.*]] = spv.mlir.referenceof @sc diff --git a/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/basic.mlir b/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/basic.mlir --- a/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/basic.mlir +++ b/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/basic.mlir @@ -2,8 +2,8 @@ // CHECK: module { // CHECK-NEXT: spv.module Logical GLSL450 { -// CHECK-NEXT: spv.specConstant @m1_sc -// CHECK-NEXT: spv.specConstant @m2_sc +// CHECK-NEXT: spv.SpecConstant @m1_sc +// CHECK-NEXT: spv.SpecConstant @m2_sc // CHECK-NEXT: spv.func @variable_init_spec_constant // CHECK-NEXT: spv.mlir.referenceof @m2_sc // CHECK-NEXT: spv.Variable init @@ -14,11 +14,11 @@ module { spv.module Logical GLSL450 { - spv.specConstant @m1_sc = 42.42 : f32 + spv.SpecConstant @m1_sc = 42.42 : f32 } spv.module Logical GLSL450 { - spv.specConstant @m2_sc = 42 : i32 + spv.SpecConstant @m2_sc = 42 : i32 spv.func @variable_init_spec_constant() -> () "None" { %0 = spv.mlir.referenceof @m2_sc : i32 %1 = spv.Variable init(%0) : !spv.ptr diff --git a/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/conflict-resolution.mlir b/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/conflict-resolution.mlir --- a/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/conflict-resolution.mlir +++ b/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/conflict-resolution.mlir @@ -339,7 +339,7 @@ // CHECK-NEXT: spv.ReturnValue // CHECK-NEXT: } -// CHECK-NEXT: spv.specConstant @foo_1 +// CHECK-NEXT: spv.SpecConstant @foo_1 // CHECK-NEXT: } module { @@ -350,7 +350,7 @@ } spv.module Logical GLSL450 { - spv.specConstant @foo = -5 : i32 + spv.SpecConstant @foo = -5 : i32 } } @@ -365,7 +365,7 @@ // CHECK-NEXT: spv.ReturnValue // CHECK-NEXT: } -// CHECK-NEXT: spv.specConstant @foo_1 +// CHECK-NEXT: spv.SpecConstant @foo_1 // CHECK-NEXT: spv.func @bar // CHECK-NEXT: spv.mlir.referenceof @foo_1 // CHECK-NEXT: spv.ReturnValue @@ -380,7 +380,7 @@ } spv.module Logical GLSL450 { - spv.specConstant @foo = -5 : i32 + spv.SpecConstant @foo = -5 : i32 spv.func @bar() -> i32 "None" { %0 = spv.mlir.referenceof @foo : i32 @@ -396,7 +396,7 @@ // CHECK: module { // CHECK-NEXT: spv.module Logical GLSL450 { -// CHECK-NEXT: spv.specConstant @foo_1 +// CHECK-NEXT: spv.SpecConstant @foo_1 // CHECK-NEXT: spv.func @bar // CHECK-NEXT: spv.mlir.referenceof @foo_1 // CHECK-NEXT: spv.ReturnValue @@ -409,7 +409,7 @@ module { spv.module Logical GLSL450 { - spv.specConstant @foo = -5 : i32 + spv.SpecConstant @foo = -5 : i32 spv.func @bar() -> i32 "None" { %0 = spv.mlir.referenceof @foo : i32 @@ -434,8 +434,8 @@ // CHECK-NEXT: spv.ReturnValue // CHECK-NEXT: } -// CHECK-NEXT: spv.specConstant @bar -// CHECK-NEXT: spv.specConstantComposite @foo_1 (@bar, @bar) +// CHECK-NEXT: spv.SpecConstant @bar +// CHECK-NEXT: spv.SpecConstantComposite @foo_1 (@bar, @bar) // CHECK-NEXT: } module { @@ -446,8 +446,8 @@ } spv.module Logical GLSL450 { - spv.specConstant @bar = -5 : i32 - spv.specConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> + spv.SpecConstant @bar = -5 : i32 + spv.SpecConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> } } @@ -462,8 +462,8 @@ // CHECK-NEXT: spv.ReturnValue // CHECK-NEXT: } -// CHECK-NEXT: spv.specConstant @bar -// CHECK-NEXT: spv.specConstantComposite @foo_1 (@bar, @bar) +// CHECK-NEXT: spv.SpecConstant @bar +// CHECK-NEXT: spv.SpecConstantComposite @foo_1 (@bar, @bar) // CHECK-NEXT: spv.func @baz // CHECK-NEXT: spv.mlir.referenceof @foo_1 // CHECK-NEXT: spv.CompositeExtract @@ -479,8 +479,8 @@ } spv.module Logical GLSL450 { - spv.specConstant @bar = -5 : i32 - spv.specConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> + spv.SpecConstant @bar = -5 : i32 + spv.SpecConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> spv.func @baz() -> i32 "None" { %0 = spv.mlir.referenceof @foo : !spv.array<2 x i32> @@ -497,8 +497,8 @@ // CHECK: module { // CHECK-NEXT: spv.module Logical GLSL450 { -// CHECK-NEXT: spv.specConstant @bar -// CHECK-NEXT: spv.specConstantComposite @foo_1 (@bar, @bar) +// CHECK-NEXT: spv.SpecConstant @bar +// CHECK-NEXT: spv.SpecConstantComposite @foo_1 (@bar, @bar) // CHECK-NEXT: spv.func @baz // CHECK-NEXT: spv.mlir.referenceof @foo_1 // CHECK-NEXT: spv.CompositeExtract @@ -512,8 +512,8 @@ module { spv.module Logical GLSL450 { - spv.specConstant @bar = -5 : i32 - spv.specConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> + spv.SpecConstant @bar = -5 : i32 + spv.SpecConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> spv.func @baz() -> i32 "None" { %0 = spv.mlir.referenceof @foo : !spv.array<2 x i32> @@ -536,8 +536,8 @@ // CHECK: module { // CHECK-NEXT: spv.module Logical GLSL450 { -// CHECK-NEXT: spv.specConstant @bar_1 -// CHECK-NEXT: spv.specConstantComposite @foo_2 (@bar_1, @bar_1) +// CHECK-NEXT: spv.SpecConstant @bar_1 +// CHECK-NEXT: spv.SpecConstantComposite @foo_2 (@bar_1, @bar_1) // CHECK-NEXT: spv.func @baz // CHECK-NEXT: spv.mlir.referenceof @foo_2 // CHECK-NEXT: spv.CompositeExtract @@ -555,8 +555,8 @@ module { spv.module Logical GLSL450 { - spv.specConstant @bar = -5 : i32 - spv.specConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> + spv.SpecConstant @bar = -5 : i32 + spv.SpecConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> spv.func @baz() -> i32 "None" { %0 = spv.mlir.referenceof @foo : !spv.array<2 x i32> @@ -624,7 +624,7 @@ // CHECK-NEXT: spv.module Logical GLSL450 { // CHECK-NEXT: spv.globalVariable @foo_1 -// CHECK-NEXT: spv.specConstant @foo +// CHECK-NEXT: spv.SpecConstant @foo // CHECK-NEXT: } module { @@ -633,7 +633,7 @@ } spv.module Logical GLSL450 { - spv.specConstant @foo = -5 : i32 + spv.SpecConstant @foo = -5 : i32 } } @@ -643,14 +643,14 @@ // CHECK: module { // CHECK-NEXT: spv.module Logical GLSL450 { -// CHECK-NEXT: spv.specConstant @foo_1 +// CHECK-NEXT: spv.SpecConstant @foo_1 // CHECK-NEXT: spv.globalVariable @foo // CHECK-NEXT: } module { spv.module Logical GLSL450 { - spv.specConstant @foo = -5 : i32 + spv.SpecConstant @foo = -5 : i32 } spv.module Logical GLSL450 { @@ -666,8 +666,8 @@ // CHECK-NEXT: spv.module Logical GLSL450 { // CHECK-NEXT: spv.globalVariable @foo_1 -// CHECK-NEXT: spv.specConstant @bar -// CHECK-NEXT: spv.specConstantComposite @foo (@bar, @bar) +// CHECK-NEXT: spv.SpecConstant @bar +// CHECK-NEXT: spv.SpecConstantComposite @foo (@bar, @bar) // CHECK-NEXT: } module { @@ -676,8 +676,8 @@ } spv.module Logical GLSL450 { - spv.specConstant @bar = -5 : i32 - spv.specConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> + spv.SpecConstant @bar = -5 : i32 + spv.SpecConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> } } @@ -687,16 +687,16 @@ // CHECK: module { // CHECK-NEXT: spv.module Logical GLSL450 { -// CHECK-NEXT: spv.specConstant @bar -// CHECK-NEXT: spv.specConstantComposite @foo_1 (@bar, @bar) +// CHECK-NEXT: spv.SpecConstant @bar +// CHECK-NEXT: spv.SpecConstantComposite @foo_1 (@bar, @bar) // CHECK-NEXT: spv.globalVariable @foo // CHECK-NEXT: } module { spv.module Logical GLSL450 { - spv.specConstant @bar = -5 : i32 - spv.specConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> + spv.SpecConstant @bar = -5 : i32 + spv.SpecConstantComposite @foo (@bar, @bar) : !spv.array<2 x i32> } spv.module Logical GLSL450 { diff --git a/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/deduplication.mlir b/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/deduplication.mlir --- a/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/deduplication.mlir +++ b/mlir/test/Dialect/SPIRV/Linking/ModuleCombiner/deduplication.mlir @@ -113,7 +113,7 @@ // CHECK: module { // CHECK-NEXT: spv.module Logical GLSL450 { -// CHECK-NEXT: spv.specConstant @foo spec_id(5) +// CHECK-NEXT: spv.SpecConstant @foo spec_id(5) // CHECK-NEXT: spv.func @use_foo() // CHECK-NEXT: %0 = spv.mlir.referenceof @foo @@ -130,7 +130,7 @@ module { spv.module Logical GLSL450 { - spv.specConstant @foo spec_id(5) = 1. : f32 + spv.SpecConstant @foo spec_id(5) = 1. : f32 spv.func @use_foo() -> (f32) "None" { %0 = spv.mlir.referenceof @foo : f32 @@ -139,7 +139,7 @@ } spv.module Logical GLSL450 { - spv.specConstant @bar spec_id(5) = 1. : f32 + spv.SpecConstant @bar spec_id(5) = 1. : f32 spv.func @use_bar() -> (f32) "None" { %0 = spv.mlir.referenceof @bar : f32 @@ -153,7 +153,7 @@ // CHECK: module { // CHECK-NEXT: spv.module Logical GLSL450 { -// CHECK-NEXT: spv.specConstant @bar spec_id(5) +// CHECK-NEXT: spv.SpecConstant @bar spec_id(5) // CHECK-NEXT: spv.func @foo(%arg0: f32) // CHECK-NEXT: spv.ReturnValue @@ -192,7 +192,7 @@ module { spv.module Logical GLSL450 { - spv.specConstant @bar spec_id(5) = 1. : f32 + spv.SpecConstant @bar spec_id(5) = 1. : f32 spv.func @foo(%arg0: f32) -> (f32) "None" { spv.ReturnValue %arg0 : f32 diff --git a/mlir/test/Target/SPIRV/logical-ops.mlir b/mlir/test/Target/SPIRV/logical-ops.mlir --- a/mlir/test/Target/SPIRV/logical-ops.mlir +++ b/mlir/test/Target/SPIRV/logical-ops.mlir @@ -91,7 +91,7 @@ // ----- spv.module Logical GLSL450 requires #spv.vce { - spv.specConstant @condition_scalar = true + spv.SpecConstant @condition_scalar = true spv.func @select() -> () "None" { %0 = spv.constant 4.0 : f32 %1 = spv.constant 5.0 : f32 diff --git a/mlir/test/Target/SPIRV/spec-constant.mlir b/mlir/test/Target/SPIRV/spec-constant.mlir --- a/mlir/test/Target/SPIRV/spec-constant.mlir +++ b/mlir/test/Target/SPIRV/spec-constant.mlir @@ -1,19 +1,19 @@ // RUN: mlir-translate -test-spirv-roundtrip -split-input-file %s | FileCheck %s spv.module Logical GLSL450 requires #spv.vce { - // CHECK: spv.specConstant @sc_true = true - spv.specConstant @sc_true = true - // CHECK: spv.specConstant @sc_false spec_id(1) = false - spv.specConstant @sc_false spec_id(1) = false + // CHECK: spv.SpecConstant @sc_true = true + spv.SpecConstant @sc_true = true + // CHECK: spv.SpecConstant @sc_false spec_id(1) = false + spv.SpecConstant @sc_false spec_id(1) = false - // CHECK: spv.specConstant @sc_int = -5 : i32 - spv.specConstant @sc_int = -5 : i32 + // CHECK: spv.SpecConstant @sc_int = -5 : i32 + spv.SpecConstant @sc_int = -5 : i32 - // CHECK: spv.specConstant @sc_float spec_id(5) = 1.000000e+00 : f32 - spv.specConstant @sc_float spec_id(5) = 1. : f32 + // CHECK: spv.SpecConstant @sc_float spec_id(5) = 1.000000e+00 : f32 + spv.SpecConstant @sc_float spec_id(5) = 1. : f32 - // CHECK: spv.specConstantComposite @scc (@sc_int, @sc_int) : !spv.array<2 x i32> - spv.specConstantComposite @scc (@sc_int, @sc_int) : !spv.array<2 x i32> + // CHECK: spv.SpecConstantComposite @scc (@sc_int, @sc_int) : !spv.array<2 x i32> + spv.SpecConstantComposite @scc (@sc_int, @sc_int) : !spv.array<2 x i32> // CHECK-LABEL: @use spv.func @use() -> (i32) "None" { @@ -50,47 +50,47 @@ spv.module Logical GLSL450 requires #spv.vce { - spv.specConstant @sc_f32_1 = 1.5 : f32 - spv.specConstant @sc_f32_2 = 2.5 : f32 - spv.specConstant @sc_f32_3 = 3.5 : f32 + spv.SpecConstant @sc_f32_1 = 1.5 : f32 + spv.SpecConstant @sc_f32_2 = 2.5 : f32 + spv.SpecConstant @sc_f32_3 = 3.5 : f32 - spv.specConstant @sc_i32_1 = 1 : i32 + spv.SpecConstant @sc_i32_1 = 1 : i32 - // CHECK: spv.specConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spv.array<3 x f32> - spv.specConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spv.array<3 x f32> + // CHECK: spv.SpecConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spv.array<3 x f32> + spv.SpecConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spv.array<3 x f32> - // CHECK: spv.specConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spv.struct<(i32, f32, f32)> - spv.specConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spv.struct<(i32, f32, f32)> + // CHECK: spv.SpecConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spv.struct<(i32, f32, f32)> + spv.SpecConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spv.struct<(i32, f32, f32)> - // CHECK: spv.specConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3xf32> - spv.specConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3 x f32> + // CHECK: spv.SpecConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3xf32> + spv.SpecConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3 x f32> } // ----- spv.module Logical GLSL450 requires #spv.vce { - spv.specConstant @sc_f32_1 = 1.5 : f32 - spv.specConstant @sc_f32_2 = 2.5 : f32 - spv.specConstant @sc_f32_3 = 3.5 : f32 + spv.SpecConstant @sc_f32_1 = 1.5 : f32 + spv.SpecConstant @sc_f32_2 = 2.5 : f32 + spv.SpecConstant @sc_f32_3 = 3.5 : f32 - spv.specConstant @sc_i32_1 = 1 : i32 + spv.SpecConstant @sc_i32_1 = 1 : i32 - // CHECK: spv.specConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spv.array<3 x f32> - spv.specConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spv.array<3 x f32> + // CHECK: spv.SpecConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spv.array<3 x f32> + spv.SpecConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spv.array<3 x f32> - // CHECK: spv.specConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spv.struct<(i32, f32, f32)> - spv.specConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spv.struct<(i32, f32, f32)> + // CHECK: spv.SpecConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spv.struct<(i32, f32, f32)> + spv.SpecConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spv.struct<(i32, f32, f32)> - // CHECK: spv.specConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3xf32> - spv.specConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3 x f32> + // CHECK: spv.SpecConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3xf32> + spv.SpecConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3 x f32> } // ----- spv.module Logical GLSL450 requires #spv.vce { - spv.specConstant @sc_i32_1 = 1 : i32 + spv.SpecConstant @sc_i32_1 = 1 : i32 spv.func @use_composite() -> (i32) "None" { // CHECK: [[USE1:%.*]] = spv.mlir.referenceof @sc_i32_1 : i32