This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch tqchen/printer-refinement
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit dcd027c9df9ec68fd3bacd834384534709f8da7a
Author: Tianqi Chen <[email protected]>
AuthorDate: Thu Oct 1 20:41:37 2026 +0000

    Keep float32 attribute constants concise
---
 src/script/printer/ir/misc.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/script/printer/ir/misc.cc b/src/script/printer/ir/misc.cc
index 58427196ea..e89c9341ea 100644
--- a/src/script/printer/ir/misc.cc
+++ b/src/script/printer/ir/misc.cc
@@ -188,6 +188,11 @@ ExprDoc AnyValue(DocTranslatorObj* d, ffi::AnyView value) {
   }
   if (const auto* floating = value.as<FloatImmNode>()) {
     ExprDoc literal = LiteralDoc::Float(floating->value, std::nullopt);
+    if (floating->ty.as_or_throw<PrimType>()->dtype == (DLDataType{kDLFloat, 
32, 1})) {
+      ExprDoc doc = NamespaceDoc("tirx")->Attr("float32")->Call({literal});
+      d->RecordOrigin(doc, ffi::GetRef<FloatImm>(floating));
+      return doc;
+    }
     if (!std::isfinite(floating->value)) {
       // Nonfinite literals render as strings; the scalar helper converts them 
to a number.
       literal = 
NamespaceDoc("tirx")->Attr("float64")->Call({literal})->Attr("value");

Reply via email to