llvm-c166/offload/languages
Sophia Herrmann 3e89967179
[Offload][Lang] Add StreamCreateWithFlags (#218048)
This PR adds the cuda/hip function `StreamCreateWithFlags` which takes
either `StreamDefault` or `StreamNonBlocking` to create
blocking/non-blocking stream respectively. It also removes the enum
names from values that are defined by macros in vendor libraries, in
order to not expose unnecessary types.

Assisted by GPT-5.5, checked and reviewed manually

Reopened due to a force-push mistake that made GitHub mark this PR as
merged prematurely.
2026-08-27 16:30:19 -07:00
..
cuda
hip [Offload] generate LLVMOffloadKernel library (#211694) 2026-08-11 08:34:17 -07:00
include [Offload][Lang] Add StreamCreateWithFlags (#218048) 2026-08-27 16:30:19 -07:00
kernel [Offload][Lang] Add StreamCreateWithFlags (#218048) 2026-08-27 16:30:19 -07:00
CMakeLists.txt
README.md [LLVMOffload] Add more error types + GetLastError/PeekAtLastError (#213389) 2026-08-14 10:37:57 -07:00

Offload Language Runtimes

This directory contains the CUDA and HIP runtime layer for LLVM offload. It builds one shared library, LLVMOffloadKernel.

The installed language headers are the user-facing part of this directory. CUDA programs include the CUDA header, HIP programs include the HIP header, and both see normal language names such as cudaMalloc or hipMalloc.

Clang also depends on a small set of runtime entry points for kernel launch and device image registration. These symbols are external because generated host code calls them, but they are for compiler-generated code rather than for users to call directly.

The rest of the runtime is internal. This includes device lookup, queues, registered programs, registered kernels, error conversion, and per-thread last-error storage.

Some source files are shared by CUDA and HIP. CMake compiles those files once with LANGUAGE=cuda and once with LANGUAGE=hip. The language-name includes rename the generic declarations and definitions to the CUDA or HIP spelling for that object file.

Source files that do not depend on CUDA or HIP spelling are compiled once and shared by both languages.

The cuda/ and hip/ directories are kept in case there is ever a need for language-specific behavior. For now, the minimal differences between cuda and hip are taken care of in cuda/hip_runtime.h after the generic parts are included.