mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 15:58:53 +00:00
The engine did not build on aarch64: the CPU expert path assumed the x86 AVX kernels, the CPUID probes and the x86 spin/fence intrinsics. After this change the strata target compiles on aarch64 (CUDA host code, native GGUF packs). On x86 nothing is selected differently. What changed: - CMake: STRATA_CPU_X86 is decided from CMAKE_SYSTEM_PROCESSOR (an unset processor stays the x86 build). On aarch64 src/kernels/cpu/portable.cpp stands in for the AVX kernel sources; native experts run on ggml-cpu's NEON dot products. -ffp-contract=off on aarch64. STRATA_ISA_FLOOR is ignored with a warning there. - include/strata/platform/cpu_relax.hpp: strata_cpu_pause / strata_store_fence map to _mm_pause / _mm_sfence on x86 and to yield / dmb oshst on aarch64. verify.cpp, pool.cpp, session.cpp, mtp.cpp and graph.cpp use them. - expert_layout.cpp: the CPUID/XCR0 probes compile on x86 only and report no AVX on other CPUs. - generate.cpp: --cpu-oracle-q8-0 is rejected on a non-x86 CPU. - setup.py: nvidia-smi's "[N/A]" memory on GB10 (unified memory) takes the pool size from /proc/meminfo on ARM64 only; the CPU probe no longer needs the x86 "flags" line; setup warns that the ARM64 engine is compiled on the PC and which packs work. Changes to the contributor's patch, found while moving it onto the 0.2.7 line: - portable.cpp had no iq512x_rows / iq512x_supported / iq512_gather_on (added to the x86 kernels after the PR was written): the aarch64 link would fail. - The Metal build (Apple silicon) shares these files. It keeps its barrier (dmb ishst), its plain router loop (its bf16_rows_dot_multi is a stub), its Metal start-up block in generate.cpp and its "unknown" CPU name. - The CPU side of the GPU doorbell: strata_load_fence() after the spins that wait for a flag the GPU raised (dmb ishld on ARM, nothing on x86 and on Apple silicon), so the data written before the flag is not read early. - A card whose memory nvidia-smi does not report stays unlisted on x86 (the new fallback is for ARM64 only). - tests/terminal/test_setup_arm64.py. Checked: with the x86 CUDA build (sm_86, gcc 13 -O3, z440) the objects of verify, session, mtp, graph, expert_source, pool, expert_layout and generate are byte-identical before and after (the x86 wrappers are macros for the same intrinsics). Every C++ file of the strata target compiles for aarch64 with clang, and the symbols of the CPU kernel library link up (syntax and symbols only: no ARM machine, no ARM run). The Metal-shared files compile for aarch64-macos with STRATA_GPU_METAL. Not covered: no ARM hardware here. The tests that include x86 headers (iq_avx2_parity and the other AVX parity tools) and the DeepSeek target do not build on aarch64; the strata target does not need them. Memory ordering on ARM is reasoned, not run. The Q2_0 and Gyro packs need the x86 kernels.