mirror of
https://github.com/siemens-mobile-hacks/llvm-c166.git
synced 2026-11-25 21:45:57 +00:00
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
33 lines
898 B
C++
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
|