Skip to content

[tests] Generalize alpaka tests over backends and implement the hip build - #55

Draft
harz05 wants to merge 1 commit into
ML4EP:gpu/alpakafrom
harz05:test/alpaka-tests-multi-backend
Draft

[tests] Generalize alpaka tests over backends and implement the hip build#55
harz05 wants to merge 1 commit into
ML4EP:gpu/alpakafrom
harz05:test/alpaka-tests-multi-backend

Conversation

@harz05

@harz05 harz05 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

The alpaka tests were hardcoded for the CUDA backend even though the generated code and the CMake ALPAKA_BACKEND option are already backend-agnostic. This PR makes the test sources compile for any alpaka backend and also wires the hip build.

Changes

  • test/alpaka/TestAlpakaCommon.h: the accelerator tag (TestTag) is now picked from the ALPAKA_ACC_GPU_*_ENABLED macro the build defines, and the fixture types (TestAcc, TestDev, TestQueue) derive from it via alpaka::TagToAcc. Removed the cuda_runtime.h include and an unused nvml.h include.
  • Test bodies: Session<alpaka::TagGpuCudaRt> becomes Session<TestTag>, and cudaDeviceSynchronize() becomes alpaka::wait(device). The device-wide wait is kept rather than removed because the generated Session owns its own queue, so waiting on the test queue alone is not enough.
  • test/CMakeLists.txt: the source list and target definition are shared across backends, with only the toolchain, flags and libraries selected per backend. ALPAKA_BACKEND=hip now builds a TestCustomModelsFromONNXForAlpakaHip target (LANGUAGE HIP, links hipblaslt hipblas amdhip64) instead of failing with "not implemented". The cuda build is unchanged: same target name, flags and libraries as before.
  • Fixed the backend validation, which compared the input against itself, so any lowercase value passed and valid uppercase spellings were rejected. It now checks against the list of known backends.

Test names are unchanged, so existing CI and logs stay comparable. The cpu and sycl stubs are left as they were.

Testing

  • CUDA on H100
  • HIP on MI100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant