[Mlir-commits] [mlir] [mlir][spirv] Fix int type declaration duplication when serializing (PR #143108)

Jakub Kuderski llvmlistbot at llvm.org
Fri Jun 6 08:06:06 PDT 2025


================
@@ -446,6 +446,19 @@ LogicalResult Serializer::processType(Location loc, Type type,
 LogicalResult
 Serializer::processTypeImpl(Location loc, Type type, uint32_t &typeID,
                             SetVector<StringRef> &serializationCtx) {
+
+  // Map unisgned integer types to singless integer types
+  // This is needed otherwise the generated spirv assembly will contain
+  // twice a type declaration (like OpTypeInt 32 0) which is no permitted and
+  // such module could no pass validation. Indeed at MLIR level the two types
+  // are different and lookup in the cache below fails.
+  // Note: This convertion needs to happen here before the type is looked up in
+  // the cache
----------------
kuhar wrote:

```suggestion
  // This is needed otherwise the generated spirv assembly will contain
  // twice a type declaration (like OpTypeInt 32 0) which is no permitted and
  // such module could no pass validation. Indeed at MLIR level the two types
  // are different and lookup in the cache below fails.
  // Note: This conversion needs to happen here before the type is looked up in
  // the cache.
```

https://github.com/llvm/llvm-project/pull/143108


More information about the Mlir-commits mailing list