[Mlir-commits] [mlir] [mlir][OpPrintingFlags] Allow to disable ElementsAttr hex printing (PR #85766)

Andrei Golubev llvmlistbot at llvm.org
Wed Mar 20 04:51:11 PDT 2024


================
@@ -1199,6 +1212,10 @@ class OpPrintingFlags {
   /// Elide printing large resources based on size of string.
   std::optional<uint64_t> resourceStringCharLimit;
 
+  /// Print large element attributes with hex strings if the number of elements
+  /// is larger than the upper limit.
+  int64_t elementsAttrHexElementLimit = 100;
----------------
andrey-golubev wrote:

i'm in doubts whether this should be aligned to the rest of the int values (so, becoming `std::optional<>`). the difference is that e.g. element attr elision is "off" by default so `std::nullopt` is its natural state; but hex printing is **"on"** by default, and then it must be explicitly disabled (at least current behavior is like that and I'm not sure I should change it) - to do this, an explicit `-1` has to be provided, so both `std::nullopt` and `-1` would encode "disabled" state which seems too much for me.

otoh, I can hide the `std::optional<>` handling purely inside the functions so it's not too exposed "outside".

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


More information about the Mlir-commits mailing list