Namespace hierarchy in libhipcxx

Namespace hierarchy in libhipcxx#

2026-10-01

3 min read time

Applies to Linux and Windows

libhipcxx organizes its APIs into three tiers, each reflecting where code can run and how closely it conforms to the C++ Standard. Understanding this hierarchy tells you which header to include and which namespace to use for any given facility.

Namespace

Include path

Where it runs

std::

<*>

__host__ only. Your host compiler’s Standard Library. libhipcxx does not replace or interfere with it.

cuda::std:: / hip::std::

<cuda/std/*> / <hip/std/*>

__host__ and __device__. Conforming implementations of Standard Library facilities.

cuda:: / hip::

<cuda/*> / <hip/*>

__host__ and __device__. Extensions to the Standard Library with GPU-specific semantics.

cuda::device:: / hip::device::

<cuda/warp>, <cuda/work_stealing> (and their hip/ equivalents)

__device__ only. Extensions that rely on GPU-only hardware features such as warp intrinsics.

The cuda:: and hip:: prefixes, and their include path equivalents, are interchangeable aliases that resolve to the same headers. Use whichever fits your project’s conventions.

The following example shows all three libhipcxx tiers side by side:

// Standard C++, __host__ only.
#include <atomic>
std::atomic<int> x;

// HIP C++, __host__ __device__.
// Strictly conforming to the C++ Standard.
#include <cuda/std/atomic>
cuda::std::atomic<int> x;

// HIP C++, __host__ __device__.
// Conforming extensions to the C++ Standard.
#include <cuda/atomic>
cuda::atomic<int, cuda::thread_scope_block> x;