SIGN IN SIGN UP

test/gtest: add AMD GPU support to gtest transfer tests (#1993)

## What?
add AMD GPU support to gtest transfer tests

## Why?
In preparation for full CI support of AMD GPUs

## How?
Mirror the pattern established in test/unit/plugins/ucx (#1787):
introduce a gpu_utils.h abstraction header that wraps gpuMalloc,
gpuFree, gpuSetDevice, and gpuGetDeviceCount behind HAVE_CUDA /
HAVE_ROCM / no-GPU guards, and update test_transfer.cpp to use those
wrappers instead of calling CUDA APIs directly.

The meson.build gains the same ROCm detection tri-state
(-Drocm_path=<prefix>) used by the UCX unit test, so the gtest binary
can be built and run on AMD GPU systems.

Tested and verified on an internal system.

```
./test/gtest/gtest --gtest_filter=ucx*/TestTransfer.*:ucx*/TestTransferTelemetry.*
```
The `ucx_no_pt/TestTransfer.NotificationOnly` occasionally fails, but
that seems unrelated to this particular change.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added ROCm support for running the GPU transfer test suite alongside
CUDA.
* Tests now probe for available GPU devices and automatically select the
appropriate memory path (VRAM vs DRAM).
* Introduced shared GPU utility helpers to standardize device selection
and memory operations across supported backends.
* **Bug Fixes**
* Improved robustness when GPU backends are unavailable or device
queries fail by safely falling back (e.g., treating available GPU count
as zero) to prevent test runs from breaking.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Colin Hirsch <chirsch@nvidia.com>
E
Edgar Gabriel committed
9ed1f01aeab744bbb37b2edd27b1c8b8b39450f0
Parent: 09e8446
Committed by GitHub <noreply@github.com> on 8/1/2026, 8:25:37 PM