FZGPUModules 2.0
GPU-accelerated modular compression pipelines
Loading...
Searching...
No Matches
api.h File Reference

Backend-neutral spelling of the host-side GPU runtime API. More...

#include <cuda_runtime.h>

Go to the source code of this file.

Detailed Description

Backend-neutral spelling of the host-side GPU runtime API.

Phase 0 abstracted the GPU handle types (fz::stream_t and friends, see backend/types.h) but left the ~380 host-side runtime calls spelled with their CUDA names (cudaMalloc, cudaMemcpyAsync, cudaMemPoolCreate, cudaGraphLaunch, ...). HIP is deliberately source-compatible with the CUDA runtime — its whole design premise is that hipify is a textual cudahip rename — so rather than churn every call site, this header re-points the CUDA spellings at their HIP equivalents when the HIP backend is selected.

Under the CUDA backend this header expands to nothing at all: no macros are defined, the real CUDA runtime declarations are used unchanged, and the CUDA build is bit-for-bit unaffected.

Of the 95 distinct CUDA identifiers used across the non-vendored tree, 90 differ only by the cudahip prefix; the five genuine naming divergences are listed explicitly in the "hand-mapped" section below. Anything not covered here simply fails to compile under HIP with an undeclared-identifier error, which is the desired behaviour — a silent fallback would be worse.

Include this (rather than <cuda_runtime.h>) from any file that calls the GPU runtime directly. backend/types.h includes it, so most files pick it up transitively via cuda_check.h / mem/mempool.h / stage/stage.h.

Deliberately depends on no other project header — it sits at the bottom of the include graph so that the macros below are always established before any call site is parsed.