[Mlir-commits] [mlir] af7ee51 - [mlir][bytecode] Fix external resource bytecode parsing (#97650)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jul 3 15:32:48 PDT 2024


Author: Jeff Niu
Date: 2024-07-03T15:32:45-07:00
New Revision: af7ee51a90beeb8198ceac0100c52b102543cf4b

URL: https://github.com/llvm/llvm-project/commit/af7ee51a90beeb8198ceac0100c52b102543cf4b
DIFF: https://github.com/llvm/llvm-project/commit/af7ee51a90beeb8198ceac0100c52b102543cf4b.diff

LOG: [mlir][bytecode] Fix external resource bytecode parsing (#97650)

The key was being dropped for external resources because they aren't
present in the dialect resource name mapper.

Added: 
    mlir/test/Bytecode/external_resources.mlir

Modified: 
    mlir/lib/Bytecode/Reader/BytecodeReader.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index f767740a8d1776..1064896a1f7147 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -706,7 +706,7 @@ LogicalResult ResourceSectionReader::initialize(
     auto resolveKey = [&](StringRef key) -> StringRef {
       auto it = dialectResourceHandleRenamingMap.find(key);
       if (it == dialectResourceHandleRenamingMap.end())
-        return "";
+        return key;
       return it->second;
     };
 

diff  --git a/mlir/test/Bytecode/external_resources.mlir b/mlir/test/Bytecode/external_resources.mlir
new file mode 100644
index 00000000000000..df064d7795338a
--- /dev/null
+++ b/mlir/test/Bytecode/external_resources.mlir
@@ -0,0 +1,19 @@
+// RUN: mlir-opt %s -emit-bytecode | mlir-opt | FileCheck %s
+
+module {
+}
+
+{-#
+  // CHECK: external_resources
+  external_resources: {
+    // CHECK-NEXT: mlir_reproducer
+    mlir_reproducer: {
+      // CHECK-NEXT: pipeline: "builtin.module(func.func(canonicalize,cse))",
+      pipeline: "builtin.module(func.func(canonicalize,cse))",
+      // CHECK-NEXT: disable_threading: true
+      disable_threading: true,
+      // CHECK-NEXT: verify_each: true
+      verify_each: true
+    }
+  }
+#-}


        


More information about the Mlir-commits mailing list