tqchen opened a new pull request, #19496:
URL: https://github.com/apache/tvm/pull/19496

   The TIR CSE pass currently lifts wholly-constant expressions like
   `Cast(int32, 1)` or `T.min(1, 2)` into `cse_v` bindings when they
   appear more than once. These expressions are compile-time constants
   that the constant folder collapses anyway, so hoisting them adds
   noise of the form `cse_v = 1` without providing any CSE benefit.
   
   The eligibility predicate `CSEPlanner::IsEligible` already rejects
   bare `IntImm`/`FloatImm`/`StringImm`/`Var` at the top level, but
   compound nodes with registered visitors (`Cast`, `Min`, `Max`,
   arithmetic, `Select`, ...) pass the leaf-only check while still
   being wholly-constant. Extend the predicate with a transitive
   "contains no Var" check using the existing `CheckContains` helper.
   `BufferLoad` is already filtered upstream by `IsForbiddenNode`, so
   "no Var" is sufficient at this point to declare the expression a
   compile-time constant.
   
   Adds two regression tests to
   `tests/python/tirx-transform/test_tir_transform_common_subexpr_elim.py`
   covering `Cast`-of-constant and `Min`-of-constants.


-- 
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]

Reply via email to