[MACA] Improve target-aware compilation, SDK integration, and Relax coverage - #41
[MACA] Improve target-aware compilation, SDK integration, and Relax coverage#41Zhao-Shi-jie wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors and improves MACA support in TVM. Key changes include replacing CMake-time submodule mutation with explicit source-level checks, adding MACA architecture normalization and compute version parsing, restricting WMMA support in meta-schedule space generation to MACA targets that explicitly support it (e.g., xcore1000), and adding placeholder Relax entry points for MACA external libraries. One piece of feedback suggests removing a redundant function redefinition in python/tvm/contrib/mxcc.py to simplify the code and preserve the original docstring.
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.
| from tvm.support import mxcc as _mxcc | ||
| from tvm.support.mxcc import * # pylint: disable=wildcard-import,unused-wildcard-import | ||
|
|
||
|
|
||
| def get_maca_arch(maca_path="/opt/maca"): | ||
| """Return the MACA architecture using the support module callback.""" | ||
| return _mxcc.get_maca_arch(maca_path) |
There was a problem hiding this comment.
在 python/tvm/contrib/mxcc.py 中重新定义 get_maca_arch 是多余的,因为 from tvm.support.mxcc import * 已经导入并导出了具有完全相同签名和行为的 get_maca_arch。此外,tvm.support.mxcc 中的原始函数包含更详细的 docstring,而这里的重定义会覆盖并丢失这些详细的文档信息。
建议移除多余的 _mxcc 导入和 get_maca_arch 函数重定义,直接使用通配符导入即可简化该文件。
| from tvm.support import mxcc as _mxcc | |
| from tvm.support.mxcc import * # pylint: disable=wildcard-import,unused-wildcard-import | |
| def get_maca_arch(maca_path="/opt/maca"): | |
| """Return the MACA architecture using the support module callback.""" | |
| return _mxcc.get_maca_arch(maca_path) | |
| from tvm.support.mxcc import * # pylint: disable=wildcard-import,unused-wildcard-import |
|
Thanks for your contribution, we have received this PR. Please change title and description to use English. And we will approve to run checks, please fix them first when checks failed. |
mc_dev already contains the upstream fix that explicitly widens GPU multinomial row indices to int64. Add a MACA-specific regression to ensure DispatchSampling preserves int32 input buffers while emitting the required cast. Compile and execute the generated kernel on a MACA device and check the sampled token IDs, covering both Relax dispatch and backend runtime behavior.
This PR improves MACA backend correctness and integration:
Target.mcputomxccand select generic or WMMA MetaSchedule rules by architecture.tvm.contrib.mxcccompatibility entry point.MACA_PATHwhen locating themxcccompiler.Validation:
mxcccompilation, architecture-specific tuning rules, SDK discovery, Target restoration,and Relax sampling execution on a MACA device.