ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
__clang_hip_runtime_wrapper.h
Go to the documentation of this file.
1/*===---- __clang_hip_runtime_wrapper.h - HIP runtime support ---------------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10/*
11 * WARNING: This header is intended to be directly -include'd by
12 * the compiler and is not supposed to be included by users.
13 *
14 */
15
16#ifndef __CLANG_HIP_RUNTIME_WRAPPER_H__
17#define __CLANG_HIP_RUNTIME_WRAPPER_H__
18
19#if __HIP__
20
21#include <cmath>
22#include <cstdlib>
23#include <stdlib.h>
24
25#define __host__ __attribute__((host))
26#define __device__ __attribute__((device))
27#define __global__ __attribute__((global))
28#define __shared__ __attribute__((shared))
29#define __constant__ __attribute__((constant))
30
31#if __HIP_ENABLE_DEVICE_MALLOC__
32extern "C" __device__ void *__hip_malloc(size_t __size);
33extern "C" __device__ void *__hip_free(void *__ptr);
34static inline __device__ void *malloc(size_t __size) {
35 return __hip_malloc(__size);
36}
37static inline __device__ void *free(void *__ptr) { return __hip_free(__ptr); }
38#else
39static inline __device__ void *malloc(size_t __size) {
40 __builtin_trap();
41 return nullptr;
42}
43static inline __device__ void *free(void *__ptr) {
44 __builtin_trap();
45 return nullptr;
46}
47#endif
48
50#include <__clang_hip_math.h>
51
52#if !_OPENMP || __HIP_ENABLE_CUDA_WRAPPER_FOR_OPENMP__
55
56#include <algorithm>
57#include <complex>
58#include <new>
59#endif // !_OPENMP || __HIP_ENABLE_CUDA_WRAPPER_FOR_OPENMP__
60
61#define __CLANG_HIP_RUNTIME_WRAPPER_INCLUDED__ 1
62
63#endif // __HIP__
64#endif // __CLANG_HIP_RUNTIME_WRAPPER_H__