mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-06 08:18:54 +00:00
MAC-PLAN Phase 1, compat design (the alternative to renaming the host calls, f-mac-design S1-S4). metal/include/metal_compat goes first on the Metal build's include path, as include/strata/hip_compat does on HIP: its cuda_runtime.h gives the ~70 CUDA runtime names of the Phase 1 inventory (types, constants, calls) on Metal, each forwarding to metal/src/gpu/runtime.cpp (metal-cpp: gpuAddress device pointers in one residency set, streams = queue + command buffer + shared-event timeline, graphs = recorded dispatch lists), and immintrin.h gives _mm_pause / _mm_sfence on arm64. The CUDA / HIP / SYCL builds never see metal/. Shared files: four preprocessor conditions also exclude STRATA_GPU_METAL from CUDA-only blocks (the cuMem* segmented expert cache, the STRATA_VERIFY_NODES graph listing, the MTP stream priority, cudaInitDevice of the remote experts); nothing else in src/ changes, so the PC objects are byte-identical. On the M5 Max: runtime_hello passes with the unchanged src/core/graph.cpp, and graph, expert_cache, weights, native_head, native_dense, layer, verify, mtp and session compile for Metal as they are (-fsyntax-only); prefill, expert_source and generate stop only at macOS platform items (std::max of size_t vs uint64_t, posix_fadvise / _SC_AVPHYS_PAGES, sys/sysmacros.h).