From fb880a763f20e037bafbe6519022241c6508f85f Mon Sep 17 00:00:00 2001 From: PGZXB <420254146@qq.com> Date: Sun, 13 Mar 2022 11:17:46 +0800 Subject: [PATCH] Make result of irpass::print hold more information --- taichi/ir/frontend_ir.h | 7 ++++++- taichi/transforms/ir_printer.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/taichi/ir/frontend_ir.h b/taichi/ir/frontend_ir.h index 18eb2ad97df9b..a0c785514778a 100644 --- a/taichi/ir/frontend_ir.h +++ b/taichi/ir/frontend_ir.h @@ -446,7 +446,8 @@ class ExternalTensorExpression : public Expression { } void serialize(std::ostream &ss) override { - ss << fmt::format("{}d_ext_arr", dim); + ss << fmt::format("{}d_ext_arr (element_dim={}, dt={})", dim, element_dim, + dt->to_string()); } void flatten(FlattenContext *ctx) override; @@ -487,6 +488,10 @@ class GlobalVariableExpression : public Expression { void serialize(std::ostream &ss) override { ss << "#" << ident.name(); + if (snode) + ss << fmt::format(" (snode={})", snode->get_node_type_name_hinted()); + else + ss << fmt::format(" (dt={})", dt->to_string()); } void flatten(FlattenContext *ctx) override; diff --git a/taichi/transforms/ir_printer.cpp b/taichi/transforms/ir_printer.cpp index 8039981f328f1..192e115029047 100644 --- a/taichi/transforms/ir_printer.cpp +++ b/taichi/transforms/ir_printer.cpp @@ -117,7 +117,7 @@ class IRPrinter : public IRVisitor { } void visit(FrontendAssertStmt *assert) override { - print("{} : assert {}", assert->id, assert->cond.serialize()); + print("{} : assert {}", assert->name(), assert->cond.serialize()); } void visit(AssertStmt *assert) override {