Pull requests / #3551

#3551 [Engine] add an opt-in CUDA and HIP hybrid build

open · @sakuumomo · 0 commentaires · Sur GitHub

Setup & installAMD / HIPNVIDIA / CUDASecurityWindowsLinux

Description

Problem and result: One process could not use an NVIDIA GPU and an AMD GPU together. `STRATA_HYBRID` stays off. Turning it on keeps the CUDA host path and compiles the shared kernels again for HIP. Ordinals past the CUDA devices are HIP. The build is Linux x86-64 only. A CUDA-only build and a HIP-only build leave this path out.

A HIP device is named by its architecture, with compute capability left at 0 so it is not read as an NVIDIA architecture. Helpers are every other visible GPU. When hipBLASLt or rocBLAS is present, the HIP copies get the same switches as a pure HIP build, and the HIP prompt kernels use their own device table. When the current device is AMD, startup matches a pure HIP build: the probe accepts a non-gfx11 host, mapped expert fills go through one pinned buffer, the helper busy-waits for its stream, `--vram-elastic` stays off, and the tail skip, PCIe share, architecture defaults, gfx12 chunk, and pipeline windows follow that card. A HIP primary does not probe the canonical PCIe pack or say that the share will change.

Related discussion: no earlier issue agrees this scope.

Approach: The new files compile only with `STRATA_HYBRID`. Default builds keep their previous sources and flags. gfx906 is refused at configure. If CMake leaves a configuration's HIP flags empty, the init flags are written back. Two `SHELL:-include` generator expressions force-include the HIP headers, so CMake does not drop a repeated `-include`.

```text
STRATA_HYBRID=OFF (default)
  CUDA build, or HIP build, or SYCL build, as before

STRATA_HYBRID=ON (Linux x86-64)
  CUDA host path
  shared kernels compiled again for HIP
  ordinals past the CUDA devices are HIP
```

Validation:
  Passed: four compiles of `10fdcb31` on Linux x86-64. `STRATA_BUILD_TESTS=OFF` and `STRATA_PORTABLE=ON` on the Nix builds.
    HIP, `STRATA_HYBRID` off: `STRATA_ENABLE_HIP=ON`, `STRATA_ENABLE_CUDA=OFF`, `CMAKE_HIP_ARCHITECTURES=gfx1030`, `STRATA_PREFILL_MMQ=ON`, HIP 7.2.3. CMake reported "Strata: HIP enabled, arch gfx1030" and did not report a hybrid build. Output `/nix/store/087zqcrh6grkxlkqlmk5hfjm62flfaz5-strata-hip-0.2.1` (`strata` and `strata-device`). The compiler printed warnings while compiling for gfx1030. The link finished.
    CUDA, `STRATA_HYBRID` off: `STRATA_ENABLE_CUDA=ON`, `STRATA_ENABLE_HIP=OFF`, `CMAKE_CUDA_ARCHITECTURES=89-real`, `STRATA_PREFILL_MMQ=OFF`, CUDA 12.9.86, gcc 14.4.0. CMake reported "Strata: CUDA enabled, arch 89-real" and did not report a hybrid build. Output `/nix/store/3y0dc0nzihb4plvl8iaj087vw2b4clxm-strata-cuda-0.2.1` (`strata` and `strata-device`).
    `STRATA_HYBRID=ON`: the same CUDA flags, plus HIP gfx1150. CMake reported CUDA arch 89-real and "Strata hybrid: gfx1150". The log shows CUDA objects and HIP objects (`strata_hip_objs`, compiled for gfx1150) in one build. Output `/nix/store/h0v2fqhpi910zfx8c148gl828aw12y81-strata-hybrid-0.2.1` (`strata` and `strata-device`). The compiler printed warnings while compiling for gfx1150. The link finished.
    SYCL: the `strata-sycl-dev` image from `sycl/tools/Dockerfile` (oneAPI 2026.1.0, no AOT device). `sycl/tools/build.sh strata` printed `BUILD EXIT 0` and `errors: 0`. Binary `/tmp/strata-wt-hybrid/build-sycl/strata`.
    The author ran it on two Linux machines and reports that both function as intended. The laptop has an RTX 4060 and a Radeon 890M and serves with `STRATA_HYBRID`. The desktop has an RX 6800 and an RX 6900 XT and serves with the HIP build, so `STRATA_HYBRID` stays off there. No command log or timing was attached to that report.
  Failed: none observed.
  Not run: a SYCL process on a device. A saved log of the laptop startup.

Limits: Linux x86-64 only. A HIP primary refuses `--vram-elastic`. `prime_hw_queues` stays on the `STRATA_USE_HIP` path. Data-type enums are not remapped between the two runtimes. The first host call on an AMD-only process can still enter the CUDA copy before a trampoline is installed. Compute capability 0 sends host code that branches on compute capability down the portable path while a HIP device is current.

Sur le site

Liens install, modèles, releases.