gemini-code-assist[bot] commented on code in PR #19597:
URL: https://github.com/apache/tvm/pull/19597#discussion_r3294876954
##########
src/tirx/script/printer/expr.cc:
##########
@@ -258,6 +258,20 @@ TVM_STATIC_IR_FUNCTOR(IRDocsifier, vtable)
TVM_STATIC_IR_FUNCTOR(IRDocsifier, vtable)
.set_dispatch<tirx::Call>("", [](tirx::Call call, AccessPath call_p,
IRDocsifier d) -> Doc {
+ if (!call->annotations.empty()) {
+ ffi::Array<ExprDoc> call_args;
+ int n_args = call->args.size();
+ call_args.reserve(n_args);
+ for (int i = 0; i < n_args; ++i) {
+ call_args.push_back(d->AsDoc<ExprDoc>(call->args[i],
call_p->Attr("args")->ArrayItem(i)));
+ }
+ ExprDoc op_doc = call->op.as<Op>()
+ ?
LiteralDoc::Str(call->op.as<Op>().value()->name, call_p->Attr("op"))
+ : d->AsDoc<ExprDoc>(call->op, call_p->Attr("op"));
+ return TIR(d, "Call")->Call(
+ {LiteralDoc::DataType(call->dtype, call_p->Attr("dtype")), op_doc,
ListDoc(call_args)},
+ {"annotations"}, {d->AsDoc<DictDoc>(call->annotations,
call_p->Attr("annotations"))});
+ }
Review Comment:

The current implementation of the `tirx::Call` printer logic for annotated
calls bypasses the specialized intrinsic sugar (e.g., `T.exp(x)`) and always
uses the generic `T.Call` form. While this is correct for round-trip stability,
it results in less readable script when annotations are present on common
intrinsics. Consider if the specialized printer logic below could be extended
to accept an optional `annotations` keyword argument to preserve the sugared
form.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]