Skip to content

Conversation

Mogball
Copy link
Contributor

@Mogball Mogball commented Jul 3, 2024

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

The key was being dropped for external resources because they aren't
present in the dialect resource name mapper.
@Mogball Mogball requested review from joker-eph and jpienaar July 3, 2024 22:30
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Jul 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 3, 2024

@llvm/pr-subscribers-mlir-core

@llvm/pr-subscribers-mlir

Author: Jeff Niu (Mogball)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/97650.diff

2 Files Affected:

  • (modified) mlir/lib/Bytecode/Reader/BytecodeReader.cpp (+1-1)
  • (added) mlir/test/Bytecode/external_resources.mlir (+19)
diff --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index dd1e4abaea166..5b34ba5a65ff8 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -707,7 +707,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 0000000000000..722c108f687e2
--- /dev/null
+++ b/mlir/test/Bytecode/external_resources.mlir
@@ -0,0 +1,19 @@
+// RUN: mlir-opt %s -emit-bytecode | mlir-opt
+
+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
+    }
+  }
+#-}

Copy link
Member

@jpienaar jpienaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Mogball Mogball merged commit af7ee51 into llvm:main Jul 3, 2024
kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
The key was being dropped for external resources because they aren't
present in the dialect resource name mapper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mlir:core MLIR Core Infrastructure mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants