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

   ## What does this PR do?
   
   `ToMixedPrecisionRewriter::VisitVar_` unconditionally calls `NTypeFrom` for 
every remapped variable. A local Relax function is also remapped, but its type 
is `Callable` rather than a nested tensor type, so the pass fails with an 
internal type-check error.
   
   This change restores the original dtype only for remapped nested-tensor 
variables. Other remapped expressions, including local functions, are returned 
unchanged. Returning the remapped expression is important because calls inside 
the dataflow block must continue to reference the rewritten local function 
binding.
   
   A regression test covers a local function defined and called inside a 
dataflow block.
   
   Fixes #20419
   
   ## Testing
   
   - `python -m pytest tests/python/relax/test_transform_to_mixed_precision.py 
-q -k local_function_in_dataflow_block`
   - `python -m pytest tests/python/relax/test_transform_to_mixed_precision.py 
-q -k "not call_tir_with_float16_args"` (`15 passed, 1 deselected`)
   - `python -m pre_commit run --files 
src/relax/transform/to_mixed_precision.cc 
tests/python/relax/test_transform_to_mixed_precision.py`
   - Windows MSVC build with LLVM
   
   The excluded existing test currently fails during TVMScript TIR construction 
on this Windows environment with `TypeError: __ffi_shallow_copy__ must be an 
ffi.Function`, before `ToMixedPrecision` is invoked.


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