Skip to content

Commit f0ef523

Browse files
committed
Addressing code review comments
Signed-off-by: Mohammadreza Ameri Mahabadian <[email protected]>
1 parent c246a1a commit f0ef523

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,9 @@ void mlir::spirv::AddressOfOp::getAsmResultNames(
767767
// spirv.EXTConstantCompositeReplicate
768768
//===----------------------------------------------------------------------===//
769769

770+
// Returns type of attribute. In case of a TypedAttr this will simply return
771+
// the type. But for an ArrayAttr which is untyped and can be multidimensional
772+
// it creates the ArrayType recursively.
770773
static Type getValueType(Attribute attr) {
771774
if (auto typedAttr = dyn_cast<TypedAttr>(attr)) {
772775
return typedAttr.getType();

mlir/test/Target/SPIRV/constant.mlir

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, ReplicatedCompos
363363
spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xi32>
364364
}
365365

366-
// CHECK-LABEL: @array_of_splat_array_of_non_splat_arrays_of_i32
367-
spirv.func @array_of_splat_array_of_non_splat_arrays_of_i32() -> !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32>>> "None" {
366+
// CHECK-LABEL: @splat_array_of_non_splat_array_of_arrays_of_i32
367+
spirv.func @splat_array_of_non_splat_array_of_arrays_of_i32() -> !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32>>> "None" {
368368
// CHECK: spirv.EXT.ConstantCompositeReplicate {{\[}}{{\[}}[1 : i32, 2 : i32, 3 : i32], [4 : i32, 5 : i32, 6 : i32]]] : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32>>>
369369
%0 = spirv.EXT.ConstantCompositeReplicate [[[1 : i32, 2 : i32, 3 : i32], [4 : i32, 5 : i32, 6 : i32]]] : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32>>>
370370
spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32>>>
@@ -419,8 +419,8 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, ReplicatedCompos
419419
spirv.ReturnValue %0 : !spirv.arm.tensor<2x3xf32>
420420
}
421421

422-
// CHECK-LABEL: @array_of_splat_array_of_non_splat_arrays_of_f32
423-
spirv.func @array_of_splat_array_of_non_splat_arrays_of_f32() -> !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x f32>>> "None" {
422+
// CHECK-LABEL: @splat_array_of_non_splat_array_of_arrays_of_f32
423+
spirv.func @splat_array_of_non_splat_array_of_arrays_of_f32() -> !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x f32>>> "None" {
424424
// CHECK: spirv.EXT.ConstantCompositeReplicate {{\[}}{{\[}}[1.000000e+00 : f32, 2.000000e+00 : f32, 3.000000e+00 : f32], [4.000000e+00 : f32, 5.000000e+00 : f32, 6.000000e+00 : f32]]] : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x f32>>>
425425
%0 = spirv.EXT.ConstantCompositeReplicate [[[1.0 : f32, 2.0 : f32, 3.0 : f32], [4.0 : f32, 5.0 : f32, 6.0 : f32]]] : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x f32>>>
426426
spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x f32>>>

0 commit comments

Comments
 (0)