[REFACTOR][TIRX] Add IntImm common scalar ctor and streamline MakeConst#19797
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the codebase to use direct IntImm and FloatImm constructors (such as IntImm::Int32, IntImm::Int64, and IntImm::Bool) instead of the generic make_const or make_zero helpers when the data type is statically known to be a scalar. This change improves compilation efficiency and code compactness. The review feedback identifies several remaining instances across the codebase—specifically in loop vectorization, interval set operations, affine map iterations, double buffer injection, and FFI binding—where make_const is still being used for scalar types, and suggests replacing them with direct IntImm calls to complete the refactoring consistently.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
2cc64e5 to
ddfe920
Compare
bdc150c to
7ab7b0a
Compare
Common bool, int32, and int64 scalar constants show up throughout TIRX and related lowering code, and named constructors make these call sites easier to read than repeated DataType spelling. This PR establishes the scalar-constant construction policy and renames make_const to MakeConst to match the public helper naming style. - Prefer IntImm::Bool, IntImm::Int32, and IntImm::Int64 for common known scalar bool, int32, and int64 constants. - Prefer direct IntImm or FloatImm construction when dtype is known to be scalar integer or floating point. This makes the compiled code more compact and efficient. Keep MakeConst for generic overload cases where dtype can be integer, floating point, or vector-valued and the caller needs its scalar/vector dispatch. - Phase out make_zero in favor of explicit scalar constructors, or ConstHandle(0) for null handles.
7ab7b0a to
9958ebe
Compare
|
@tvm-bot rerun |
…st (apache#19797) Common bool, int32, and int64 scalar constants show up throughout TIRX and related lowering code, and named constructors make these call sites easier to read than repeated DataType spelling. This PR establishes the scalar-constant construction policy and renames make_const to MakeConst to match the public helper naming style. - Prefer IntImm::Bool, IntImm::Int32, and IntImm::Int64 for common known scalar bool, int32, and int64 constants. - Prefer direct IntImm or FloatImm construction when dtype is known to be scalar integer or floating point. This makes the compiled code more compact and efficient. Keep MakeConst for generic overload cases where dtype can be integer, floating point, or vector-valued and the caller needs its scalar/vector dispatch. - Phase out make_zero in favor of explicit scalar constructors, or ConstHandle(0) for null handles.
Summary
Common bool, int32, and int64 scalar constants show up throughout TIRX and related lowering code. Named constructors make these call sites easier to read than repeated
DataTypespelling, and avoid routing obvious scalar constants through the genericMakeConsthelper.Usage guideline
Prefer direct
IntImmorFloatImmconstruction when dtype is known to be scalar integer or floating point. This makes the compiled code more compact and efficient. KeepMakeConstfor generic overload cases where dtype can be integer, floating point, or vector-valued and the caller needs its scalar/vector dispatch.This PR establishes the scalar-constant construction policy:
IntImm::Bool,IntImm::Int32, andIntImm::Int64for common known scalar bool, int32, and int64 constants.IntImmorFloatImmconstruction when dtype is known to be scalar integer or floating point.MakeConstfor generic overload cases where dtype can be integer, floating point, or vector-valued and the caller needs its scalar/vector dispatch.make_zeroin favor of explicit scalar constructors, orConstHandle(0)for null handles.Changes
IntImm::Bool,IntImm::Int32, andIntImm::Int64helpers.make_consttoMakeConstand document it as the generic/vector construction helper.MakeConst.make_zero,const_true,const_false, and the unusedtirx.const_trueregistry entry.