File size: 6,637 Bytes
47993d5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | /*
* NVIDIA_COPYRIGHT_BEGIN
*
* Copyright (c) 2011-2023, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*
* NVIDIA_COPYRIGHT_END
*/
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
#if defined(_MSC_VER)
#pragma message("crt/link.stub is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
#else
#warning "crt/link.stub is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
#endif
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_LINK_STUB__
#endif
#include <stddef.h> /* for size_t */
#include "crt/host_defines.h"
#if defined(__GNUC__)
#if defined(__clang__) || (!defined(__PGIC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
#pragma GCC diagnostic push
#endif
#if defined(__clang__) || (!defined(__PGIC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)))
#pragma GCC diagnostic ignored "-Wcast-qual"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#endif
static void **__cudaFatCubinHandle;
extern "C" {
extern void** CUDARTAPI __cudaRegisterFatBinary(
void *fatCubin
);
extern void CUDARTAPI __cudaRegisterFatBinaryEnd(
void **fatCubinHandle
);
extern void CUDARTAPI __cudaUnregisterFatBinary(
void **fatCubinHandle
);
static void __cudaUnregisterBinaryUtil(void)
{
__cudaUnregisterFatBinary(__cudaFatCubinHandle);
}
#if defined(__HORIZON__)
#define atexit(p)
#elif defined(__GNUC__) && !defined(__ANDROID__)
#if __cplusplus >= 202002L
extern int atexit(void(*)(void)) noexcept;
#else /* __cplusplus < 202002L */
extern int atexit(void(*)(void)) throw();
#endif /* __cplusplus >= 202002L */
#else /* __GNUC__ && !__ANDROID__ */
extern int __cdecl atexit(void(__cdecl *)(void));
#endif /* __GNUC__ && !__ANDROID__ */
}
#include <fatbinary_section.h>
static inline void __cudaRegisterLinkedBinary (const __fatBinC_Wrapper_t *prelinked_fatbinc, void (*callback_fp)(void **), void *);
#define __REGISTERFUNCNAME_CORE(X) __cudaRegisterLinkedBinary##X
#define __REGISTERFUNCNAME(X) __REGISTERFUNCNAME_CORE(X)
#define __DEFSTRNAME_CORE(X) def_module_id_str##X
#define __DEFSTRNAME(X) __DEFSTRNAME_CORE(X)
#define __TO_STRING_CORE(X) #X
#define __TO_STRING(X) __TO_STRING_CORE(X)
#define __FATIDNAME_CORE(X) __fatbinwrap##X
#define __FATIDNAME(X) __FATIDNAME_CORE(X)
#if defined(_WIN32)
#define DEFINE_REGISTER_FUNC(id) \
extern const __fatBinC_Wrapper_t __FATIDNAME(id); \
static const __declspec(align(1)) __declspec(allocate("__nv_module_id")) unsigned char __DEFSTRNAME(id) [] = "def " __TO_STRING(id); \
void __REGISTERFUNCNAME(id) (void (*callback_fp)(void **), void *prelinked_fatbinc, void *, void (*dummy_ref)(void *)) \
{ \
volatile static const unsigned char *__p; \
__p = __DEFSTRNAME(id); \
dummy_ref((void *)&__p); \
__cudaRegisterLinkedBinary(&__FATIDNAME(id), callback_fp, (void *)&__DEFSTRNAME(id)); \
}
#elif defined(__APPLE__)
#define DEFINE_REGISTER_FUNC(id) \
extern const __fatBinC_Wrapper_t __FATIDNAME(id); \
static const unsigned char __DEFSTRNAME(id) [] __attribute__((aligned(1))) __attribute__((section ("__NV_CUDA,__nv_module_id"))) = "def " __TO_STRING(id); \
void __REGISTERFUNCNAME(id) (void (*callback_fp)(void **), void *prelinked_fatbinc, void *, void (*dummy_ref)(void *)) \
{ \
volatile static const unsigned char *__p; \
__p = __DEFSTRNAME(id); \
dummy_ref((void *)&__p); \
__cudaRegisterLinkedBinary(&__FATIDNAME(id), callback_fp, (void *)&__DEFSTRNAME(id)); \
}
#else /* linux */
#define DEFINE_REGISTER_FUNC(id) \
extern const __fatBinC_Wrapper_t __FATIDNAME(id); \
static const unsigned char __DEFSTRNAME(id) [] __attribute__((aligned(1))) __attribute__((section ("__nv_module_id"))) = "def " __TO_STRING(id); \
void __REGISTERFUNCNAME(id) (void (*callback_fp)(void **), void *prelinked_fatbinc, void *, void (*dummy_ref)(void *)) \
{ \
volatile static const unsigned char *__p; \
__p = __DEFSTRNAME(id); \
dummy_ref((void *)&__p); \
__cudaRegisterLinkedBinary(&__FATIDNAME(id), callback_fp, (void *)&__DEFSTRNAME(id)); \
}
#endif
extern "C" {
#if defined(_WIN32)
#pragma data_seg("__nv_module_id")
#endif /* _WIN32 */
#include REGISTERLINKBINARYFILE
#if defined(_WIN32)
#pragma data_seg()
#endif /* _WIN32 */
}
static void* __cudaPrelinkedFatbins[NUM_PRELINKED_OBJECTS+1];
#include FATBINFILE
#if defined(__PGI)
__attribute__((unused))
#endif /* __PGI */
static inline void __cudaRegisterLinkedBinary (
const __fatBinC_Wrapper_t *prelinked_fatbinc,
void (*callback_fp)(void **),
void *)
{
static void (*__callback_array[NUM_PRELINKED_OBJECTS+1])(void **);
static int __i = 0;
__cudaPrelinkedFatbins[__i] = (void*)prelinked_fatbinc->data;
__callback_array[__i] = callback_fp;
++__i;
if (__i == NUM_PRELINKED_OBJECTS) {
__NV_EXTRA_INITIALIZATION
__cudaPrelinkedFatbins[__i] = NULL;
__cudaFatCubinHandle = __cudaRegisterFatBinary((void*)&__fatDeviceText);
atexit(__cudaUnregisterBinaryUtil);
__NV_EXTRA_FINALIZATION
for (__i = 0; __i < NUM_PRELINKED_OBJECTS; ++__i) {
(*(__callback_array[__i]))(__cudaFatCubinHandle);
}
__cudaRegisterFatBinaryEnd(__cudaFatCubinHandle);
}
}
#if defined(__GNUC__)
#if defined(__clang__) || (!defined(__PGIC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
#pragma GCC diagnostic pop
#endif
#endif
#if defined(__REGISTERFUNCNAME_CORE) && defined(__REGISTERFUNCNAME) && \
defined(__DEFSTRNAME_CORE) && defined(__DEFSTRNAME) && \
defined(__TO_STRING_CORE) && defined(__TO_STRING) && \
defined(__FATIDNAME_CORE) && defined(__FATIDNAME) && \
defined(DEFINE_REGISTER_FUNC)
/* Nothing; used to silence "-Wunused-macros" warnings, if specified. */
#endif
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_LINK_STUB__)
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_LINK_STUB__
#endif
|