完善 MACA 后端适配:CMake 校验、架构传递、contrib 入口与 Relax 外部库入口#41
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. |
11fab38 [FIX][MACA] Avoid configure-time tvm-ffi mutation
将 MACA CMake 配置阶段对
3rdparty/tvm-ffi和 DLPack 的自动写入改为只读校验。启用USE_MACA时会检查kDLMACA/kDLMACAHost是否已经存在,缺失时给出明确错误,避免 configure 阶段污染 submodule,也让第三方源码 patch 的来源更清晰。41fb496 [FIX][MACA] Propagate arch and gate WMMA rules
贯通 MACA target
mcpu到mxcc编译命令,确保生成-offload-arch=xcoreXXXX,并修正xcorecompute version 解析。同时 MetaSchedule 不再对所有 MACA target 无条件使用maca-wmma,而是按显式能力列表选择规则;当前仅xcore1000走 WMMA,xcore700/xcore800走普通 MACA schedule。a1df82a [FIX][MACA] Add mxcc contrib wrapper
新增
tvm.contrib.mxcc兼容入口,复用tvm.support.mxcc的实现,解决from tvm.contrib import mxcc导入失败的问题。这样下游代码和 contrib 风格测试可以继续使用统一的 contrib 路径。b11271b [FIX][MACA] Add Relax contrib entrypoint
新增 Relax MACA 外部库 offload 的稳定入口
tvm.relax.backend.contrib.maca,提供supported_libraries()、is_available()和partition_for_maca()。在 mcBLAS/mcDNN/mcFFT codegen 与 runtime 尚未接入前,接口会明确返回不可用或抛出NotImplementedError,避免模块缺失或隐式失败。