[Relax] Clean up deprecated void-dtype sentinel usage#19908
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors void data type checks in the ones and zeros operators and simplifies boolean type matching in IsBoolType. The reviewer suggested optimizing the void checks in ones and zeros by using DataType(dtype).is_void() instead of PrimType(dtype).IsVoid(), which avoids unnecessary heap allocation and reference counting overhead.
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.
| Expr ones(Expr shape, DLDataType dtype) { | ||
| TVM_FFI_ICHECK((dtype != DLDataType{kDLOpaqueHandle, 0, 0})) | ||
| << "Ones op expects the input dtype not to be void"; | ||
| TVM_FFI_ICHECK(!PrimType(dtype).IsVoid()) << "Ones op expects the input dtype not to be void"; |
There was a problem hiding this comment.
we can simply drop is void check here for now
| Expr zeros(Expr shape, DLDataType dtype) { | ||
| TVM_FFI_ICHECK((dtype != DLDataType{kDLOpaqueHandle, 0, 0})) | ||
| << "Zeros op expects the input dtype not to be void"; | ||
| TVM_FFI_ICHECK(!PrimType(dtype).IsVoid()) << "Zeros op expects the input dtype not to be void"; |
There was a problem hiding this comment.
we can simply drop is voidcheck hre for now
Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
d3f925e to
7a58808
Compare
Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
7a58808 to
a0a266b
Compare
Why
After #19890 moved Relax dtype to optional, two spots still used the deprecated
DLDataType{kDLOpaqueHandle, 0, 0}void sentinel.How