From ff068ffa0ab2136ae96a419f5b87ffc5fdb8b016 Mon Sep 17 00:00:00 2001 From: Zymonody7 <2196905367@qq.com> Date: Wed, 10 Jun 2026 17:43:42 +0800 Subject: [PATCH] [MACA] Fix TargetIsMetaxC500 mcpu check The real check was commented out because macainfo reports the arch in uppercase (XCORE1000) while mxcc defaults to lowercase, so the strict compare never matched and the function degraded to "any maca target with an mcpu attr is C500". Match the xcore1000 prefix case-insensitively instead, so other archs no longer take the C500-specific tuning paths by mistake. --- src/target/utils.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/target/utils.cc b/src/target/utils.cc index 0e35bf9b..70c3412e 100644 --- a/src/target/utils.cc +++ b/src/target/utils.cc @@ -8,6 +8,8 @@ #include "../support/ffi_aliases.h" #include "dlpack/dlpack.h" +#include +#include #include namespace tvm { @@ -94,9 +96,12 @@ bool TargetIsMetaxC500(Target target) { return false; if (target->attrs.count("mcpu")) { std::string mcpu = Downcast(target->attrs.at("mcpu")); - // if mcpu start with "xcore", it is Metax GPU - // return mcpu.find("XCORE1000") == 0; - return true; + // mxcc/macainfo report the C500 architecture as "xcore1000" (macainfo + // prints it uppercase); match the prefix case-insensitively so that + // other architectures are not mistaken for C500. + std::transform(mcpu.begin(), mcpu.end(), mcpu.begin(), + [](unsigned char c) { return std::tolower(c); }); + return mcpu.find("xcore1000") == 0; } return false; } -- Gitee