Commit 41be0bdc9 for llama.cpp

commit 41be0bdc985fcfb42a647998362734a08969d0a4
Author: Keyu Zhu <inuebisu@outlook.com>
Date:   Thu Oct 29 16:12:42 2026 +0800

    common: select A100 cores for SpaceMiT default threads (#30284)

    * common: select A100 cores for SpaceMiT default threads

    # Conflicts:
    #       tests/CMakeLists.txt

    * ggml: export SpaceMiT build marker

    * common: scope SpacemiT thread detection macro to llama-common

    * common: detect A100 cores in all Linux RISC-V builds

    * tests: link barrier test against llama-common

    * tests: drop SpacemiT default thread test

    * common: follow platform check order

diff --git a/common/common.cpp b/common/common.cpp
index edd829d56..de140a211 100644
--- a/common/common.cpp
+++ b/common/common.cpp
@@ -219,6 +219,23 @@ int32_t common_cpu_get_num_math() {
             }
         }
     }
+#elif defined(__riscv) && defined(__linux__)
+    std::ifstream cpuinfo("/proc/cpuinfo");
+    std::string line;
+    int32_t n_a100 = 0;
+    while (std::getline(cpuinfo, line)) {
+        std::istringstream fields(line);
+        std::string key;
+        std::string separator;
+        uint64_t marchid;
+        if (fields >> key >> separator >> std::hex >> marchid &&
+            key == "marchid" && separator == ":" && marchid == UINT64_C(0x8000000041000002)) {
+            ++n_a100;
+        }
+    }
+    if (n_a100 > 0) {
+        return n_a100;
+    }
 #elif defined(__powerpc64__) || defined(__powerpc__)
     int32_t smt_factor = 1;
     int phy_cpus = common_cpu_get_num_physical_cores();