TECHNOLOGY

HIP feature macros: device compilation does not discover the host’s installed GPU

In this article
THE QUICK TAKE

A compile-time feature guard describes a device compilation target; host dispatch must query the selected runtime device separately.

Diagnose the unexpectedly disabled host branch

A program compiles a specialized kernel but its host selection logic always rejects the fast path. Inspect whether the host used a device feature macro as though it represented installed hardware. Building the executable and running it on a machine are separate stages. The build machine may differ from the deployment machine, and a process may select a different GPU from the one a developer assumed while creating its configuration.

Keep feature macros in their intended compilation pass

The HIP porting guide documents device feature macros and warns against relying on them in host code. Their host values do not discover available GPUs. The device-compilation marker distinguishes the compilation pass; it is not itself a named hardware capability. Use the appropriate feature guard around the device implementation and keep host selection independent from that preprocessing decision.

Query the selected device at runtime

Use the documented device-properties or device-attribute query for the capability actually required by the algorithm. Check query results and retain the selected device identity with the dispatch decision. A feature that exists on another installed GPU does not justify launching that path on the current one. The hardware-feature overview also cautions that capability support does not establish expected performance, so correctness selection and timing remain different questions.

Verify that the executable contains a usable implementation

The Clang HIP documentation describes device compilation and embedded code objects. A positive runtime property cannot create a missing compatible binary implementation. Preserve the relationship between compiled targets, feature guards and the host dispatch table. A fallback must also have a valid implementation for its selected target, rather than merely an accessible host function name that eventually attempts an unsupported device launch.

Test mismatches as separate failure cases

Exercise a disabled feature, an unavailable compiled target and a failed runtime query independently. Record which boundary rejected each case before measuring successful dispatch. The existing HIP launch-portability guide and software reproducibility material give broader context. This approach makes deployment behavior explainable: preprocessing, packaged implementations and selected-device capabilities answer different questions, even when they appear together in the same source file or build configuration.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles