[Mlir-commits] [mlir] [mlir][spirv] Add definition for ImageWriteOp (PR #124124)
Jakub Kuderski
llvmlistbot at llvm.org
Wed Feb 5 18:11:13 PST 2025
================
@@ -2042,6 +2042,46 @@ LogicalResult spirv::ImageDrefGatherOp::verify() {
return verifyImageOperands(*this, attr, operandArguments);
}
+//===----------------------------------------------------------------------===//
+// spirv.ImageWriteOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult spirv::ImageWriteOp::verify() {
+ ImageType imageType = llvm::cast<ImageType>(getImage().getType());
+ Type sampledType = imageType.getElementType();
+ ImageSamplerUseInfo samplerInfo = imageType.getSamplerUseInfo();
+
+ if (samplerInfo != spirv::ImageSamplerUseInfo::SamplerUnknown &&
+ samplerInfo != spirv::ImageSamplerUseInfo::NoSampler) {
+ return emitOpError(
+ "the sampled operand of the underlying image must be 0 or 2");
+ }
+
+ // TODO: Do we need check for: "If the Arrayed operand is 1, then additional
+ // capabilities may be required; e.g., ImageCubeArray, or ImageMSArray.".
+
+ if (imageType.getDim() == spirv::Dim::SubpassData) {
+ return emitOpError(
+ "the Dim operand of the underlying image must not be SubpassData");
+ }
+
+ Type texelType = getElementTypeOrSelf(getTexel());
+ if (!llvm::isa<NoneType>(sampledType) && texelType != sampledType) {
----------------
kuhar wrote:
```suggestion
if (!:isa<NoneType>(sampledType) && texelType != sampledType) {
```
https://github.com/llvm/llvm-project/pull/124124
More information about the Mlir-commits
mailing list