llvm-c166/offload/languages/kernel/include/LanguageLaunch.h
Sophia Herrmann 4411918828
[Offload][Driver] Split frontend CUDA/HIP language assumptions from backend device (#212373)
CUDA and HIP offloading currently assumes that the source language also
implies the device backend: CUDA maps to NVPTX/CUDA and HIP maps to
AMDGPU/HSA. That is too restrictive for the LLVM offload path, where the
language frontend and the device backend can be separate choices.

Using `-foffload-via-llvm` we can split the kernel language from backend
assumptions. When enabled, the driver suppresses the vendor
runtime/header paths, injects the LLVM-provided generic GPU device
headers and language runtime headers, and links the LLVM CUDA/HIP
runtime libraries from #211694 instead. It also provides tests for
#211694 since they require the frontend to run.

Assisted by GPT-5.5, checked and reviewed manually

Co-authored-by: Johannes Doerfert <jdoerfert.llvm@gmail.com>
Co-authored-by: Jonas Greifenhain <cadivus@daverkomp.de>
2026-08-13 13:05:18 -07:00

34 lines
1.3 KiB
C++

//===-- LanguageLaunch.h - Language launch API declarations ---------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_OFFLOAD_LANGUAGES_KERNEL_INCLUDE_LANGUAGE_LAUNCH_H
#define LLVM_OFFLOAD_LANGUAGES_KERNEL_INCLUDE_LANGUAGE_LAUNCH_H
#include "Types.h"
#include <cstddef>
#include <cstdint>
extern "C" {
/// Push call configuration for kernel launch
unsigned __llvmPushCallConfiguration(dim3 __grid_size, dim3 __block_size,
size_t __shared_memory = 0,
void *__stream = 0);
/// Pop call configuration for kernel launch
unsigned __llvmPopCallConfiguration(dim3 *__grid_size, dim3 *__block_size,
size_t *__shared_memory, void **__stream);
/// LLVM-style kernel launch entry point
unsigned llvmLaunchKernel(const char *KernelID, dim3 GridDim, dim3 BlockDim,
void *KernelArgsPtr, size_t DynamicSharedMem = 0,
void *Stream = 0);
}
#endif // LLVM_OFFLOAD_LANGUAGES_KERNEL_INCLUDE_LANGUAGE_LAUNCH_H