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

   This PR fixes `ExpandMatmulOfSum` and `ReorderTakeAfterMatmul` dropping an 
explicitly specified `out_dtype` when constructing replacement `matmul` calls. 
With `float16` operands and `out_dtype="float32"`, the transformed functions 
incorrectly returned `float16`.
   
   The rewrite passes constructed the replacement `matmul` calls with an 
unspecified output dtype. This change forwards the original 
`MatmulAttrs::out_dtype` in:
   
   - Both replacement matmuls created by `ExpandMatmulOfSum`.
   - The simple and batched-weight paths of `ReorderTakeAfterMatmul`.
   
   Structural regression tests cover all three rewrite paths with `float16` 
inputs and an explicit `float32` output dtype.
   
   Tests:
   
   - `cmake --build build --parallel 12`
   - `python -m pytest -p no:rerunfailures 
tests/python/relax/test_transform_expand_matmul_of_sum.py 
tests/python/relax/test_transform_reorder_take_after_matmul.py 
tests/python/relax/test_op_linear_algebra.py -q` — 26 passed
   - `ctest --test-dir build --output-on-failure` — 137/137 passed
   - `pre-commit run --files src/relax/transform/expand_matmul_of_sum.cc 
src/relax/transform/reorder_take_after_matmul.cc 
tests/python/relax/test_transform_expand_matmul_of_sum.py 
tests/python/relax/test_transform_reorder_take_after_matmul.py` — passed
   
   Fixes #20198


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