Files
TheRock/compiler/amd-llvm/openmp/device/include/extra_allocators.h
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

104 lines
3.2 KiB
C++

//===---------- extra_allocators.h - OpenMP interface -----------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// Additional OpenMP interface definitions, in conjunction with Interface.h.
//
//===----------------------------------------------------------------------===//
#ifndef OPENMP_LIBOMPTARGET_DEVICERTL_INCLUDE_EXTRA_ALLOCATORS_H
#define OPENMP_LIBOMPTARGET_DEVICERTL_INCLUDE_EXTRA_ALLOCATORS_H
#include "DeviceTypes.h"
#include "Xteamr.h"
extern "C" {
/// Tasking
///
///{
void omp_fulfill_event(uint64_t);
///}
/// OpenMP 5.1 Memory Management routines (from libomp)
/// OpenMP allocator API is currently unimplemented, including traits.
/// All allocation routines will directly call the global memory allocation
/// routine and, consequently, omp_free will call device memory deallocation.
///
/// {
omp_allocator_handle_t omp_init_allocator(omp_memspace_handle_t m, int ntraits,
omp_alloctrait_t traits[]);
void omp_destroy_allocator(omp_allocator_handle_t allocator);
void omp_set_default_allocator(omp_allocator_handle_t a);
omp_allocator_handle_t omp_get_default_allocator(void);
void *omp_alloc(uint64_t size,
omp_allocator_handle_t allocator = omp_null_allocator);
void *omp_aligned_alloc(uint64_t align, uint64_t size,
omp_allocator_handle_t allocator = omp_null_allocator);
void *omp_calloc(uint64_t nmemb, uint64_t size,
omp_allocator_handle_t allocator = omp_null_allocator);
void *omp_aligned_calloc(uint64_t align, uint64_t nmemb, uint64_t size,
omp_allocator_handle_t allocator = omp_null_allocator);
void *omp_realloc(void *ptr, uint64_t size,
omp_allocator_handle_t allocator = omp_null_allocator,
omp_allocator_handle_t free_allocator = omp_null_allocator);
void omp_free(void *ptr, omp_allocator_handle_t allocator = omp_null_allocator);
/// }
/// CUDA exposes a native malloc/free API, while ROCm does not.
//// Any re-definitions of malloc/free delete the native CUDA
//// but they are necessary
#ifdef __AMDGCN__
void *malloc(size_t Size);
void free(void *Ptr);
#endif
} // extern "C"
extern "C" {
/// External interface to get the block size
uint32_t __kmpc_get_hardware_num_blocks();
/// Synchronization
///
///{
void __kmpc_impl_syncthreads();
void __kmpc_flush_acquire(IdentTy *Loc);
void __kmpc_flush_release(IdentTy *Loc);
void __kmpc_flush_acqrel(IdentTy *Loc);
///}
/// Tasking
///
///{
void *__kmpc_task_allow_completion_event(IdentTy *loc_ref, uint32_t gtid,
TaskDescriptorTy *task);
///}
} // extern "C"
/// Extra API exposed by ROCm
extern "C" {
int omp_ext_get_warp_id(void);
int omp_ext_get_lane_id(void);
int omp_ext_get_master_thread_id(void);
int omp_ext_get_smid(void);
int omp_ext_is_spmd_mode(void);
unsigned long long omp_ext_get_active_threads_mask(void);
} // extern "C"
#endif // OPENMP_LIBOMPTARGET_DEVICERTL_INCLUDE_EXTRA_ALLOCATORS_H