imate
C++/CUDA Reference
Loading...
Searching...
No Matches
cu_types.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
3 * SPDX-License-Identifier: BSD-3-Clause
4 * SPDX-FileType: SOURCE
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the license found in the LICENSE.txt file in the root
8 * directory of this source tree.
9 */
10
11
12#ifndef _CU_DEFINITIONS_CU_TYPES_H_
13#define _CU_DEFINITIONS_CU_TYPES_H_
14
15
16// =======
17// Headers
18// =======
19
20#include "./cu_definitions.h" // USE_CUDA_FP8_E5M2, USE_CUDA_FP8_E4M3,
21 // USE_CUDA_FP16, USE_CUDA_BF16
22
23#if defined(USE_CUDA_FP8_E5M2) && (USE_CUDA_FP8_E5M2 == 1)
24 #include <cuda_fp8.h> // __nv_fp8_e5m2
25#else
26 // Define a fallback struct when cuda_fp8.h is not included.
27 struct __nv_fp8_e5m2 {};
28#endif
29
30#if defined(USE_CUDA_FP8_E4M3) && (USE_CUDA_FP8_E4M3 == 1)
31 #include <cuda_fp8.h> // __nv_fp8_e4m3
32#else
33 // Define a fallback struct when cuda_fp8.h is not included.
34 struct __nv_fp8_e4m3 {};
35#endif
36
37#if defined(USE_CUDA_FP16) && (USE_CUDA_FP16 == 1)
38 #include <cuda_fp16.h> // __half
39#else
40 // No need to define a fallback struct when USE_CUDA_FP16 is not 1. This is
41 // because other headers (such as cuda_api.h cusparse.h) already include
42 // cuda_fp16.h, whether we include cuda_fp16.h or not. Hence, defining a
43 // fallback struct indeed conflicts with the already existing definition.
44#endif
45
46#if defined(USE_CUDA_BF16) && (USE_CUDA_BF16 == 1)
47 #include <cuda_bf16.h> // __nv_bfloat16
48 // No need to define a fallback struct when USE_CUDA_BF16 is not 1. This is
49 // because other headers (such as cublas_api.h) already include
50 // cuda_bf16.h, whether we include cuda_bf16.h or not. Hence, defining a
51 // fallback struct indeed conflicts with the already existing definition.
52#endif
53
54
55#endif // _CU_DEFINITIONS_CU_TYPES_H_