HIPBackend#

class brainevent.HIPBackend[source]#

Compile HIP sources for AMD GPUs (stub — not yet implemented).

To implement HIP support:

  1. Add detect_hip_toolchain() to kernix_toolchain that locates hipcc and the ROCm include directories.

  2. Implement HIP compilation logic in this class using hipcc.

  3. Update load_cuda_inline() (or add load_hip_inline) to select HIPBackend when platform="hip" is requested.

compile_source(source, output_path, build_dir, **kwargs)[source]#

Compile preprocessed source code to a shared library.

Parameters:
  • source (str) – Preprocessed C++/CUDA source (user code + auto-generated FFI wrappers, as produced by preprocess_source()).

  • output_path (str) – Desired path for the output shared library.

  • build_dir (str) – Directory for intermediate build artefacts.

  • extra_cflags (list[str], optional) – Additional compiler flags.

  • extra_ldflags (list[str], optional) – Additional linker flags.

  • extra_include_paths (list[str], optional) – Additional header search paths.

  • verbose (bool) – Print the full compiler command.

  • **kwargs (Any) – Backend-specific keyword arguments (e.g. gpu_arch for CUDA, optimization_level, use_fast_math).

Returns:

Absolute path to the compiled shared library.

Return type:

str

platform_name: str = 'hip'#

Human-readable platform identifier, e.g. "cuda", "cpu", "hip".