gemini-code-assist[bot] commented on code in PR #19901:
URL: https://github.com/apache/tvm/pull/19901#discussion_r3488629064
##########
src/relax/transform/remove_unused_parameters.cc:
##########
@@ -100,7 +100,10 @@ std::optional<CalleeAnalysis> AnalyzeCallee(Function func)
{
}
for (const auto& tir_var : free_tir_vars) {
- Var relax_var("param_" + tir_var->name_hint, PrimType(tir_var.ty()));
+ // Promote the free symbolic var via a 1-D shape param so the param
actually
+ // *defines* the var. A PrimType param only carries a dtype and defines no
+ // TIR var, which leaves the var undefined under the strict tirx verifier.
+ Var relax_var("param_" + tir_var->name_hint, ShapeType({tir_var}));
Review Comment:

In TVM Relax, `ShapeType` only represents the type of a shape (carrying only
`ndim`) and does not carry or define symbolic variables. To actually define the
symbolic variable `tir_var` in the parameter, you must use `ShapeStructInfo`
instead of `ShapeType`. Using `ShapeStructInfo` ensures that the parameter's
struct info contains the symbolic variable, which is required by the
well-formedness verifier to recognize it as defined. Note that you may need to
include `<tvm/relax/struct_info.h>` if it is not already transitively included.
```suggestion
Var relax_var("param_" + tir_var->name_hint, ShapeStructInfo({tir_var}));
```
--
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]