aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/IR
diff options
context:
space:
mode:
authorMogball <jeff@modular.com>2023-08-23 16:54:18 +0000
committerMogball <jeff@modular.com>2023-08-23 16:54:23 +0000
commit8a779174134d7d01c6835cb0254b8a6dbf419150 (patch)
treebeb40d3f79f9750e3f2f5e6d6fb4504240f96913 /mlir/test/IR
parentebfdbdb73ca8731bb60802eaa84b73c1bc6a9243 (diff)
downloadllvm-8a779174134d7d01c6835cb0254b8a6dbf419150.zip
llvm-8a779174134d7d01c6835cb0254b8a6dbf419150.tar.gz
llvm-8a779174134d7d01c6835cb0254b8a6dbf419150.tar.bz2
[Printing] Add flag to not print resources.
Often times, large weights for ML models will be stored as resources in MLIR. It is sometimes advantageous to control whether to print these resources for debugging purposes. For example, some models contain very big weights with millions of characters in printed size, which may slow down whatever text editor you are using. This diff adds a flag which allows users to disable printing resources in these scenarios. Reviewed By: Mogball Differential Revision: https://reviews.llvm.org/D157928
Diffstat (limited to 'mlir/test/IR')
-rw-r--r--mlir/test/IR/pretty-resources-print.mlir41
1 files changed, 41 insertions, 0 deletions
diff --git a/mlir/test/IR/pretty-resources-print.mlir b/mlir/test/IR/pretty-resources-print.mlir
new file mode 100644
index 0000000..ea6e9f4
--- /dev/null
+++ b/mlir/test/IR/pretty-resources-print.mlir
@@ -0,0 +1,41 @@
+// Check printing with --mlir-elide-resource-strings-if-larger elides printing large resources
+
+// RUN: mlir-opt %s --mlir-elide-resource-strings-if-larger=10| FileCheck %s
+
+// To ensure we print the resource keys, have reference to them
+// CHECK: attr = dense_resource<blob1> : tensor<3xi64>
+"test.blob1op"() {attr = dense_resource<blob1> : tensor<3xi64> } : () -> ()
+
+// CHECK-NEXT: attr = dense_resource<blob2> : tensor<3xi64>
+"test.blob2op"() {attr = dense_resource<blob2> : tensor<3xi64> } : () -> ()
+
+// CHECK: {-#
+// CHECK-NEXT: external_resources: {
+// CHECK-NEXT: external: {
+// CHECK-NEXT: bool: true,
+// CHECK-NEXT: string: "string"
+// CHECK-NEXT: },
+// CHECK-NEXT: other_stuff: {
+// CHECK-NEXT: bool: true
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: #-}
+
+{-#
+ dialect_resources: {
+ builtin: {
+ blob1: "0x08000000010000000000000002000000000000000300000000000000",
+ blob2: "0x08000000040000000000000005000000000000000600000000000000"
+ }
+ },
+ external_resources: {
+ external: {
+ blob: "0x08000000010000000000000002000000000000000300000000000000",
+ bool: true,
+ string: "string"
+ },
+ other_stuff: {
+ bool: true
+ }
+ }
+#-}