Skip to content

Commit b09206d

Browse files
authored
[mlir][spirv] Include SPIRV_AnyImage in SPIRV_Type (llvm#143676)
This change is trigger by encountering the following error: ``` <unknown>:0: error: 'spirv.Load' op result #0 must be void or bool or 8/16/32/64-bit integer or 16/32/64-bit float or vector of bool or 8/16/32/64-bit integer or 16/32/64-bit float values of length 2/3/4/8/16 or any SPIR-V pointer type or any SPIR-V array type or any SPIR-V run time array type or any SPIR-V struct type or any SPIR-V cooperative matrix type or any SPIR-V matrix type or any SPIR-V sampled image type, but got '!spirv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Rgba8>'<unknown>:0: note: see current operation: %126 = "spirv.Load"(%125) {relaxed_precision} : (!spirv.ptr<!spirv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Rgba8>, UniformConstant>) -> !spirv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Rgba8> ```
1 parent b512077 commit b09206d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4196,7 +4196,8 @@ def SPIRV_Composite :
41964196
def SPIRV_Type : AnyTypeOf<[
41974197
SPIRV_Void, SPIRV_Bool, SPIRV_Integer, SPIRV_Float, SPIRV_Vector,
41984198
SPIRV_AnyPtr, SPIRV_AnyArray, SPIRV_AnyRTArray, SPIRV_AnyStruct,
4199-
SPIRV_AnyCooperativeMatrix, SPIRV_AnyMatrix, SPIRV_AnySampledImage
4199+
SPIRV_AnyCooperativeMatrix, SPIRV_AnyMatrix, SPIRV_AnySampledImage,
4200+
SPIRV_AnyImage
42004201
]>;
42014202

42024203
def SPIRV_SignedInt : SignedIntOfWidths<[8, 16, 32, 64]>;

mlir/test/Dialect/SPIRV/IR/memory-ops.mlir

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,16 @@ spirv.module Logical GLSL450 {
356356

357357
// -----
358358

359+
// CHECK-LABEL: @image_load
360+
func.func @image_load() -> () {
361+
%0 = spirv.Variable : !spirv.ptr<!spirv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Rgba8>, Function>
362+
// CHECK: spirv.Load "Function" %{{.*}} : !spirv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Rgba8>
363+
%1 = spirv.Load "Function" %0 : !spirv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NoSampler, Rgba8>
364+
return
365+
}
366+
367+
// -----
368+
359369
//===----------------------------------------------------------------------===//
360370
// spirv.StoreOp
361371
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)