[Mlir-commits] [mlir] [mlir][bytecode] Fix external resource bytecode parsing (PR #97650)
Jeff Niu
llvmlistbot at llvm.org
Wed Jul 3 15:31:40 PDT 2024
https://github.com/Mogball updated https://github.com/llvm/llvm-project/pull/97650
>From e5d0191770d40338dfe43a4e2c55046487b182e1 Mon Sep 17 00:00:00 2001
From: Mogball <jeff at modular.com>
Date: Wed, 3 Jul 2024 22:28:59 +0000
Subject: [PATCH 1/2] [mlir][bytecode] Fix external resource bytecode parsing
The key was being dropped for external resources because they aren't
present in the dialect resource name mapper.
---
mlir/lib/Bytecode/Reader/BytecodeReader.cpp | 2 +-
mlir/test/Bytecode/external_resources.mlir | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 mlir/test/Bytecode/external_resources.mlir
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
+ }
+ }
+#-}
>From b1ab0491ccab601b7dee5af72d64e7225de53426 Mon Sep 17 00:00:00 2001
From: Mogball <jeff at modular.com>
Date: Wed, 3 Jul 2024 22:31:32 +0000
Subject: [PATCH 2/2] actually filecheck
---
mlir/test/Bytecode/external_resources.mlir | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mlir/test/Bytecode/external_resources.mlir b/mlir/test/Bytecode/external_resources.mlir
index 722c108f687e2..df064d7795338 100644
--- a/mlir/test/Bytecode/external_resources.mlir
+++ b/mlir/test/Bytecode/external_resources.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s -emit-bytecode | mlir-opt
+// RUN: mlir-opt %s -emit-bytecode | mlir-opt | FileCheck %s
module {
}
@@ -8,7 +8,7 @@ module {
external_resources: {
// CHECK-NEXT: mlir_reproducer
mlir_reproducer: {
- // CHECK-NEXT: pipeline: "builtin.module(func.func(canonicalize,cse))"
+ // CHECK-NEXT: pipeline: "builtin.module(func.func(canonicalize,cse))",
pipeline: "builtin.module(func.func(canonicalize,cse))",
// CHECK-NEXT: disable_threading: true
disable_threading: true,
More information about the Mlir-commits
mailing list