llvm-c166/offload/languages/kernel/include/Stream.h
Sophia Herrmann 97a43cb6dc
[Offload][Lang] Add internal StreamTy (#216374)
Add an internal StreamTy wrapper for CUDA/HIP language streams in
LLVMOffloadKernel.

`cudaStream_t`/`hipStream_t` now point to runtime-owned StreamTy objects
instead of raw ol_queue_handle_t values. StreamTy tracks the backing
queue, owning device, and stream kind, which lets the runtime manage
explicit streams and default streams through shared state.

Assisted by GPT-5.5, checked and reviewed manually
2026-08-27 15:38:39 -07:00

33 lines
898 B
C++

//===-- Stream.h - Kernel language stream state ---------------------------===//
//
// 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_STREAM_H
#define LLVM_OFFLOAD_LANGUAGES_KERNEL_INCLUDE_STREAM_H
#include "OffloadAPI.h"
namespace llvm {
namespace offload {
enum class QueueKind {
LegacyDefault,
PerThreadDefault,
ExplicitBlocking,
ExplicitNonBlocking,
};
struct StreamTy {
ol_queue_handle_t Queue = nullptr;
ol_device_handle_t Device = nullptr;
QueueKind Kind = QueueKind::ExplicitBlocking;
};
} // namespace offload
} // namespace llvm
#endif // LLVM_OFFLOAD_LANGUAGES_KERNEL_INCLUDE_STREAM_H