Pull requests / #2984

#2984 fix(Mac): 0.1.45 does not compile on Metal (three CUDA-only calls in shared host files)

open · @SuperDistance · 0 Kommentare · Auf GitHub

Server & APIAMD / HIPNVIDIA / CUDALinux

Beschreibung

## Summary

0.1.45's Mac build should stop in two shared host files: three changes in this release call CUDA names that `metal/include/metal_compat/cuda_runtime.h` does not provide. This adds the Metal side of each, the way the code already does it elsewhere. CUDA and HIP are unchanged.

## What changed

| where | came with | fix |
| --- | --- | --- |
| `src/core/verify.cpp`, `make_stream` | #2326 (its last commit, fcf93bde, was not ported; @qiuzan2001 found it) | `&& !defined(STRATA_GPU_METAL)`, as `mtp.cpp` guards the same two calls (default priority) |
| `src/core/verify.cpp`, `device_is_sm75` | #2222 | Metal answers false, as HIP does (no Turing card, no compute capability) |
| `metal/include/metal_compat/cuda_runtime.h` | #2666's peer-copy probe (`peer_experts.cpp`) | `cudaMemcpyPeer` (the peer async copy and a sync; one GPU) and `cudaDeviceDisablePeerAccess` (unsupported, as enabling is), as e6ad6c81 added them to the HIP shim |

## How I checked

There is no Mac here, so I compiled the Mac build's shared host sources the way `metal/CMakeLists.txt` does (`metal/include/metal_compat` and `metal/include` first, `STRATA_GPU_METAL=1`, `STRATA_NATIVE_EXPERTS=1`, C++20), syntax only, with g++ 13 on Linux:

- **0.1.45:** 32 of the 34 files are clean; two fail with these 7 errors:
  ```
  src/core/verify.cpp:285: 'cudaDevAttrComputeCapabilityMajor' was not declared in this scope
  src/core/verify.cpp:286: 'cudaDevAttrComputeCapabilityMinor' was not declared in this scope
  src/core/verify.cpp:859: 'cudaDeviceGetStreamPriorityRange' was not declared in this scope
  src/core/verify.cpp:860: 'cudaStreamCreateWithPriority' was not declared in this scope
  src/core/peer_experts.cpp:72: 'cudaMemcpyPeer' was not declared in this scope
  src/core/peer_experts.cpp:157: 'cudaDeviceDisablePeerAccess' was not declared in this scope
  src/core/peer_experts.cpp:158: 'cudaDeviceDisablePeerAccess' was not declared in this scope
  ```
- **This branch:** all 34 files are clean.
- **CUDA:** the preprocessed `verify.cpp` and `peer_experts.cpp` are identical before and after (CUDA 13.0 headers).
- **HIP:** both changed lines in `verify.cpp` take the branch they took before, and the shim is only on the Metal include path.

Not checked: a real Mac build and link (Apple clang, the metal-cpp side, the Metal kernels in `metal/src/engine`, which this does not touch), and running it.

Mehr auf der Site

Links zu Install, Modellen, Releases.