diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..e77d446ba6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# do not show up detailed difference on GitHub +source/3rdparty/* linguist-generated=true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dc1d5e99eb..0d2f89a857 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,22 +27,26 @@ repos: hooks: - id: isort files: \.py$ + exclude: ^source/3rdparty - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.0.291 hooks: - id: ruff args: ["--fix"] + exclude: ^source/3rdparty - repo: https://github.com/psf/black-pre-commit-mirror rev: 23.9.1 hooks: - id: black-jupyter + exclude: ^source/3rdparty # numpydoc - repo: https://github.com/Carreau/velin rev: 0.0.12 hooks: - id: velin args: ["--write"] + exclude: ^source/3rdparty # Python inside docs - repo: https://github.com/asottile/blacken-docs rev: 1.16.0 @@ -102,6 +106,7 @@ repos: - --comment-style - "#" - --no-extra-eol + exclude: ^source/3rdparty # HTML - id: insert-license files: \.(html|vue|xml)$ diff --git a/source/3rdparty/implib/arch/aarch64/config.ini b/source/3rdparty/implib/arch/aarch64/config.ini new file mode 100644 index 0000000000..0c2ea99ee5 --- /dev/null +++ b/source/3rdparty/implib/arch/aarch64/config.ini @@ -0,0 +1,3 @@ +[Arch] +PointerSize = 8 +SymbolReloc = R_AARCH64_ABS64 diff --git a/source/3rdparty/implib/arch/aarch64/table.S.tpl b/source/3rdparty/implib/arch/aarch64/table.S.tpl new file mode 100644 index 0000000000..fddba0052a --- /dev/null +++ b/source/3rdparty/implib/arch/aarch64/table.S.tpl @@ -0,0 +1,77 @@ +/* + * Copyright 2018-2020 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + +#define lr x30 +#define ip0 x16 + + .data + + .globl _${lib_suffix}_tramp_table + .hidden _${lib_suffix}_tramp_table + .align 8 +_${lib_suffix}_tramp_table: + .zero $table_size + + .text + + .globl _${lib_suffix}_tramp_resolve + .hidden _${lib_suffix}_tramp_resolve + + .globl _${lib_suffix}_save_regs_and_resolve + .hidden _${lib_suffix}_save_regs_and_resolve + .type _${lib_suffix}_save_regs_and_resolve, %function +_${lib_suffix}_save_regs_and_resolve: + .cfi_startproc + + // Slow path which calls dlsym, taken only on first call. + // Registers are saved according to "Procedure Call Standard for the Arm® 64-bit Architecture". + // For DWARF directives, read https://www.imperialviolet.org/2017/01/18/cfi.html. + + // Stack is aligned at 16 bytes + +#define PUSH_PAIR(reg1, reg2) stp reg1, reg2, [sp, #-16]!; .cfi_adjust_cfa_offset 16; .cfi_rel_offset reg1, 0; .cfi_rel_offset reg2, 8 +#define POP_PAIR(reg1, reg2) ldp reg1, reg2, [sp], #16; .cfi_adjust_cfa_offset -16; .cfi_restore reg2; .cfi_restore reg1 + +#define PUSH_WIDE_PAIR(reg1, reg2) stp reg1, reg2, [sp, #-32]!; .cfi_adjust_cfa_offset 32; .cfi_rel_offset reg1, 0; .cfi_rel_offset reg2, 16 +#define POP_WIDE_PAIR(reg1, reg2) ldp reg1, reg2, [sp], #32; .cfi_adjust_cfa_offset -32; .cfi_restore reg2; .cfi_restore reg1 + + // Save only arguments (and lr) + PUSH_PAIR(x0, x1) + PUSH_PAIR(x2, x3) + PUSH_PAIR(x4, x5) + PUSH_PAIR(x6, x7) + PUSH_PAIR(x8, lr) + + ldr x0, [sp, #80] // 16*5 + + PUSH_WIDE_PAIR(q0, q1) + PUSH_WIDE_PAIR(q2, q3) + PUSH_WIDE_PAIR(q4, q5) + PUSH_WIDE_PAIR(q6, q7) + + // Stack is aligned at 16 bytes + + bl _${lib_suffix}_tramp_resolve + + // TODO: pop pc? + + POP_WIDE_PAIR(q6, q7) + POP_WIDE_PAIR(q4, q5) + POP_WIDE_PAIR(q2, q3) + POP_WIDE_PAIR(q0, q1) + + POP_PAIR(x8, lr) + POP_PAIR(x6, x7) + POP_PAIR(x4, x5) + POP_PAIR(x2, x3) + POP_PAIR(x0, x1) + + br lr + + .cfi_endproc diff --git a/source/3rdparty/implib/arch/aarch64/trampoline.S.tpl b/source/3rdparty/implib/arch/aarch64/trampoline.S.tpl new file mode 100644 index 0000000000..18b9e4f030 --- /dev/null +++ b/source/3rdparty/implib/arch/aarch64/trampoline.S.tpl @@ -0,0 +1,40 @@ +/* + * Copyright 2018-2023 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .globl $sym + .p2align 4 + .type $sym, %function +#ifndef IMPLIB_EXPORT_SHIMS + .hidden $sym +#endif +$sym: + .cfi_startproc + +1: + // Load address + // TODO: can we do this faster on newer ARMs? + adrp ip0, _${lib_suffix}_tramp_table+$offset + ldr ip0, [ip0, #:lo12:_${lib_suffix}_tramp_table+$offset] + + cbz ip0, 2f + + // Fast path + br ip0 + +2: + // Slow path + mov ip0, $number & 0xffff +#if $number > 0xffff + movk ip0, $number >> 16, lsl #16 +#endif + stp ip0, lr, [sp, #-16]!; .cfi_adjust_cfa_offset 16; .cfi_rel_offset ip0, 0; .cfi_rel_offset lr, 8; + bl _${lib_suffix}_save_regs_and_resolve + ldp ip0, lr, [sp], #16; .cfi_adjust_cfa_offset -16; .cfi_restore lr; .cfi_restore ip0 + b 1b + .cfi_endproc diff --git a/source/3rdparty/implib/arch/arm/config.ini b/source/3rdparty/implib/arch/arm/config.ini new file mode 100644 index 0000000000..4f0870a2b2 --- /dev/null +++ b/source/3rdparty/implib/arch/arm/config.ini @@ -0,0 +1,3 @@ +[Arch] +PointerSize = 4 +SymbolReloc = R_ARM_ABS32 diff --git a/source/3rdparty/implib/arch/arm/table.S.tpl b/source/3rdparty/implib/arch/arm/table.S.tpl new file mode 100644 index 0000000000..7e071661c7 --- /dev/null +++ b/source/3rdparty/implib/arch/arm/table.S.tpl @@ -0,0 +1,88 @@ +/* + * Copyright 2018-2022 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .data + + .globl _${lib_suffix}_tramp_table + .hidden _${lib_suffix}_tramp_table + .align 4 +_${lib_suffix}_tramp_table: + .zero $table_size + + .text + + .globl _${lib_suffix}_tramp_resolve + .hidden _${lib_suffix}_tramp_resolve + + .globl _${lib_suffix}_save_regs_and_resolve + .hidden _${lib_suffix}_save_regs_and_resolve + .type _${lib_suffix}_save_regs_and_resolve, %function +_${lib_suffix}_save_regs_and_resolve: + .cfi_startproc + +#define PUSH_REG(reg) push {reg}; .cfi_adjust_cfa_offset 4; .cfi_rel_offset reg, 0 +#define POP_REG(reg) pop {reg} ; .cfi_adjust_cfa_offset -4; .cfi_restore reg + +// Binutils 2.30 does not like q0 in .cfi_rel_offset +#define PUSH_DREG_PAIR(reg1, reg2) vpush {reg1, reg2}; .cfi_adjust_cfa_offset 16; .cfi_rel_offset reg1, 0; .cfi_rel_offset reg2, 8 +#define POP_DREG_PAIR(reg1, reg2) vpop {reg1, reg2}; .cfi_adjust_cfa_offset -16; .cfi_restore reg1; .cfi_restore reg2 + + // Slow path which calls dlsym, taken only on first call. + // Registers are saved acc. to "Procedure Call Standard for the ARM Architecture". + // For DWARF directives, read https://www.imperialviolet.org/2017/01/18/cfi.html. + + // Stack is aligned at 16 bytes at this point + + // Save only arguments (and lr) + PUSH_REG(r0) + ldr r0, [sp, #8] + PUSH_REG(r1) + PUSH_REG(r2) + PUSH_REG(r3) + PUSH_REG(lr) + PUSH_REG(lr) // Align to 8 bytes + + // Arguments can be passed in VFP registers only when hard-float ABI is used + // for arm-gnueabihf target // (http://android-doc.github.io/ndk/guides/abis.html#v7a). + // Use compiler macro to detect this case. +#ifdef __ARM_PCS_VFP + PUSH_DREG_PAIR(d0, d1) + PUSH_DREG_PAIR(d2, d3) + PUSH_DREG_PAIR(d4, d5) + PUSH_DREG_PAIR(d6, d7) + PUSH_DREG_PAIR(d8, d9) + PUSH_DREG_PAIR(d10, d11) + PUSH_DREG_PAIR(d12, d13) + PUSH_DREG_PAIR(d14, d15) + // FIXME: NEON actually supports 32 D-registers but it's unclear how to detect this +#endif + + bl _${lib_suffix}_tramp_resolve(PLT) + +#ifdef __ARM_PCS_VFP + POP_DREG_PAIR(d14, d15) + POP_DREG_PAIR(d12, d13) + POP_DREG_PAIR(d10, d11) + POP_DREG_PAIR(d8, d9) + POP_DREG_PAIR(d6, d7) + POP_DREG_PAIR(d4, d5) + POP_DREG_PAIR(d2, d3) + POP_DREG_PAIR(d0, d1) +#endif + + POP_REG(lr) // TODO: pop pc? + POP_REG(lr) + POP_REG(r3) + POP_REG(r2) + POP_REG(r1) + POP_REG(r0) + + bx lr + + .cfi_endproc diff --git a/source/3rdparty/implib/arch/arm/trampoline.S.tpl b/source/3rdparty/implib/arch/arm/trampoline.S.tpl new file mode 100644 index 0000000000..12a51df017 --- /dev/null +++ b/source/3rdparty/implib/arch/arm/trampoline.S.tpl @@ -0,0 +1,49 @@ +/* + * Copyright 2018-2023 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .globl $sym + .p2align 4 + .type $sym, %function +#ifndef IMPLIB_EXPORT_SHIMS + .hidden $sym +#endif +$sym: + .cfi_startproc + +1: + // Load address + // TODO: can we do this faster on newer ARMs? + ldr ip, 3f +2: + add ip, pc, ip + ldr ip, [ip] + + cmp ip, #0 + + // Fast path + bxne ip + + // Slow path + ldr ip, =$number + push {ip} + .cfi_adjust_cfa_offset 4 + PUSH_REG(lr) + bl _${lib_suffix}_save_regs_and_resolve + POP_REG(lr) + add sp, #4 + .cfi_adjust_cfa_offset -4 + b 1b + + // Force constant pool for ldr above + .ltorg + + .cfi_endproc + +3: + .word _${lib_suffix}_tramp_table - (2b + 8) + $offset diff --git a/source/3rdparty/implib/arch/common/init.c.tpl b/source/3rdparty/implib/arch/common/init.c.tpl new file mode 100644 index 0000000000..ad8b19b3e1 --- /dev/null +++ b/source/3rdparty/implib/arch/common/init.c.tpl @@ -0,0 +1,152 @@ +/* + * Copyright 2018-2022 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE // For RTLD_DEFAULT +#endif + +#include +#include +#include +#include +#include + +// Sanity check for ARM to avoid puzzling runtime crashes +#ifdef __arm__ +# if defined __thumb__ && ! defined __THUMB_INTERWORK__ +# error "ARM trampolines need -mthumb-interwork to work in Thumb mode" +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define CHECK(cond, fmt, ...) do { \ + if(!(cond)) { \ + fprintf(stderr, "implib-gen: $load_name: " fmt "\n", ##__VA_ARGS__); \ + } \ + } while(0) + +#define HAS_DLOPEN_CALLBACK $has_dlopen_callback +#define HAS_DLSYM_CALLBACK $has_dlsym_callback +#define NO_DLOPEN $no_dlopen +#define LAZY_LOAD $lazy_load + +static void *lib_handle; +static int do_dlclose; +static int is_lib_loading; + +#if ! NO_DLOPEN +static void *load_library() { + if(lib_handle) + return lib_handle; + + is_lib_loading = 1; + +#if HAS_DLOPEN_CALLBACK + extern void *$dlopen_callback(const char *lib_name); + lib_handle = $dlopen_callback("$load_name"); + CHECK(lib_handle, "failed to load library '$load_name' via callback '$dlopen_callback'"); +#else + lib_handle = dlopen("$load_name", RTLD_LAZY | RTLD_GLOBAL); + CHECK(lib_handle, "failed to load library '$load_name' via dlopen: %s", dlerror()); +#endif + + do_dlclose = 1; + is_lib_loading = 0; + + return lib_handle; +} + +static void __attribute__((destructor)) unload_lib() { + if(do_dlclose && lib_handle) + dlclose(lib_handle); +} +#endif + +#if ! NO_DLOPEN && ! LAZY_LOAD +static void __attribute__((constructor)) load_lib() { + load_library(); +} +#endif + +// TODO: convert to single 0-separated string +static const char *const sym_names[] = { + $sym_names + 0 +}; + +#define SYM_COUNT (sizeof(sym_names)/sizeof(sym_names[0]) - 1) + +extern void *_${lib_suffix}_tramp_table[]; + +// Can be sped up by manually parsing library symtab... +void _${lib_suffix}_tramp_resolve(int i) { + assert((unsigned)i < SYM_COUNT); + + CHECK(!is_lib_loading, "library function '%s' called during library load", sym_names[i]); + + void *h = 0; +#if NO_DLOPEN + // Library with implementations must have already been loaded. + if (lib_handle) { + // User has specified loaded library + h = lib_handle; + } else { + // User hasn't provided us the loaded library so search the global namespace. +# ifndef IMPLIB_EXPORT_SHIMS + // If shim symbols are hidden we should search + // for first available definition of symbol in library list + h = RTLD_DEFAULT; +# else + // Otherwise look for next available definition + h = RTLD_NEXT; +# endif + } +#else + h = load_library(); + CHECK(h, "failed to resolve symbol '%s', library failed to load", sym_names[i]); +#endif + +#if HAS_DLSYM_CALLBACK + extern void *$dlsym_callback(void *handle, const char *sym_name); + _${lib_suffix}_tramp_table[i] = $dlsym_callback(h, sym_names[i]); + CHECK(_${lib_suffix}_tramp_table[i], "failed to resolve symbol '%s' via callback $dlsym_callback", sym_names[i]); +#else + // Dlsym is thread-safe so don't need to protect it. + _${lib_suffix}_tramp_table[i] = dlsym(h, sym_names[i]); + CHECK(_${lib_suffix}_tramp_table[i], "failed to resolve symbol '%s' via dlsym: %s", sym_names[i], dlerror()); +#endif +} + +// Helper for user to resolve all symbols +void _${lib_suffix}_tramp_resolve_all(void) { + size_t i; + for(i = 0; i < SYM_COUNT; ++i) + _${lib_suffix}_tramp_resolve(i); +} + +// Allows user to specify manually loaded implementation library. +void _${lib_suffix}_tramp_set_handle(void *handle) { + lib_handle = handle; + do_dlclose = 0; +} + +// Resets all resolved symbols. This is needed in case +// client code wants to reload interposed library multiple times. +void _${lib_suffix}_tramp_reset(void) { + memset(_${lib_suffix}_tramp_table, 0, SYM_COUNT * sizeof(_${lib_suffix}_tramp_table[0])); + lib_handle = 0; + do_dlclose = 0; +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/source/3rdparty/implib/arch/e2k/README.md b/source/3rdparty/implib/arch/e2k/README.md new file mode 100644 index 0000000000..eb87f54f85 --- /dev/null +++ b/source/3rdparty/implib/arch/e2k/README.md @@ -0,0 +1,4 @@ +Reference materials: + * Руководство по эффективному программированию на платформе «Эльбрус» (http://www.mcst.ru/files/5ed39a/dd0cd8/50506b/000000/elbrus_prog_2020-05-30.pdf) + * Микропроцессоры и вычислительные комплексы семейства Эльбрус (http://www.mcst.ru/doc/book_121130.pdf) + * https://github.com/OpenE2K diff --git a/source/3rdparty/implib/arch/e2k/config.ini b/source/3rdparty/implib/arch/e2k/config.ini new file mode 100644 index 0000000000..e34cbe2713 --- /dev/null +++ b/source/3rdparty/implib/arch/e2k/config.ini @@ -0,0 +1,3 @@ +[Arch] +PointerSize = 8 +SymbolReloc = R_E2K_DISP, R_E2K_64_ABS_LIT, R_E2K_64_ABS diff --git a/source/3rdparty/implib/arch/e2k/table.S.tpl b/source/3rdparty/implib/arch/e2k/table.S.tpl new file mode 100644 index 0000000000..9f28f51791 --- /dev/null +++ b/source/3rdparty/implib/arch/e2k/table.S.tpl @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .data + + .globl _${lib_suffix}_tramp_table + .hidden _${lib_suffix}_tramp_table + .ignore strict_delay + .p2align 3 +_${lib_suffix}_tramp_table: + .zero $table_size + + .text + + .globl _${lib_suffix}_tramp_resolve + .hidden _${lib_suffix}_tramp_resolve + + .globl _${lib_suffix}_save_regs_and_resolve + .hidden _${lib_suffix}_save_regs_and_resolve + .type _${lib_suffix}_save_regs_and_resolve, %function +_${lib_suffix}_save_regs_and_resolve: + .cfi_startproc + + setwd wsz = 0x1, nfx = 1 + + addd 0x0, %g0, %r0 + + disp %ctpr1, _${lib_suffix}_tramp_resolve + call %ctpr1, wbs = 0 + + return %ctpr3 + ct %ctpr3 + + .cfi_endproc diff --git a/source/3rdparty/implib/arch/e2k/trampoline.S.tpl b/source/3rdparty/implib/arch/e2k/trampoline.S.tpl new file mode 100644 index 0000000000..dcd385713b --- /dev/null +++ b/source/3rdparty/implib/arch/e2k/trampoline.S.tpl @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .globl $sym + .p2align 3 + .ignore strict_delay + .type $sym, %function +#ifndef IMPLIB_EXPORT_SHIMS + .hidden $sym +#endif +$sym: + .cfi_startproc + + setwd wsz = 0x8, nfx = 0x1 + +1: + // Read table address + { + rrd %ip, %g0 + addd 0x0, [ _f64 _GLOBAL_OFFSET_TABLE_ ], %g1 + } + addd %g0, %g1, %g0 + addd %g0, [ _f64 _${lib_suffix}_tramp_table@GOTOFF ], %g0 + + // Read current function address + ldd [%g0 + $offset], %g0 + + // NULL? + { + cmpesb %g0, 0x0, %pred0 + movtd %g0, %ctpr2 + } + + // Jump to fast path + ct %ctpr2 ? ~%pred0 + + // Or fall through to slow path + +2: + // Initialize parameter + addd 0x0, _f16s $number, %g0 + + // Call resolver + disp %ctpr1, _${lib_suffix}_save_regs_and_resolve + call %ctpr1, wbs = 0x8 + + // Return to fast path + ibranch 1b + + .cfi_endproc diff --git a/source/3rdparty/implib/arch/i386/config.ini b/source/3rdparty/implib/arch/i386/config.ini new file mode 100644 index 0000000000..f93835df74 --- /dev/null +++ b/source/3rdparty/implib/arch/i386/config.ini @@ -0,0 +1,3 @@ +[Arch] +PointerSize = 4 +SymbolReloc = R_386_32 diff --git a/source/3rdparty/implib/arch/i386/table.S.tpl b/source/3rdparty/implib/arch/i386/table.S.tpl new file mode 100644 index 0000000000..107bd8932d --- /dev/null +++ b/source/3rdparty/implib/arch/i386/table.S.tpl @@ -0,0 +1,80 @@ +/* + * Copyright 2019-2022 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .data + + .globl _${lib_suffix}_tramp_table + .hidden _${lib_suffix}_tramp_table + .align 4 +_${lib_suffix}_tramp_table: + .zero $table_size + + .text + + .globl _${lib_suffix}_tramp_resolve + .hidden _${lib_suffix}_tramp_resolve + + .globl _${lib_suffix}_save_regs_and_resolve + .hidden _${lib_suffix}_save_regs_and_resolve + .type _${lib_suffix}_save_regs_and_resolve, %function +_${lib_suffix}_save_regs_and_resolve: + .cfi_startproc + +#define PUSH_REG(reg) pushl %reg ; .cfi_adjust_cfa_offset 4; .cfi_rel_offset reg, 0 +#define POP_REG(reg) popl %reg ; .cfi_adjust_cfa_offset -4; .cfi_restore reg + + // Slow path which calls dlsym, taken only on first call. + // All registers are stored to handle arbitrary calling conventions + // (except XMM/x87 regs in hope they are not used in resolving code). + // For Dwarf directives, read https://www.imperialviolet.org/2017/01/18/cfi.html. + + .cfi_def_cfa_offset 4 // Return address + + PUSH_REG(eax) + PUSH_REG(ebx) + PUSH_REG(ecx) + PUSH_REG(edx) // 16 + + PUSH_REG(ebp) + PUSH_REG(edi) + PUSH_REG(esi) + pushfl; .cfi_adjust_cfa_offset 4 // 16 + + subl $$8, %esp + .cfi_adjust_cfa_offset 8 + PUSH_REG(eax) + + call _${lib_suffix}_tramp_resolve@PLT // Stack will be aligned at 16 in call + + addl $$12, %esp + .cfi_adjust_cfa_offset -12 + + popfl; .cfi_adjust_cfa_offset -4 + POP_REG(esi) + POP_REG(edi) + POP_REG(ebp) + + POP_REG(edx) + POP_REG(ecx) + POP_REG(ebx) + POP_REG(eax) + + ret + + .cfi_endproc + + .section .text.__implib.x86.get_pc_thunk.ax,"axG",@progbits,__implib.x86.get_pc_thunk.ax,comdat + .globl __implib.x86.get_pc_thunk.ax + .hidden __implib.x86.get_pc_thunk.ax + .type __implib.x86.get_pc_thunk.ax, %function +__implib.x86.get_pc_thunk.ax: + .cfi_startproc + movl (%esp), %eax + ret + .cfi_endproc diff --git a/source/3rdparty/implib/arch/i386/trampoline.S.tpl b/source/3rdparty/implib/arch/i386/trampoline.S.tpl new file mode 100644 index 0000000000..98b07c4a5c --- /dev/null +++ b/source/3rdparty/implib/arch/i386/trampoline.S.tpl @@ -0,0 +1,33 @@ +/* + * Copyright 2019-2022 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .globl $sym + .p2align 4 + .type $sym, %function +#ifndef IMPLIB_EXPORT_SHIMS + .hidden $sym +#endif +$sym: + .cfi_startproc + .cfi_def_cfa_offset 4 // Return address + // add $$0, %rsp Why GDB fails to step over call without this?! + // x86 has no support for PC-relative addressing so code is not very efficient. + // We also trash EAX here (it's call-clobbered in cdecl). + call __implib.x86.get_pc_thunk.ax + addl $$_GLOBAL_OFFSET_TABLE_, %eax + movl $offset+_${lib_suffix}_tramp_table@GOTOFF(%eax), %eax + cmp $$0, %eax + je 2f +1: + jmp *%eax +2: + mov $$$number, %eax + call _${lib_suffix}_save_regs_and_resolve + jmp $sym + .cfi_endproc diff --git a/source/3rdparty/implib/arch/mips/config.ini b/source/3rdparty/implib/arch/mips/config.ini new file mode 100644 index 0000000000..941fcd17a6 --- /dev/null +++ b/source/3rdparty/implib/arch/mips/config.ini @@ -0,0 +1,3 @@ +[Arch] +PointerSize = 4 +SymbolReloc = R_MIPS_REL32 diff --git a/source/3rdparty/implib/arch/mips/table.S.tpl b/source/3rdparty/implib/arch/mips/table.S.tpl new file mode 100644 index 0000000000..6f578f8e22 --- /dev/null +++ b/source/3rdparty/implib/arch/mips/table.S.tpl @@ -0,0 +1,89 @@ +/* + * Copyright 2022-2023 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .data + + .globl _${lib_suffix}_tramp_table + .hidden _${lib_suffix}_tramp_table + .align 4 +_${lib_suffix}_tramp_table: + .zero $table_size + + .text + + .globl _${lib_suffix}_tramp_resolve + .hidden _${lib_suffix}_tramp_resolve + + .globl _${lib_suffix}_save_regs_and_resolve + .hidden _${lib_suffix}_save_regs_and_resolve + .type _${lib_suffix}_save_regs_and_resolve, %function +_${lib_suffix}_save_regs_and_resolve: + .cfi_startproc + + .set noreorder + .cpload $$25 + .set nomacro + .set noat + + // Slow path which calls dlsym, taken only on first call. + // Registers are saved acc. to "Procedure Call Standard for the MIPS Architecture". + // For DWARF directives, read https://www.imperialviolet.org/2017/01/18/cfi.html. + + // TODO: push two regs at once here and in trampoline to avoid temporarily unaligned stack + +#define PUSH_REG(reg) addiu $$sp, $$sp, -4; .cfi_adjust_cfa_offset 4; sw reg, 4($$sp); .cfi_rel_offset reg, 0 +#define POP_REG(reg) addiu $$sp, $$sp, 4; .cfi_adjust_cfa_offset -4; lw reg, 0($$sp); .cfi_restore reg + +// dwarf_num = 32 + reg_num +#define PUSH_FREG(reg, dwarf_num) addiu $$sp, $$sp, -4; .cfi_adjust_cfa_offset 4; swc1 reg, 4($$sp); .cfi_rel_offset dwarf_num, 0 +#define POP_FREG(reg, dwarf_num) addiu $$sp, $$sp, 4; .cfi_adjust_cfa_offset -4; lwc1 reg, 0($$sp); .cfi_restore dwarf_num + + PUSH_REG($$ra) + PUSH_REG($$a0) + PUSH_REG($$a1) + PUSH_REG($$a2) + PUSH_REG($$a3) + PUSH_REG($$a3) // For alignment + +#if 0 + // FIXME: GCC complains about odd FP regs without -modd-spreg + PUSH_FREG($$f12, 44) + PUSH_FREG($$f13, 45) + PUSH_FREG($$f14, 46) + PUSH_FREG($$f15, 47) +#endif + + move $$a0, $$AT + + lw $$25, %call16(_${lib_suffix}_tramp_resolve)($$gp) + .reloc 1f, R_MIPS_JALR, _${lib_suffix}_tramp_resolve +1: jalr $$25 + nop + +#if 0 + POP_FREG($$f15, 47) + POP_FREG($$f14, 46) + POP_FREG($$f13, 45) + POP_FREG($$f12, 44) +#endif + + POP_REG($$a3) + POP_REG($$a3) + POP_REG($$a2) + POP_REG($$a1) + POP_REG($$a0) + POP_REG($$ra) + + jr $$ra + nop + + .set macro + .set reorder + + .cfi_endproc diff --git a/source/3rdparty/implib/arch/mips/trampoline.S.tpl b/source/3rdparty/implib/arch/mips/trampoline.S.tpl new file mode 100644 index 0000000000..a37ec5636f --- /dev/null +++ b/source/3rdparty/implib/arch/mips/trampoline.S.tpl @@ -0,0 +1,75 @@ +/* + * Copyright 2022-2023 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .globl $sym + .p2align 4 + .type $sym, %function +#ifndef IMPLIB_EXPORT_SHIMS + .hidden $sym +#endif +$sym: + .cfi_startproc + + .set noreorder + .cpload $$25 + + .set nomacro + .set noat + +1: + // Load address +#if $offset < 32768 + lw $$AT, %got(_${lib_suffix}_tramp_table)($$gp) + lw $$AT, $offset($$AT) +#else + PUSH_REG($$2) + lw $$AT, %got(_${lib_suffix}_tramp_table)($$gp) + .set macro + .set at=$$2 + lw $$AT, $offset($$AT) + .set nomacro + .set noat + POP_REG($$2) +#endif + + beqz $$AT, 3f + nop + +2: + // Fast path + j $$AT + move $$25, $$AT + +3: + // Slow path + + PUSH_REG($$25) + PUSH_REG($$ra) + + // Reserve space for 4 operands according to ABI + addiu $$sp, $$sp, -16; .cfi_adjust_cfa_offset 16 + + li $$AT, $number + lw $$25, %call16(_${lib_suffix}_save_regs_and_resolve)($$gp) + .reloc 4f, R_MIPS_JALR, _${lib_suffix}_save_regs_and_resolve +4: jalr $$25 + nop + + addiu $$sp, $$sp, 16; .cfi_adjust_cfa_offset -16 + + POP_REG($$ra) + POP_REG($$25) + + j 1b + nop + + .set macro + .set reorder + + .cfi_endproc diff --git a/source/3rdparty/implib/arch/mips64/config.ini b/source/3rdparty/implib/arch/mips64/config.ini new file mode 100644 index 0000000000..1714eb58fd --- /dev/null +++ b/source/3rdparty/implib/arch/mips64/config.ini @@ -0,0 +1,3 @@ +[Arch] +PointerSize = 8 +SymbolReloc = R_MIPS_REL32 diff --git a/source/3rdparty/implib/arch/mips64/table.S.tpl b/source/3rdparty/implib/arch/mips64/table.S.tpl new file mode 100644 index 0000000000..100b454366 --- /dev/null +++ b/source/3rdparty/implib/arch/mips64/table.S.tpl @@ -0,0 +1,88 @@ +/* + * Copyright 2022-2023 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .data + + .globl _${lib_suffix}_tramp_table + .hidden _${lib_suffix}_tramp_table + .align 8 +_${lib_suffix}_tramp_table: + .zero $table_size + + .text + + .globl _${lib_suffix}_tramp_resolve + .hidden _${lib_suffix}_tramp_resolve + + .globl _${lib_suffix}_save_regs_and_resolve + .hidden _${lib_suffix}_save_regs_and_resolve + .type _${lib_suffix}_save_regs_and_resolve, %function +_${lib_suffix}_save_regs_and_resolve: + .cfi_startproc + + .set noreorder + .cpload $$25 + .set nomacro + .set noat + + // Slow path which calls dlsym, taken only on first call. + // Registers are saved acc. to "Procedure Call Standard for the MIPS Architecture". + // For DWARF directives, read https://www.imperialviolet.org/2017/01/18/cfi.html. + + // TODO: push two regs at once here and in trampoline to avoid temporarily unaligned stack + +#define PUSH_REG(reg) daddiu $$sp, $$sp, -8; .cfi_adjust_cfa_offset 8; sd reg, 0($$sp); .cfi_rel_offset reg, 0 +#define POP_REG(reg) ld reg, 0($$sp); .cfi_restore reg; daddiu $$sp, $$sp, 8; .cfi_adjust_cfa_offset -8 + +// dwarf_num = 32 + reg_num +#define PUSH_FREG(reg, dwarf_num) daddiu $$sp, $$sp, -8; .cfi_adjust_cfa_offset 8; sdc1 reg, 0($$sp); .cfi_rel_offset dwarf_num, 0 +#define POP_FREG(reg, dwarf_num) ldc1 reg, 0($$sp); .cfi_restore dwarf_num; daddiu $$sp, $$sp, 8; .cfi_adjust_cfa_offset -8 + + PUSH_REG($$ra) + PUSH_REG($$gp) + PUSH_REG($$a0) + PUSH_REG($$a1) + PUSH_REG($$a2) + PUSH_REG($$a3) + + PUSH_FREG($$f12, 44) + PUSH_FREG($$f13, 45) + PUSH_FREG($$f14, 46) + PUSH_FREG($$f15, 47) + + lui $$gp, %hi(%neg(%gp_rel(_${lib_suffix}_save_regs_and_resolve))) + daddu $$gp, $$gp, $$25 + daddiu $$gp, $$gp, %lo(%neg(%gp_rel(_${lib_suffix}_save_regs_and_resolve))) + + move $$a0, $$AT + + ld $$25, %call16(_${lib_suffix}_tramp_resolve)($$gp) + .reloc 1f, R_MIPS_JALR, _${lib_suffix}_tramp_resolve +1: jalr $$25 + nop + + POP_FREG($$f15, 47) + POP_FREG($$f14, 46) + POP_FREG($$f13, 45) + POP_FREG($$f12, 44) + + POP_REG($$a3) + POP_REG($$a2) + POP_REG($$a1) + POP_REG($$a0) + POP_REG($$gp) + POP_REG($$ra) + + jr $$ra + nop + + .set macro + .set reorder + + .cfi_endproc diff --git a/source/3rdparty/implib/arch/mips64/trampoline.S.tpl b/source/3rdparty/implib/arch/mips64/trampoline.S.tpl new file mode 100644 index 0000000000..057e87d6ff --- /dev/null +++ b/source/3rdparty/implib/arch/mips64/trampoline.S.tpl @@ -0,0 +1,80 @@ +/* + * Copyright 2022-2023 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .globl $sym + .p2align 4 + .type $sym, %function +#ifndef IMPLIB_EXPORT_SHIMS + .hidden $sym +#endif +$sym: + .cfi_startproc + + .set noreorder + .cpload $$25 + .set nomacro + .set noat + +1: + // Load address +#if $offset < 32768 + lui $$AT, %hi(%neg(%gp_rel($sym))) + daddu $$AT, $$AT, $$25 + daddiu $$AT, $$AT, %lo(%neg(%gp_rel($sym))) + ld $$AT, %got_disp(_${lib_suffix}_tramp_table)($$AT) + ld $$AT, $offset($$AT) +#else + PUSH_REG($$2) + lui $$AT, %hi(%neg(%gp_rel($sym))) + daddu $$AT, $$AT, $$25 + daddiu $$AT, $$AT, %lo(%neg(%gp_rel($sym))) + ld $$AT, %got_disp(_${lib_suffix}_tramp_table)($$AT) + .set macro + .set at=$$2 + ld $$AT, $offset($$AT) + .set nomacro + .set noat + POP_REG($$2) +#endif + + beqz $$AT, 3f + nop + +2: + // Fast path + j $$AT + move $$25, $$AT + +3: + // Slow path + + PUSH_REG($$25) + PUSH_REG($$ra) + PUSH_REG($$gp) + + lui $$gp, %hi(%neg(%gp_rel($sym))) + daddu $$gp, $$gp, $$25 + daddiu $$gp, $$gp, %lo(%neg(%gp_rel($sym))) + + ld $$25, %call16(_${lib_suffix}_save_regs_and_resolve)($$gp) + .reloc 4f, R_MIPS_JALR, _${lib_suffix}_save_regs_and_resolve +4: jalr $$25 + li $$AT, $number + + POP_REG($$gp) + POP_REG($$ra) + POP_REG($$25) + + j 1b + nop + + .set macro + .set reorder + + .cfi_endproc diff --git a/source/3rdparty/implib/arch/x86_64/config.ini b/source/3rdparty/implib/arch/x86_64/config.ini new file mode 100644 index 0000000000..6c9087a89c --- /dev/null +++ b/source/3rdparty/implib/arch/x86_64/config.ini @@ -0,0 +1,3 @@ +[Arch] +PointerSize = 8 +SymbolReloc = R_X86_64_64 diff --git a/source/3rdparty/implib/arch/x86_64/table.S.tpl b/source/3rdparty/implib/arch/x86_64/table.S.tpl new file mode 100644 index 0000000000..d2ab2b4e79 --- /dev/null +++ b/source/3rdparty/implib/arch/x86_64/table.S.tpl @@ -0,0 +1,101 @@ +/* + * Copyright 2018-2022 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .data + + .globl _${lib_suffix}_tramp_table + .hidden _${lib_suffix}_tramp_table + .align 8 +_${lib_suffix}_tramp_table: + .zero $table_size + + .text + + .globl _${lib_suffix}_tramp_resolve + .hidden _${lib_suffix}_tramp_resolve + + .globl _${lib_suffix}_save_regs_and_resolve + .hidden _${lib_suffix}_save_regs_and_resolve + .type _${lib_suffix}_save_regs_and_resolve, %function +_${lib_suffix}_save_regs_and_resolve: + .cfi_startproc + +#define PUSH_REG(reg) pushq %reg ; .cfi_adjust_cfa_offset 8; .cfi_rel_offset reg, 0 +#define POP_REG(reg) popq %reg ; .cfi_adjust_cfa_offset -8; .cfi_restore reg + +#define DEC_STACK(d) subq $$d, %rsp; .cfi_adjust_cfa_offset d +#define INC_STACK(d) addq $$d, %rsp; .cfi_adjust_cfa_offset -d + +#define PUSH_XMM_REG(reg) DEC_STACK(16); movdqa %reg, (%rsp); .cfi_rel_offset reg, 0 +#define POP_XMM_REG(reg) movdqa (%rsp), %reg; .cfi_restore reg; INC_STACK(16) + + // Slow path which calls dlsym, taken only on first call. + // All registers are stored to handle arbitrary calling conventions + // (except x87 FPU registers which do not have to be preserved). + // For Dwarf directives, read https://www.imperialviolet.org/2017/01/18/cfi.html. + + .cfi_def_cfa_offset 8 // Return address + + // FIXME: AVX (YMM, ZMM) registers are NOT saved to simplify code. + + PUSH_REG(rdi) // 16 + mov 0x10(%rsp), %rdi + PUSH_REG(rax) + PUSH_REG(rbx) // 16 + PUSH_REG(rcx) + PUSH_REG(rdx) // 16 + PUSH_REG(rbp) + PUSH_REG(rsi) // 16 + PUSH_REG(r8) + PUSH_REG(r9) // 16 + PUSH_REG(r10) + PUSH_REG(r11) // 16 + PUSH_REG(r12) + PUSH_REG(r13) // 16 + PUSH_REG(r14) + PUSH_REG(r15) // 16 + PUSH_XMM_REG(xmm0) + PUSH_XMM_REG(xmm1) + PUSH_XMM_REG(xmm2) + PUSH_XMM_REG(xmm3) + PUSH_XMM_REG(xmm4) + PUSH_XMM_REG(xmm5) + PUSH_XMM_REG(xmm6) + PUSH_XMM_REG(xmm7) + + // Stack is just 8-byte aligned but callee will re-align to 16 + call _${lib_suffix}_tramp_resolve + + POP_XMM_REG(xmm7) + POP_XMM_REG(xmm6) + POP_XMM_REG(xmm5) + POP_XMM_REG(xmm4) + POP_XMM_REG(xmm3) + POP_XMM_REG(xmm2) + POP_XMM_REG(xmm1) + POP_XMM_REG(xmm0) // 16 + POP_REG(r15) + POP_REG(r14) // 16 + POP_REG(r13) + POP_REG(r12) // 16 + POP_REG(r11) + POP_REG(r10) // 16 + POP_REG(r9) + POP_REG(r8) // 16 + POP_REG(rsi) + POP_REG(rbp) // 16 + POP_REG(rdx) + POP_REG(rcx) // 16 + POP_REG(rbx) + POP_REG(rax) // 16 + POP_REG(rdi) + + ret + + .cfi_endproc diff --git a/source/3rdparty/implib/arch/x86_64/trampoline.S.tpl b/source/3rdparty/implib/arch/x86_64/trampoline.S.tpl new file mode 100644 index 0000000000..d2bbf10346 --- /dev/null +++ b/source/3rdparty/implib/arch/x86_64/trampoline.S.tpl @@ -0,0 +1,33 @@ +/* + * Copyright 2018-2022 Yury Gribov + * + * The MIT License (MIT) + * + * Use of this source code is governed by MIT license that can be + * found in the LICENSE.txt file. + */ + + .globl $sym + .p2align 4 + .type $sym, %function +#ifndef IMPLIB_EXPORT_SHIMS + .hidden $sym +#endif +$sym: + .cfi_startproc + .cfi_def_cfa_offset 8 // Return address + // Intel opt. manual says to + // "make the fall-through code following a conditional branch be the likely target for a branch with a forward target" + // to hint static predictor. + cmpq $$0, _${lib_suffix}_tramp_table+$offset(%rip) + je 2f +1: + jmp *_${lib_suffix}_tramp_table+$offset(%rip) +2: + pushq $$$number + .cfi_adjust_cfa_offset 8 + call _${lib_suffix}_save_regs_and_resolve + addq $$8, %rsp + .cfi_adjust_cfa_offset -8 + jmp 1b + .cfi_endproc diff --git a/source/3rdparty/implib/implib-gen.py b/source/3rdparty/implib/implib-gen.py new file mode 100755 index 0000000000..86cfa77378 --- /dev/null +++ b/source/3rdparty/implib/implib-gen.py @@ -0,0 +1,598 @@ +#!/usr/bin/env python3 + +# Copyright 2017-2023 Yury Gribov +# +# The MIT License (MIT) +# +# Use of this source code is governed by MIT license that can be +# found in the LICENSE.txt file. + +""" +Generates static import library for POSIX shared library +""" + +import sys +import os.path +import re +import subprocess +import argparse +import string +import configparser + +me = os.path.basename(__file__) +root = os.path.dirname(__file__) + +def warn(msg): + """Emits a nicely-decorated warning.""" + sys.stderr.write(f'{me}: warning: {msg}\n') + +def error(msg): + """Emits a nicely-decorated error and exits.""" + sys.stderr.write(f'{me}: error: {msg}\n') + sys.exit(1) + +def run(args, stdin=''): + """Runs external program and aborts on error.""" + env = os.environ.copy() + # Force English language + env['LC_ALL'] = 'c' + try: + del env["LANG"] + except KeyError: + pass + with subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, env=env) as p: + out, err = p.communicate(input=stdin.encode('utf-8')) + out = out.decode('utf-8') + err = err.decode('utf-8') + if p.returncode != 0 or err: + error(f"{args[0]} failed with retcode {p.returncode}:\n{err}") + return out, err + +def make_toc(words, renames=None): + "Make an mapping of words to their indices in list" + renames = renames or {} + toc = {} + for i, n in enumerate(words): + name = renames.get(n, n) + toc[i] = name + return toc + +def parse_row(words, toc, hex_keys): + "Make a mapping from column names to values" + vals = {k: (words[i] if i < len(words) else '') for i, k in toc.items()} + for k in hex_keys: + if vals[k]: + vals[k] = int(vals[k], 16) + return vals + +def collect_syms(f): + """Collect ELF dynamic symtab.""" + + # --dyn-syms does not always work for some reason so dump all symtabs + out, _ = run(['readelf', '-sW', f]) + + toc = None + syms = [] + syms_set = set() + for line in out.splitlines(): + line = line.strip() + if not line: + # Next symtab + toc = None + continue + words = re.split(r' +', line) + if line.startswith('Num'): # Header? + if toc is not None: + error("multiple headers in output of readelf") + # Colons are different across readelf versions so get rid of them. + toc = make_toc(map(lambda n: n.replace(':', ''), words)) + elif toc is not None: + sym = parse_row(words, toc, ['Value']) + name = sym['Name'] + if not name: + continue + if name in syms_set: + continue + syms_set.add(name) + sym['Size'] = int(sym['Size'], 0) # Readelf is inconistent on Size format + if '@' in name: + sym['Default'] = '@@' in name + name, ver = re.split(r'@+', name) + sym['Name'] = name + sym['Version'] = ver + else: + sym['Default'] = True + sym['Version'] = None + syms.append(sym) + + if toc is None: + error(f"failed to analyze symbols in {f}") + + # Also collected demangled names + if syms: + out, _ = run(['c++filt'], '\n'.join((sym['Name'] for sym in syms))) + out = out.rstrip("\n") # Some c++filts append newlines at the end + for i, name in enumerate(out.split("\n")): + syms[i]['Demangled Name'] = name + + return syms + +def collect_relocs(f): + """Collect ELF dynamic relocs.""" + + out, _ = run(['readelf', '-rW', f]) + + toc = None + rels = [] + for line in out.splitlines(): + line = line.strip() + if not line: + toc = None + continue + if line == 'There are no relocations in this file.': + return [] + if re.match(r'^\s*Type[0-9]:', line): # Spurious lines for MIPS + continue + if re.match(r'^\s*Offset', line): # Header? + if toc is not None: + error("multiple headers in output of readelf") + words = re.split(r'\s\s+', line) # "Symbol's Name + Addend" + toc = make_toc(words) + elif toc is not None: + line = re.sub(r' \+ ', '+', line) + words = re.split(r'\s+', line) + rel = parse_row(words, toc, ['Offset', 'Info']) + rels.append(rel) + # Split symbolic representation + sym_name = 'Symbol\'s Name + Addend' + if sym_name not in rel and 'Symbol\'s Name' in rel: + # Adapt to different versions of readelf + rel[sym_name] = rel['Symbol\'s Name'] + '+0' + if rel[sym_name]: + p = rel[sym_name].split('+') + if len(p) == 1: + p = ['', p[0]] + rel[sym_name] = (p[0], int(p[1], 16)) + + if toc is None: + error(f"failed to analyze relocations in {f}") + + return rels + +def collect_sections(f): + """Collect section info from ELF.""" + + out, _ = run(['readelf', '-SW', f]) + + toc = None + sections = [] + for line in out.splitlines(): + line = line.strip() + if not line: + continue + line = re.sub(r'\[\s+', '[', line) + words = re.split(r' +', line) + if line.startswith('[Nr]'): # Header? + if toc is not None: + error("multiple headers in output of readelf") + toc = make_toc(words, {'Addr' : 'Address'}) + elif line.startswith('[') and toc is not None: + sec = parse_row(words, toc, ['Address', 'Off', 'Size']) + if 'A' in sec['Flg']: # Allocatable section? + sections.append(sec) + + if toc is None: + error(f"failed to analyze sections in {f}") + + return sections + +def read_unrelocated_data(input_name, syms, secs): + """Collect unrelocated data from ELF.""" + data = {} + with open(input_name, 'rb') as f: + def is_symbol_in_section(sym, sec): + sec_end = sec['Address'] + sec['Size'] + is_start_in_section = sec['Address'] <= sym['Value'] < sec_end + is_end_in_section = sym['Value'] + sym['Size'] <= sec_end + return is_start_in_section and is_end_in_section + for name, s in sorted(syms.items(), key=lambda s: s[1]['Value']): + # TODO: binary search (bisect) + sec = [sec for sec in secs if is_symbol_in_section(s, sec)] + if len(sec) != 1: + error(f"failed to locate section for interval [{s['Value']:x}, {s['Value'] + s['Size']:x})") + sec = sec[0] + f.seek(sec['Off']) + data[name] = f.read(s['Size']) + return data + +def collect_relocated_data(syms, bites, rels, ptr_size, reloc_types): + """Identify relocations for each symbol""" + data = {} + for name, s in sorted(syms.items()): + b = bites.get(name) + assert b is not None + if s['Demangled Name'].startswith('typeinfo name'): + data[name] = [('byte', int(x)) for x in b] + continue + data[name] = [] + for i in range(0, len(b), ptr_size): + val = int.from_bytes(b[i*ptr_size:(i + 1)*ptr_size], byteorder='little') + data[name].append(('offset', val)) + start = s['Value'] + finish = start + s['Size'] + # TODO: binary search (bisect) + for rel in rels: + if rel['Type'] in reloc_types and start <= rel['Offset'] < finish: + i = (rel['Offset'] - start) // ptr_size + assert i < len(data[name]) + data[name][i] = 'reloc', rel + return data + +def generate_vtables(cls_tables, cls_syms, cls_data): + """Generate code for vtables""" + c_types = { + 'reloc' : 'const void *', + 'byte' : 'unsigned char', + 'offset' : 'size_t' + } + + ss = [] + ss.append('''\ +#ifdef __cplusplus +extern "C" { +#endif + +''') + + # Print externs + + printed = set() + for name, data in sorted(cls_data.items()): + for typ, val in data: + if typ != 'reloc': + continue + sym_name, addend = val['Symbol\'s Name + Addend'] + sym_name = re.sub(r'@.*', '', sym_name) # Can we pin version in C? + if sym_name not in cls_syms and sym_name not in printed: + ss.append(f'''\ +extern const char {sym_name}[]; + +''') + + # Collect variable infos + + code_info = {} + + for name, s in sorted(cls_syms.items()): + data = cls_data[name] + if s['Demangled Name'].startswith('typeinfo name'): + declarator = 'const unsigned char %s[]' + else: + field_types = (f'{c_types[typ]} field_{i};' for i, (typ, _) in enumerate(data)) + declarator = 'const struct { %s } %%s' % ' '.join(field_types) # pylint: disable=C0209 # consider-using-f-string + vals = [] + for typ, val in data: + if typ != 'reloc': + vals.append(str(val) + 'UL') + else: + sym_name, addend = val['Symbol\'s Name + Addend'] + sym_name = re.sub(r'@.*', '', sym_name) # Can we pin version in C? + vals.append(f'(const char *)&{sym_name} + {addend}') + code_info[name] = (declarator, '{ %s }' % ', '.join(vals)) # pylint: disable= C0209 # consider-using-f-string + + # Print declarations + + for name, (decl, _) in sorted(code_info.items()): + type_name = name + '_type' + type_decl = decl % type_name + ss.append(f'''\ +typedef {type_decl}; +extern __attribute__((weak)) {type_name} {name}; +''') + + # Print definitions + + for name, (_, init) in sorted(code_info.items()): + type_name = name + '_type' + ss.append(f'''\ +const {type_name} {name} = {init}; +''') + + ss.append('''\ +#ifdef __cplusplus +} // extern "C" +#endif +''') + + return ''.join(ss) + +def read_soname(f): + """Read ELF's SONAME.""" + + out, _ = run(['readelf', '-d', f]) + + for line in out.splitlines(): + line = line.strip() + if not line: + continue + # 0x000000000000000e (SONAME) Library soname: [libndp.so.0] + soname_match = re.search(r'\(SONAME\).*\[(.+)\]', line) + if soname_match is not None: + return soname_match[1] + + return None + +def main(): + """Driver function""" + parser = argparse.ArgumentParser(description="Generate wrappers for shared library functions.", + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog=f"""\ +Examples: + $ python3 {me} /usr/lib/x86_64-linux-gnu/libaccountsservice.so.0 + Generating libaccountsservice.so.0.tramp.S... + Generating libaccountsservice.so.0.init.c... +""") + + parser.add_argument('library', + metavar='LIB', + help="Library to be wrapped.") + parser.add_argument('--verbose', '-v', + help="Print diagnostic info", + action='count', + default=0) + parser.add_argument('--dlopen', + help="Emit dlopen call (default)", + dest='dlopen', action='store_true', default=True) + parser.add_argument('--no-dlopen', + help="Do not emit dlopen call (user must load/unload library himself)", + dest='dlopen', action='store_false') + parser.add_argument('--dlopen-callback', + help="Call user-provided custom callback to load library instead of dlopen", + default='') + parser.add_argument('--dlsym-callback', + help="Call user-provided custom callback to resolve a symbol, " + "instead of dlsym", + default='') + parser.add_argument('--library-load-name', + help="Use custom name for dlopened library (default is SONAME)") + parser.add_argument('--lazy-load', + help="Load library on first call to any of it's functions (default)", + dest='lazy_load', action='store_true', default=True) + parser.add_argument('--no-lazy-load', + help="Load library at program start", + dest='lazy_load', action='store_false') + parser.add_argument('--vtables', + help="Intercept virtual tables (EXPERIMENTAL)", + dest='vtables', action='store_true', default=False) + parser.add_argument('--no-vtables', + help="Do not intercept virtual tables (default)", + dest='vtables', action='store_false') + parser.add_argument('--no-weak-symbols', + help="Don't bind weak symbols", dest='no_weak_symbols', + action='store_true', default=False) + parser.add_argument('--target', + help="Target platform triple e.g. x86_64-unknown-linux-gnu or arm-none-eabi " + "(atm x86_64, i[0-9]86, arm/armhf/armeabi, aarch64/armv8, " + "mips/mipsel, mips64/mip64el and e2k are supported)", + default=os.uname()[-1]) + parser.add_argument('--symbol-list', + help="Path to file with symbols that should be present in wrapper " + "(all by default)") + parser.add_argument('--symbol-prefix', + metavar='PFX', + help="Prefix wrapper symbols with PFX", + default='') + parser.add_argument('-q', '--quiet', + help="Do not print progress info", + action='store_true') + parser.add_argument('--outdir', '-o', + help="Path to create wrapper at", + default='./') + + args = parser.parse_args() + + input_name = args.library + verbose = args.verbose + dlopen_callback = args.dlopen_callback + dlsym_callback = args.dlsym_callback + dlopen = args.dlopen + lazy_load = args.lazy_load + if args.target.startswith('arm'): + target = 'arm' # Handle armhf-..., armel-... + elif re.match(r'^i[0-9]86', args.target): + target = 'i386' + elif args.target.startswith('mips64'): + target = 'mips64' # Handle mips64-..., mips64el-..., mips64le-... + elif args.target.startswith('mips'): + target = 'mips' # Handle mips-..., mipsel-..., mipsle-... + else: + target = args.target.split('-')[0] + quiet = args.quiet + outdir = args.outdir + + if args.symbol_list is None: + funs = None + else: + with open(args.symbol_list, 'r') as f: + funs = [] + for line in re.split(r'\r?\n', f.read()): + line = re.sub(r'#.*', '', line) + line = line.strip() + if line: + funs.append(line) + + if args.library_load_name is not None: + load_name = args.library_load_name + else: + load_name = read_soname(input_name) + if load_name is None: + load_name = os.path.basename(input_name) + + # Collect target info + + target_dir = os.path.join(root, 'arch', target) + + if not os.path.exists(target_dir): + error(f"unknown architecture '{target}'") + + cfg = configparser.ConfigParser(inline_comment_prefixes=';') + cfg.read(target_dir + '/config.ini') + + ptr_size = int(cfg['Arch']['PointerSize']) + symbol_reloc_types = set(re.split(r'\s*,\s*', cfg['Arch']['SymbolReloc'])) + + def is_exported(s): + conditions = [ + s['Bind'] != 'LOCAL', + s['Type'] != 'NOTYPE', + s['Ndx'] != 'UND', + s['Name'] not in ['', '_init', '_fini']] + if args.no_weak_symbols: + conditions.append(s['Bind'] != 'WEAK') + return all(conditions) + + syms = list(filter(is_exported, collect_syms(input_name))) + + def is_data_symbol(s): + return (s['Type'] == 'OBJECT' + # Allow vtables if --vtables is on + and not (' for ' in s['Demangled Name'] and args.vtables)) + + exported_data = [s['Name'] for s in syms if is_data_symbol(s)] + if exported_data: + # TODO: we can generate wrappers for const data without relocations (or only code relocations) + warn(f"library '{input_name}' contains data symbols which won't be intercepted: " + + ', '.join(exported_data)) + + # Collect functions + # TODO: warn if user-specified functions are missing + + orig_funs = filter(lambda s: s['Type'] == 'FUNC', syms) + + all_funs = set() + warn_versioned = False + for s in orig_funs: + if not s['Default']: + # TODO: support versions + if not warn_versioned: + warn(f"library {input_name} contains versioned symbols which are NYI") + warn_versioned = True + if verbose: + print(f"Skipping versioned symbol {s['Name']}") + continue + all_funs.add(s['Name']) + + if funs is None: + funs = sorted(list(all_funs)) + if not funs and not quiet: + warn(f"no public functions were found in {input_name}") + else: + missing_funs = [name for name in funs if name not in all_funs] + if missing_funs: + warn("some user-specified functions are not present in library: " + ', '.join(missing_funs)) + funs = [name for name in funs if name in all_funs] + + if verbose: + print("Exported functions:") + for i, fun in enumerate(funs): + print(f" {i}: {fun}") + + # Collect vtables + + if args.vtables: + cls_tables = {} + cls_syms = {} + + for s in syms: + m = re.match(r'^(vtable|typeinfo|typeinfo name) for (.*)', s['Demangled Name']) + if m is not None and is_exported(s): + typ, cls = m.groups() + name = s['Name'] + cls_tables.setdefault(cls, {})[typ] = name + cls_syms[name] = s + + if verbose: + print("Exported classes:") + for cls, _ in sorted(cls_tables.items()): + print(f" {cls}") + + secs = collect_sections(input_name) + if verbose: + print("Sections:") + for sec in secs: + print(f" {sec['Name']}: [{sec['Address']:x}, {sec['Address'] + sec['Size']:x}), " + f"at {sec['Off']:x}") + + bites = read_unrelocated_data(input_name, cls_syms, secs) + + rels = collect_relocs(input_name) + if verbose: + print("Relocs:") + for rel in rels: + sym_add = rel['Symbol\'s Name + Addend'] + print(f" {rel['Offset']}: {sym_add}") + + cls_data = collect_relocated_data(cls_syms, bites, rels, ptr_size, symbol_reloc_types) + if verbose: + print("Class data:") + for name, data in sorted(cls_data.items()): + demangled_name = cls_syms[name]['Demangled Name'] + print(f" {name} ({demangled_name}):") + for typ, val in data: + print(" " + str(val if typ != 'reloc' else val['Symbol\'s Name + Addend'])) + + # Generate assembly code + + suffix = os.path.basename(input_name) + lib_suffix = re.sub(r'[^a-zA-Z_0-9]+', '_', suffix) + + tramp_file = f'{suffix}.tramp.S' + with open(os.path.join(outdir, tramp_file), 'w') as f: + if not quiet: + print(f"Generating {tramp_file}...") + with open(target_dir + '/table.S.tpl', 'r') as t: + table_text = string.Template(t.read()).substitute( + lib_suffix=lib_suffix, + table_size=ptr_size*(len(funs) + 1)) + f.write(table_text) + + with open(target_dir + '/trampoline.S.tpl', 'r') as t: + tramp_tpl = string.Template(t.read()) + + for i, name in enumerate(funs): + tramp_text = tramp_tpl.substitute( + lib_suffix=lib_suffix, + sym=args.symbol_prefix + name, + offset=i*ptr_size, + number=i) + f.write(tramp_text) + + # Generate C code + + init_file = f'{suffix}.init.c' + with open(os.path.join(outdir, init_file), 'w') as f: + if not quiet: + print(f"Generating {init_file}...") + with open(os.path.join(root, 'arch/common/init.c.tpl'), 'r') as t: + if funs: + sym_names = ',\n '.join(f'"{name}"' for name in funs) + ',' + else: + sym_names = '' + init_text = string.Template(t.read()).substitute( + lib_suffix=lib_suffix, + load_name=load_name, + dlopen_callback=dlopen_callback, + dlsym_callback=dlsym_callback, + has_dlopen_callback=int(bool(dlopen_callback)), + has_dlsym_callback=int(bool(dlsym_callback)), + no_dlopen=int(not dlopen), + lazy_load=int(lazy_load), + sym_names=sym_names) + f.write(init_text) + if args.vtables: + vtable_text = generate_vtables(cls_tables, cls_syms, cls_data) + f.write(vtable_text) + +if __name__ == '__main__': + main() diff --git a/source/lib/CMakeLists.txt b/source/lib/CMakeLists.txt index 0f5bdb73fb..1631eb8c35 100644 --- a/source/lib/CMakeLists.txt +++ b/source/lib/CMakeLists.txt @@ -13,7 +13,8 @@ if(USE_CUDA_TOOLKIT) add_definitions("-DGOOGLE_CUDA") add_subdirectory(src/gpu) set(EXTRA_LIBS ${EXTRA_LIBS} deepmd_op_cuda) - target_link_libraries(${libname} INTERFACE deepmd_dyn_cudart ${EXTRA_LIBS}) + target_link_libraries(${libname} PUBLIC deepmd_dyn_cudart) + target_link_libraries(${libname} INTERFACE ${EXTRA_LIBS}) # gpu_cuda.h target_include_directories( ${libname} PUBLIC $ diff --git a/source/lib/src/gpu/cudart/CMakeLists.txt b/source/lib/src/gpu/cudart/CMakeLists.txt index e612ad63ed..0df3f6bda8 100644 --- a/source/lib/src/gpu/cudart/CMakeLists.txt +++ b/source/lib/src/gpu/cudart/CMakeLists.txt @@ -1,7 +1,30 @@ -add_library(deepmd_dyn_cudart SHARED cudart_stub.cc) +enable_language(C ASM) +# Python is usually installed in every Linux distribution... +find_package( + Python3 + COMPONENTS Interpreter + REQUIRED) +get_property( + CUDART_LOCATION + TARGET CUDA::cudart + PROPERTY IMPORTED_LOCATION) +execute_process( + COMMAND + ${Python3_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../3rdparty/implib/implib-gen.py + ${CUDART_LOCATION} --target ${CMAKE_SYSTEM_PROCESSOR} --dlopen-callback + DP_cudart_dlopen --dlsym-callback DP_cudart_dlsym COMMAND_ERROR_IS_FATAL ANY + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + +file(GLOB CUDA_STUB_SRC ${CMAKE_CURRENT_BINARY_DIR}/*.tramp.S + ${CMAKE_CURRENT_BINARY_DIR}/*.init.c) + +add_library(deepmd_dyn_cudart SHARED cudart_stub.cc ${CUDA_STUB_SRC}) target_include_directories(deepmd_dyn_cudart PUBLIC ${CUDAToolkit_INCLUDE_DIRS}) -set_target_properties(deepmd_dyn_cudart PROPERTIES INSTALL_RPATH - "${CUDAToolkit_LIBRARY_DIR}") +set_target_properties( + deepmd_dyn_cudart PROPERTIES INSTALL_RPATH "${CUDAToolkit_LIBRARY_DIR}" + BUILD_RPATH "${CUDAToolkit_LIBRARY_DIR}") +target_compile_definitions(deepmd_dyn_cudart PRIVATE IMPLIB_EXPORT_SHIMS) if(BUILD_CPP_IF AND NOT BUILD_PY_IF) install( TARGETS deepmd_dyn_cudart diff --git a/source/lib/src/gpu/cudart/cuda_runtime_10_0.inc b/source/lib/src/gpu/cudart/cuda_runtime_10_0.inc deleted file mode 100644 index 6810c05d67..0000000000 --- a/source/lib/src/gpu/cudart/cuda_runtime_10_0.inc +++ /dev/null @@ -1,1846 +0,0 @@ -// Auto-generated, do not edit. - -extern "C" { - -extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceReset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, - size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaDeviceGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaDeviceGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int *); - static auto func_ptr = - LoadSymbol("cudaDeviceGetStreamPriorityRange"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(leastPriority, greatestPriority); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaDeviceSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig *); - static auto func_ptr = LoadSymbol("cudaDeviceGetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaDeviceSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetByPCIBusId(int *device, const char *pciBusId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const char *); - static auto func_ptr = LoadSymbol("cudaDeviceGetByPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, pciBusId); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, - int len, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(char *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pciBusId, len, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcEventHandle_t *, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaIpcGetEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, cudaIpcEventHandle_t); - static auto func_ptr = LoadSymbol("cudaIpcOpenEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, handle); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcMemHandle_t *, void *); - static auto func_ptr = LoadSymbol("cudaIpcGetMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle( - void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaIpcMemHandle_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaIpcOpenMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, handle, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaIpcCloseMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadExit(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadExit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetLimit(enum cudaLimit limit, size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaThreadSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaThreadGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaThreadGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaThreadSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaGetLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaPeekAtLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaPeekAtLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorName(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorName"); - if (!func_ptr) return "cudaGetErrorName symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorString(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorString"); - if (!func_ptr) return "cudaGetErrorString symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceCount(int *count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceCount"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaDeviceProp *, int); - static auto func_ptr = LoadSymbol("cudaGetDeviceProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(prop, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceAttr, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, - int srcDevice, int dstDevice) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceP2PAttr, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetP2PAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, srcDevice, dstDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaChooseDevice(int *device, const struct cudaDeviceProp *prop) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const struct cudaDeviceProp *); - static auto func_ptr = LoadSymbol("cudaChooseDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, prop); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDevice(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaSetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDevice(int *device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetValidDevices(int *device_arr, - int len) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int); - static auto func_ptr = LoadSymbol("cudaSetValidDevices"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device_arr, len); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDeviceFlags(unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int); - static auto func_ptr = LoadSymbol("cudaSetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDeviceFlags(unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamCreate(cudaStream_t *pStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *); - static auto func_ptr = LoadSymbol("cudaStreamCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithPriority(cudaStream_t *pStream, unsigned int flags, - int priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int, int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetPriority(cudaStream_t hStream, int *priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, int *); - static auto func_ptr = LoadSymbol("cudaStreamGetPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, unsigned int *); - static auto func_ptr = LoadSymbol("cudaStreamGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamDestroy(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent( - cudaStream_t stream, cudaEvent_t event, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, cudaEvent_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamWaitEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, event, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, - void *userData, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamCallback_t, - void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAddCallback"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, callback, userData, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamSynchronize(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, - size_t length __dv(0), - unsigned int flags __dv(cudaMemAttachSingle)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAttachMemAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, devPtr, length, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamBeginCapture(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamBeginCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaStreamEndCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamIsCapturing( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureStatus *); - static auto func_ptr = LoadSymbol("cudaStreamIsCapturing"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventCreate(cudaEvent_t *event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaEventCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaEventRecord"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventQuery(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventSynchronize(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventDestroy(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventElapsedTime(float *ms, - cudaEvent_t start, - cudaEvent_t end) { - using FuncPtr = cudaError_t(CUDARTAPI *)(float *, cudaEvent_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventElapsedTime"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ms, start, end); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalMemory( - cudaExternalMemory_t *extMem_out, - const struct cudaExternalMemoryHandleDesc *memHandleDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaExternalMemory_t *, const struct cudaExternalMemoryHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem_out, memHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedBuffer( - void **devPtr, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryBufferDesc *bufferDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaExternalMemory_t, - const struct cudaExternalMemoryBufferDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedBuffer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, extMem, bufferDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmap, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryMipmappedArrayDesc *mipmapDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, cudaExternalMemory_t, - const struct cudaExternalMemoryMipmappedArrayDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmap, extMem, mipmapDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalMemory(cudaExternalMemory_t extMem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalMemory_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalSemaphore( - cudaExternalSemaphore_t *extSem_out, - const struct cudaExternalSemaphoreHandleDesc *semHandleDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem_out, semHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreSignalParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreSignalParams *, - unsigned int, cudaStream_t); - static auto func_ptr = - LoadSymbol("cudaSignalExternalSemaphoresAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreWaitParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreWaitParams *, - unsigned int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaWaitExternalSemaphoresAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem); -} - -extern __host__ cudaError_t CUDARTAPI -cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel( - const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchCooperativeKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernelMultiDevice( - struct cudaLaunchParams *launchParamsList, unsigned int numDevices, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaLaunchParams *, - unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaLaunchCooperativeKernelMultiDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(launchParamsList, numDevices, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetCacheConfig(const void *func, enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaFuncSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, cacheConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetSharedMemConfig(const void *func, enum cudaSharedMemConfig config) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaFuncSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, config); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaFuncAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaFuncGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attr, func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncAttribute, int); - static auto func_ptr = LoadSymbol("cudaFuncSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, attr, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForDevice(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForHost(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchHostFunc(cudaStream_t stream, - cudaHostFn_t fn, - void *userData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaHostFn_t, void *); - static auto func_ptr = LoadSymbol("cudaLaunchHostFunc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, fn, userData); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, - int blockSize, - size_t dynamicSMemSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxActiveBlocksPerMultiprocessor"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, - const void *func, - int blockSize, - size_t dynamicSMemSize, - unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t, unsigned int); - static auto func_ptr = LoadSymbol( - "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaConfigureCall(dim3 gridDim, dim3 blockDim, size_t sharedMem __dv(0), - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(dim3, dim3, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaConfigureCall"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(gridDim, blockDim, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetupArgument(const void *arg, - size_t size, - size_t offset) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaSetupArgument"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(arg, size, offset); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunch(const void *func) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *); - static auto func_ptr = LoadSymbol("cudaLaunch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMallocManaged( - void **devPtr, size_t size, unsigned int flags __dv(cudaMemAttachGlobal)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocManaged"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMalloc(void **devPtr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMalloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocHost(void **ptr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMallocHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocPitch(void **devPtr, - size_t *pitch, - size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMallocPitch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocArray( - cudaArray_t *array, const struct cudaChannelFormatDesc *desc, size_t width, - size_t height __dv(0), unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - size_t, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, width, height, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFree(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFree"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeHost(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFreeHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeArray(cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t); - static auto func_ptr = LoadSymbol("cudaFreeArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t); - static auto func_ptr = LoadSymbol("cudaFreeMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostAlloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pHost, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostRegister(void *ptr, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostRegister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostUnregister(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaHostUnregister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaHostGetDevicePointer(void **pDevice, void *pHost, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostGetDevicePointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pDevice, pHost, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostGetFlags(unsigned int *pFlags, - void *pHost) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *, void *); - static auto func_ptr = LoadSymbol("cudaHostGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pFlags, pHost); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3D(struct cudaPitchedPtr *pitchedDevPtr, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr *, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMalloc3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, extent); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3DArray(cudaArray_t *array, const struct cudaChannelFormatDesc *desc, - struct cudaExtent extent, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int); - static auto func_ptr = LoadSymbol("cudaMalloc3DArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, extent, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, - const struct cudaChannelFormatDesc *desc, struct cudaExtent extent, - unsigned int numLevels, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, desc, extent, numLevels, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetMipmappedArrayLevel( - cudaArray_t *levelArray, cudaMipmappedArray_const_t mipmappedArray, - unsigned int level) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaMipmappedArray_const_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGetMipmappedArrayLevel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(levelArray, mipmappedArray, level); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3D(const struct cudaMemcpy3DParms *p) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync( - const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync( - const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemGetInfo(size_t *free, - size_t *total) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaMemGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(free, total); -} - -extern __host__ cudaError_t CUDARTAPI -cudaArrayGetInfo(struct cudaChannelFormatDesc *desc, struct cudaExtent *extent, - unsigned int *flags, cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - struct cudaExtent *, unsigned int *, - cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, extent, flags, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, - size_t count, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeer(void *dst, int dstDevice, - const void *src, - int srcDevice, - size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, int, const void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t, size_t, size_t, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, cudaArray_const_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, - const void *src, - size_t spitch, size_t width, - size_t height, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, size_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, - size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - cudaArray_const_t, size_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol( - const void *symbol, const void *src, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol( - void *dst, const void *symbol, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemcpyAsync(void *dst, const void *src, size_t count, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, - size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, const void *, int, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromArrayAsync( - void *dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync( - void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, - size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - const void *, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, - size_t, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync( - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync( - void *dst, const void *symbol, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, - size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, - int value, size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemset2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset3D( - struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMemset3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync( - void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemsetAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, - size_t height, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, - struct cudaExtent extent, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, - struct cudaExtent, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolAddress(void **devPtr, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolAddress"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolSize(size_t *size, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(size, symbol); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, size_t, int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemPrefetchAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, dstDevice, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, - enum cudaMemoryAdvise, int); - static auto func_ptr = LoadSymbol("cudaMemAdvise"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, advice, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute( - void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, - const void *devPtr, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, size_t, enum cudaMemRangeAttribute, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSize, attribute, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes( - void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, - size_t numAttributes, const void *devPtr, size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, enum cudaMemRangeAttribute *, - size_t, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSizes, attributes, numAttributes, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaPointerGetAttributes( - struct cudaPointerAttributes *attributes, const void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPointerAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaPointerGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attributes, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceCanAccessPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(canAccessPeer, device, peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, unsigned int); - static auto func_ptr = LoadSymbol("cudaDeviceEnablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceDisablePeerAccess(int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceDisablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnregisterResource"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceSetMapFlags( - cudaGraphicsResource_t resource, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphicsResourceSetMapFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsMapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsMapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnmapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnmapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedPointer( - void **devPtr, size_t *size, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsSubResourceGetMappedArray( - cudaArray_t *array, cudaGraphicsResource_t resource, - unsigned int arrayIndex, unsigned int mipLevel) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaGraphicsResource_t, unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaGraphicsSubResourceGetMappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, resource, arrayIndex, mipLevel); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsResourceGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetChannelDesc( - struct cudaChannelFormatDesc *desc, cudaArray_const_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - cudaArray_const_t); - static auto func_ptr = LoadSymbol("cudaGetChannelDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, array); -} - -extern __host__ struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc( - int x, int y, int z, int w, enum cudaChannelFormatKind f) { - using FuncPtr = struct cudaChannelFormatDesc(CUDARTAPI *)( - int, int, int, int, enum cudaChannelFormatKind); - static auto func_ptr = LoadSymbol("cudaCreateChannelDesc"); - if (!func_ptr) { - return cudaChannelFormatDesc{cudaChannelFormatKind(-1), 0, 0, 0}; - } - return func_ptr(x, y, z, w, f); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindTexture( - size_t *offset, const struct textureReference *texref, const void *devPtr, - const struct cudaChannelFormatDesc *desc, size_t size __dv(UINT_MAX)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, size); -} - -extern __host__ cudaError_t CUDARTAPI -cudaBindTexture2D(size_t *offset, const struct textureReference *texref, - const void *devPtr, const struct cudaChannelFormatDesc *desc, - size_t width, size_t height, size_t pitch) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, width, height, pitch); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindTextureToArray( - const struct textureReference *texref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, array, desc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaBindTextureToMipmappedArray(const struct textureReference *texref, - cudaMipmappedArray_const_t mipmappedArray, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaMipmappedArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, mipmappedArray, desc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUnbindTexture(const struct textureReference *texref) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaUnbindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureAlignmentOffset( - size_t *offset, const struct textureReference *texref) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(size_t *, const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaGetTextureAlignmentOffset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureReference( - const struct textureReference **texref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct textureReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetTextureReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindSurfaceToArray( - const struct surfaceReference *surfref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct surfaceReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindSurfaceToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, array, desc); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceReference( - const struct surfaceReference **surfref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct surfaceReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSurfaceReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject( - cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, - const struct cudaTextureDesc *pTexDesc, - const struct cudaResourceViewDesc *pResViewDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaTextureObject_t *, const struct cudaResourceDesc *, - const struct cudaTextureDesc *, const struct cudaResourceViewDesc *); - static auto func_ptr = LoadSymbol("cudaCreateTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexObject, pResDesc, pTexDesc, pResViewDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyTextureObject(cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaDestroyTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc( - struct cudaTextureDesc *pTexDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaTextureDesc *, cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaGetTextureObjectTextureDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceViewDesc( - struct cudaResourceViewDesc *pResViewDesc, cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaResourceViewDesc *, - cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceViewDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResViewDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateSurfaceObject( - cudaSurfaceObject_t *pSurfObject, const struct cudaResourceDesc *pResDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t *, - const struct cudaResourceDesc *); - static auto func_ptr = LoadSymbol("cudaCreateSurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pSurfObject, pResDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t); - static auto func_ptr = LoadSymbol("cudaDestroySurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaSurfaceObject_t surfObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaSurfaceObject_t); - static auto func_ptr = - LoadSymbol("cudaGetSurfaceObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaDriverGetVersion(int *driverVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaDriverGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(driverVersion); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaRuntimeGetVersion(int *runtimeVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaRuntimeGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(runtimeVersion); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphCreate(cudaGraph_t *pGraph, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraph, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddKernelNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - cudaGraphNode_t *, size_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddKernelNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetParams( - cudaGraphNode_t node, struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParams( - cudaGraphNode_t node, const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddMemcpyNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemcpy3DParms *pCopyParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - cudaGraphNode_t *, size_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pCopyParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeGetParams( - cudaGraphNode_t node, struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParams( - cudaGraphNode_t node, const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddMemsetNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemsetParams *pMemsetParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - cudaGraphNode_t *, size_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemsetNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pMemsetParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeGetParams( - cudaGraphNode_t node, struct cudaMemsetParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeSetParams( - cudaGraphNode_t node, const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddHostNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - cudaGraphNode_t *, size_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddHostNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeGetParams( - cudaGraphNode_t node, struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeSetParams( - cudaGraphNode_t node, const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddChildGraphNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaGraph_t childGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, cudaGraphNode_t *, size_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphAddChildGraphNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - childGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaGraphChildGraphNodeGetGraph"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddEmptyNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - cudaGraphNode_t *pDependencies, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEmptyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphClone(cudaGraph_t *pGraphClone, cudaGraph_t originalGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphClone, originalGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeFindInClone(cudaGraphNode_t *pNode, cudaGraphNode_t originalNode, - cudaGraph_t clonedGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphNodeFindInClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pNode, originalNode, clonedGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeGetType(cudaGraphNode_t node, enum cudaGraphNodeType *pType) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaGraphNodeType *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetType"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pType); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetNodes(cudaGraph_t graph, - cudaGraphNode_t *nodes, - size_t *numNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, nodes, numNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetRootNodes( - cudaGraph_t graph, cudaGraphNode_t *pRootNodes, size_t *pNumRootNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetRootNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, pRootNodes, pNumRootNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetEdges(cudaGraph_t graph, - cudaGraphNode_t *from, - cudaGraphNode_t *to, - size_t *numEdges) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, - cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetEdges"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numEdges); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependencies( - cudaGraphNode_t node, cudaGraphNode_t *pDependencies, - size_t *pNumDependencies) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependencies, pNumDependencies); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependentNodes( - cudaGraphNode_t node, cudaGraphNode_t *pDependentNodes, - size_t *pNumDependentNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependentNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependentNodes, pNumDependentNodes); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddDependencies(cudaGraph_t graph, cudaGraphNode_t *from, - cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, - cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphRemoveDependencies(cudaGraph_t graph, cudaGraphNode_t *from, - cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, - cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphRemoveDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphDestroyNode(cudaGraphNode_t node) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiate( - cudaGraphExec_t *pGraphExec, cudaGraph_t graph, cudaGraphNode_t *pErrorNode, - char *pLogBuffer, size_t bufferSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - cudaGraphNode_t *, char *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphInstantiate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, pErrorNode, pLogBuffer, bufferSize); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphLaunch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecDestroy(cudaGraphExec_t graphExec) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t); - static auto func_ptr = LoadSymbol("cudaGraphExecDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDestroy(cudaGraph_t graph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetExportTable( - const void **ppExportTable, const cudaUUID_t *pExportTableId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void **, const cudaUUID_t *); - static auto func_ptr = LoadSymbol("cudaGetExportTable"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ppExportTable, pExportTableId); -} - -} // extern "C" diff --git a/source/lib/src/gpu/cudart/cuda_runtime_10_1.inc b/source/lib/src/gpu/cudart/cuda_runtime_10_1.inc deleted file mode 100644 index d076cc4ac3..0000000000 --- a/source/lib/src/gpu/cudart/cuda_runtime_10_1.inc +++ /dev/null @@ -1,1854 +0,0 @@ -// Auto-generated, do not edit. - -extern "C" { - -extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceReset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, - size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaDeviceGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaDeviceGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int *); - static auto func_ptr = - LoadSymbol("cudaDeviceGetStreamPriorityRange"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(leastPriority, greatestPriority); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaDeviceSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig *); - static auto func_ptr = LoadSymbol("cudaDeviceGetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaDeviceSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetByPCIBusId(int *device, const char *pciBusId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const char *); - static auto func_ptr = LoadSymbol("cudaDeviceGetByPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, pciBusId); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, - int len, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(char *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pciBusId, len, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcEventHandle_t *, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaIpcGetEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, cudaIpcEventHandle_t); - static auto func_ptr = LoadSymbol("cudaIpcOpenEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, handle); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcMemHandle_t *, void *); - static auto func_ptr = LoadSymbol("cudaIpcGetMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle( - void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaIpcMemHandle_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaIpcOpenMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, handle, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaIpcCloseMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadExit(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadExit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetLimit(enum cudaLimit limit, size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaThreadSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaThreadGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaThreadGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaThreadSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaGetLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaPeekAtLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaPeekAtLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorName(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorName"); - if (!func_ptr) return "cudaGetErrorName symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorString(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorString"); - if (!func_ptr) return "cudaGetErrorString symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceCount(int *count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceCount"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaDeviceProp *, int); - static auto func_ptr = LoadSymbol("cudaGetDeviceProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(prop, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceAttr, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, - int srcDevice, int dstDevice) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceP2PAttr, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetP2PAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, srcDevice, dstDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaChooseDevice(int *device, const struct cudaDeviceProp *prop) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const struct cudaDeviceProp *); - static auto func_ptr = LoadSymbol("cudaChooseDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, prop); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDevice(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaSetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDevice(int *device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetValidDevices(int *device_arr, - int len) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int); - static auto func_ptr = LoadSymbol("cudaSetValidDevices"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device_arr, len); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDeviceFlags(unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int); - static auto func_ptr = LoadSymbol("cudaSetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDeviceFlags(unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamCreate(cudaStream_t *pStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *); - static auto func_ptr = LoadSymbol("cudaStreamCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithPriority(cudaStream_t *pStream, unsigned int flags, - int priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int, int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetPriority(cudaStream_t hStream, int *priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, int *); - static auto func_ptr = LoadSymbol("cudaStreamGetPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, unsigned int *); - static auto func_ptr = LoadSymbol("cudaStreamGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamDestroy(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent( - cudaStream_t stream, cudaEvent_t event, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, cudaEvent_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamWaitEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, event, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, - void *userData, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamCallback_t, - void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAddCallback"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, callback, userData, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamSynchronize(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, - size_t length __dv(0), - unsigned int flags __dv(cudaMemAttachSingle)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAttachMemAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, devPtr, length, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamBeginCapture(cudaStream_t stream, enum cudaStreamCaptureMode mode) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureMode); - static auto func_ptr = LoadSymbol("cudaStreamBeginCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaThreadExchangeStreamCaptureMode(enum cudaStreamCaptureMode *mode) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaStreamCaptureMode *); - static auto func_ptr = - LoadSymbol("cudaThreadExchangeStreamCaptureMode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaStreamEndCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamIsCapturing( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureStatus *); - static auto func_ptr = LoadSymbol("cudaStreamIsCapturing"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus, - unsigned long long *pId) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaStream_t, enum cudaStreamCaptureStatus *, unsigned long long *); - static auto func_ptr = LoadSymbol("cudaStreamGetCaptureInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus, pId); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventCreate(cudaEvent_t *event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaEventCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaEventRecord"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventQuery(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventSynchronize(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventDestroy(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventElapsedTime(float *ms, - cudaEvent_t start, - cudaEvent_t end) { - using FuncPtr = cudaError_t(CUDARTAPI *)(float *, cudaEvent_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventElapsedTime"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ms, start, end); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalMemory( - cudaExternalMemory_t *extMem_out, - const struct cudaExternalMemoryHandleDesc *memHandleDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaExternalMemory_t *, const struct cudaExternalMemoryHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem_out, memHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedBuffer( - void **devPtr, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryBufferDesc *bufferDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaExternalMemory_t, - const struct cudaExternalMemoryBufferDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedBuffer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, extMem, bufferDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmap, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryMipmappedArrayDesc *mipmapDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, cudaExternalMemory_t, - const struct cudaExternalMemoryMipmappedArrayDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmap, extMem, mipmapDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalMemory(cudaExternalMemory_t extMem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalMemory_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalSemaphore( - cudaExternalSemaphore_t *extSem_out, - const struct cudaExternalSemaphoreHandleDesc *semHandleDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem_out, semHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreSignalParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreSignalParams *, - unsigned int, cudaStream_t); - static auto func_ptr = - LoadSymbol("cudaSignalExternalSemaphoresAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreWaitParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreWaitParams *, - unsigned int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaWaitExternalSemaphoresAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem); -} - -extern __host__ cudaError_t CUDARTAPI -cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel( - const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchCooperativeKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernelMultiDevice( - struct cudaLaunchParams *launchParamsList, unsigned int numDevices, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaLaunchParams *, - unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaLaunchCooperativeKernelMultiDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(launchParamsList, numDevices, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetCacheConfig(const void *func, enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaFuncSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, cacheConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetSharedMemConfig(const void *func, enum cudaSharedMemConfig config) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaFuncSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, config); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaFuncAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaFuncGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attr, func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncAttribute, int); - static auto func_ptr = LoadSymbol("cudaFuncSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, attr, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForDevice(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForHost(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchHostFunc(cudaStream_t stream, - cudaHostFn_t fn, - void *userData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaHostFn_t, void *); - static auto func_ptr = LoadSymbol("cudaLaunchHostFunc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, fn, userData); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, - int blockSize, - size_t dynamicSMemSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxActiveBlocksPerMultiprocessor"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, - const void *func, - int blockSize, - size_t dynamicSMemSize, - unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t, unsigned int); - static auto func_ptr = LoadSymbol( - "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMallocManaged( - void **devPtr, size_t size, unsigned int flags __dv(cudaMemAttachGlobal)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocManaged"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMalloc(void **devPtr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMalloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocHost(void **ptr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMallocHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocPitch(void **devPtr, - size_t *pitch, - size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMallocPitch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocArray( - cudaArray_t *array, const struct cudaChannelFormatDesc *desc, size_t width, - size_t height __dv(0), unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - size_t, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, width, height, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFree(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFree"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeHost(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFreeHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeArray(cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t); - static auto func_ptr = LoadSymbol("cudaFreeArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t); - static auto func_ptr = LoadSymbol("cudaFreeMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostAlloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pHost, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostRegister(void *ptr, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostRegister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostUnregister(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaHostUnregister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaHostGetDevicePointer(void **pDevice, void *pHost, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostGetDevicePointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pDevice, pHost, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostGetFlags(unsigned int *pFlags, - void *pHost) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *, void *); - static auto func_ptr = LoadSymbol("cudaHostGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pFlags, pHost); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3D(struct cudaPitchedPtr *pitchedDevPtr, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr *, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMalloc3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, extent); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3DArray(cudaArray_t *array, const struct cudaChannelFormatDesc *desc, - struct cudaExtent extent, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int); - static auto func_ptr = LoadSymbol("cudaMalloc3DArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, extent, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, - const struct cudaChannelFormatDesc *desc, struct cudaExtent extent, - unsigned int numLevels, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, desc, extent, numLevels, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetMipmappedArrayLevel( - cudaArray_t *levelArray, cudaMipmappedArray_const_t mipmappedArray, - unsigned int level) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaMipmappedArray_const_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGetMipmappedArrayLevel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(levelArray, mipmappedArray, level); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3D(const struct cudaMemcpy3DParms *p) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync( - const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync( - const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemGetInfo(size_t *free, - size_t *total) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaMemGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(free, total); -} - -extern __host__ cudaError_t CUDARTAPI -cudaArrayGetInfo(struct cudaChannelFormatDesc *desc, struct cudaExtent *extent, - unsigned int *flags, cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - struct cudaExtent *, unsigned int *, - cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, extent, flags, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, - size_t count, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeer(void *dst, int dstDevice, - const void *src, - int srcDevice, - size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, int, const void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, - const void *src, - size_t spitch, size_t width, - size_t height, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, size_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, - size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - cudaArray_const_t, size_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol( - const void *symbol, const void *src, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol( - void *dst, const void *symbol, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemcpyAsync(void *dst, const void *src, size_t count, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, - size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, const void *, int, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync( - void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, - size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - const void *, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, - size_t, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync( - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync( - void *dst, const void *symbol, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, - size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, - int value, size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemset2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset3D( - struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMemset3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync( - void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemsetAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, - size_t height, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, - struct cudaExtent extent, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, - struct cudaExtent, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolAddress(void **devPtr, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolAddress"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolSize(size_t *size, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(size, symbol); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, size_t, int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemPrefetchAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, dstDevice, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, - enum cudaMemoryAdvise, int); - static auto func_ptr = LoadSymbol("cudaMemAdvise"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, advice, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute( - void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, - const void *devPtr, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, size_t, enum cudaMemRangeAttribute, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSize, attribute, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes( - void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, - size_t numAttributes, const void *devPtr, size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, enum cudaMemRangeAttribute *, - size_t, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSizes, attributes, numAttributes, devPtr, count); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t, size_t, size_t, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, cudaArray_const_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind, stream); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArrayAsync(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaPointerGetAttributes( - struct cudaPointerAttributes *attributes, const void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPointerAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaPointerGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attributes, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceCanAccessPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(canAccessPeer, device, peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, unsigned int); - static auto func_ptr = LoadSymbol("cudaDeviceEnablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceDisablePeerAccess(int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceDisablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnregisterResource"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceSetMapFlags( - cudaGraphicsResource_t resource, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphicsResourceSetMapFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsMapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsMapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnmapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnmapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedPointer( - void **devPtr, size_t *size, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsSubResourceGetMappedArray( - cudaArray_t *array, cudaGraphicsResource_t resource, - unsigned int arrayIndex, unsigned int mipLevel) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaGraphicsResource_t, unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaGraphicsSubResourceGetMappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, resource, arrayIndex, mipLevel); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsResourceGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindTexture( - size_t *offset, const struct textureReference *texref, const void *devPtr, - const struct cudaChannelFormatDesc *desc, size_t size __dv(UINT_MAX)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, size); -} - -extern __host__ cudaError_t CUDARTAPI -cudaBindTexture2D(size_t *offset, const struct textureReference *texref, - const void *devPtr, const struct cudaChannelFormatDesc *desc, - size_t width, size_t height, size_t pitch) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, width, height, pitch); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindTextureToArray( - const struct textureReference *texref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, array, desc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaBindTextureToMipmappedArray(const struct textureReference *texref, - cudaMipmappedArray_const_t mipmappedArray, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaMipmappedArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, mipmappedArray, desc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUnbindTexture(const struct textureReference *texref) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaUnbindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureAlignmentOffset( - size_t *offset, const struct textureReference *texref) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(size_t *, const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaGetTextureAlignmentOffset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureReference( - const struct textureReference **texref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct textureReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetTextureReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindSurfaceToArray( - const struct surfaceReference *surfref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct surfaceReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindSurfaceToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, array, desc); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceReference( - const struct surfaceReference **surfref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct surfaceReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSurfaceReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetChannelDesc( - struct cudaChannelFormatDesc *desc, cudaArray_const_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - cudaArray_const_t); - static auto func_ptr = LoadSymbol("cudaGetChannelDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, array); -} - -extern __host__ struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc( - int x, int y, int z, int w, enum cudaChannelFormatKind f) { - using FuncPtr = struct cudaChannelFormatDesc(CUDARTAPI *)( - int, int, int, int, enum cudaChannelFormatKind); - static auto func_ptr = LoadSymbol("cudaCreateChannelDesc"); - if (!func_ptr) { - return cudaChannelFormatDesc{cudaChannelFormatKind(-1), 0, 0, 0}; - } - return func_ptr(x, y, z, w, f); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject( - cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, - const struct cudaTextureDesc *pTexDesc, - const struct cudaResourceViewDesc *pResViewDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaTextureObject_t *, const struct cudaResourceDesc *, - const struct cudaTextureDesc *, const struct cudaResourceViewDesc *); - static auto func_ptr = LoadSymbol("cudaCreateTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexObject, pResDesc, pTexDesc, pResViewDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyTextureObject(cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaDestroyTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc( - struct cudaTextureDesc *pTexDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaTextureDesc *, cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaGetTextureObjectTextureDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceViewDesc( - struct cudaResourceViewDesc *pResViewDesc, cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaResourceViewDesc *, - cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceViewDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResViewDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateSurfaceObject( - cudaSurfaceObject_t *pSurfObject, const struct cudaResourceDesc *pResDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t *, - const struct cudaResourceDesc *); - static auto func_ptr = LoadSymbol("cudaCreateSurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pSurfObject, pResDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t); - static auto func_ptr = LoadSymbol("cudaDestroySurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaSurfaceObject_t surfObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaSurfaceObject_t); - static auto func_ptr = - LoadSymbol("cudaGetSurfaceObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaDriverGetVersion(int *driverVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaDriverGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(driverVersion); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaRuntimeGetVersion(int *runtimeVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaRuntimeGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(runtimeVersion); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphCreate(cudaGraph_t *pGraph, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraph, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddKernelNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddKernelNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetParams( - cudaGraphNode_t node, struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParams( - cudaGraphNode_t node, const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemcpy3DParms *pCopyParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pCopyParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeGetParams( - cudaGraphNode_t node, struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParams( - cudaGraphNode_t node, const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemsetNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemsetParams *pMemsetParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemsetNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pMemsetParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeGetParams( - cudaGraphNode_t node, struct cudaMemsetParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeSetParams( - cudaGraphNode_t node, const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddHostNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddHostNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeGetParams( - cudaGraphNode_t node, struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeSetParams( - cudaGraphNode_t node, const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddChildGraphNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaGraph_t childGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphAddChildGraphNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - childGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaGraphChildGraphNodeGetGraph"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddEmptyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEmptyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphClone(cudaGraph_t *pGraphClone, cudaGraph_t originalGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphClone, originalGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeFindInClone(cudaGraphNode_t *pNode, cudaGraphNode_t originalNode, - cudaGraph_t clonedGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphNodeFindInClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pNode, originalNode, clonedGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeGetType(cudaGraphNode_t node, enum cudaGraphNodeType *pType) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaGraphNodeType *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetType"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pType); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetNodes(cudaGraph_t graph, - cudaGraphNode_t *nodes, - size_t *numNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, nodes, numNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetRootNodes( - cudaGraph_t graph, cudaGraphNode_t *pRootNodes, size_t *pNumRootNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetRootNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, pRootNodes, pNumRootNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetEdges(cudaGraph_t graph, - cudaGraphNode_t *from, - cudaGraphNode_t *to, - size_t *numEdges) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, - cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetEdges"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numEdges); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependencies( - cudaGraphNode_t node, cudaGraphNode_t *pDependencies, - size_t *pNumDependencies) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependencies, pNumDependencies); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependentNodes( - cudaGraphNode_t node, cudaGraphNode_t *pDependentNodes, - size_t *pNumDependentNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependentNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependentNodes, pNumDependentNodes); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphRemoveDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphDestroyNode(cudaGraphNode_t node) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiate( - cudaGraphExec_t *pGraphExec, cudaGraph_t graph, cudaGraphNode_t *pErrorNode, - char *pLogBuffer, size_t bufferSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - cudaGraphNode_t *, char *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphInstantiate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, pErrorNode, pLogBuffer, bufferSize); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecKernelNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphLaunch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecDestroy(cudaGraphExec_t graphExec) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t); - static auto func_ptr = LoadSymbol("cudaGraphExecDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDestroy(cudaGraph_t graph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetExportTable( - const void **ppExportTable, const cudaUUID_t *pExportTableId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void **, const cudaUUID_t *); - static auto func_ptr = LoadSymbol("cudaGetExportTable"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ppExportTable, pExportTableId); -} - -} // extern "C" diff --git a/source/lib/src/gpu/cudart/cuda_runtime_10_2.inc b/source/lib/src/gpu/cudart/cuda_runtime_10_2.inc deleted file mode 100644 index a5a5438b0e..0000000000 --- a/source/lib/src/gpu/cudart/cuda_runtime_10_2.inc +++ /dev/null @@ -1,1907 +0,0 @@ -// Auto-generated, do not edit. - -extern "C" { - -extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceReset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, - size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaDeviceGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaDeviceGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int *); - static auto func_ptr = - LoadSymbol("cudaDeviceGetStreamPriorityRange"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(leastPriority, greatestPriority); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaDeviceSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig *); - static auto func_ptr = LoadSymbol("cudaDeviceGetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaDeviceSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetByPCIBusId(int *device, const char *pciBusId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const char *); - static auto func_ptr = LoadSymbol("cudaDeviceGetByPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, pciBusId); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, - int len, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(char *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pciBusId, len, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcEventHandle_t *, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaIpcGetEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, cudaIpcEventHandle_t); - static auto func_ptr = LoadSymbol("cudaIpcOpenEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, handle); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcMemHandle_t *, void *); - static auto func_ptr = LoadSymbol("cudaIpcGetMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle( - void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaIpcMemHandle_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaIpcOpenMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, handle, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaIpcCloseMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadExit(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadExit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetLimit(enum cudaLimit limit, size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaThreadSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaThreadGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaThreadGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaThreadSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaGetLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaPeekAtLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaPeekAtLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorName(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorName"); - if (!func_ptr) return "cudaGetErrorName symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorString(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorString"); - if (!func_ptr) return "cudaGetErrorString symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceCount(int *count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceCount"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaDeviceProp *, int); - static auto func_ptr = LoadSymbol("cudaGetDeviceProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(prop, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceAttr, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetNvSciSyncAttributes( - void *nvSciSyncAttrList, int device, int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, int); - static auto func_ptr = - LoadSymbol("cudaDeviceGetNvSciSyncAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(nvSciSyncAttrList, device, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, - int srcDevice, int dstDevice) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceP2PAttr, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetP2PAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, srcDevice, dstDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaChooseDevice(int *device, const struct cudaDeviceProp *prop) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const struct cudaDeviceProp *); - static auto func_ptr = LoadSymbol("cudaChooseDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, prop); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDevice(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaSetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDevice(int *device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetValidDevices(int *device_arr, - int len) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int); - static auto func_ptr = LoadSymbol("cudaSetValidDevices"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device_arr, len); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDeviceFlags(unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int); - static auto func_ptr = LoadSymbol("cudaSetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDeviceFlags(unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamCreate(cudaStream_t *pStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *); - static auto func_ptr = LoadSymbol("cudaStreamCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithPriority(cudaStream_t *pStream, unsigned int flags, - int priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int, int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetPriority(cudaStream_t hStream, int *priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, int *); - static auto func_ptr = LoadSymbol("cudaStreamGetPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, unsigned int *); - static auto func_ptr = LoadSymbol("cudaStreamGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamDestroy(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent( - cudaStream_t stream, cudaEvent_t event, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, cudaEvent_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamWaitEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, event, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, - void *userData, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamCallback_t, - void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAddCallback"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, callback, userData, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamSynchronize(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, - size_t length __dv(0), - unsigned int flags __dv(cudaMemAttachSingle)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAttachMemAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, devPtr, length, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamBeginCapture(cudaStream_t stream, enum cudaStreamCaptureMode mode) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureMode); - static auto func_ptr = LoadSymbol("cudaStreamBeginCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaThreadExchangeStreamCaptureMode(enum cudaStreamCaptureMode *mode) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaStreamCaptureMode *); - static auto func_ptr = - LoadSymbol("cudaThreadExchangeStreamCaptureMode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaStreamEndCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamIsCapturing( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureStatus *); - static auto func_ptr = LoadSymbol("cudaStreamIsCapturing"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus, - unsigned long long *pId) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaStream_t, enum cudaStreamCaptureStatus *, unsigned long long *); - static auto func_ptr = LoadSymbol("cudaStreamGetCaptureInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus, pId); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventCreate(cudaEvent_t *event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaEventCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaEventRecord"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventQuery(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventSynchronize(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventDestroy(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventElapsedTime(float *ms, - cudaEvent_t start, - cudaEvent_t end) { - using FuncPtr = cudaError_t(CUDARTAPI *)(float *, cudaEvent_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventElapsedTime"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ms, start, end); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalMemory( - cudaExternalMemory_t *extMem_out, - const struct cudaExternalMemoryHandleDesc *memHandleDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaExternalMemory_t *, const struct cudaExternalMemoryHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem_out, memHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedBuffer( - void **devPtr, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryBufferDesc *bufferDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaExternalMemory_t, - const struct cudaExternalMemoryBufferDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedBuffer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, extMem, bufferDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmap, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryMipmappedArrayDesc *mipmapDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, cudaExternalMemory_t, - const struct cudaExternalMemoryMipmappedArrayDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmap, extMem, mipmapDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalMemory(cudaExternalMemory_t extMem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalMemory_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalSemaphore( - cudaExternalSemaphore_t *extSem_out, - const struct cudaExternalSemaphoreHandleDesc *semHandleDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem_out, semHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreSignalParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreSignalParams *, - unsigned int, cudaStream_t); - static auto func_ptr = - LoadSymbol("cudaSignalExternalSemaphoresAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreWaitParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreWaitParams *, - unsigned int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaWaitExternalSemaphoresAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem); -} - -extern __host__ cudaError_t CUDARTAPI -cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel( - const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchCooperativeKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernelMultiDevice( - struct cudaLaunchParams *launchParamsList, unsigned int numDevices, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaLaunchParams *, - unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaLaunchCooperativeKernelMultiDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(launchParamsList, numDevices, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetCacheConfig(const void *func, enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaFuncSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, cacheConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetSharedMemConfig(const void *func, enum cudaSharedMemConfig config) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaFuncSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, config); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaFuncAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaFuncGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attr, func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncAttribute, int); - static auto func_ptr = LoadSymbol("cudaFuncSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, attr, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForDevice(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForHost(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchHostFunc(cudaStream_t stream, - cudaHostFn_t fn, - void *userData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaHostFn_t, void *); - static auto func_ptr = LoadSymbol("cudaLaunchHostFunc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, fn, userData); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, - int blockSize, - size_t dynamicSMemSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxActiveBlocksPerMultiprocessor"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, - const void *func, - int blockSize, - size_t dynamicSMemSize, - unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t, unsigned int); - static auto func_ptr = LoadSymbol( - "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMallocManaged( - void **devPtr, size_t size, unsigned int flags __dv(cudaMemAttachGlobal)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocManaged"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMalloc(void **devPtr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMalloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocHost(void **ptr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMallocHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocPitch(void **devPtr, - size_t *pitch, - size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMallocPitch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocArray( - cudaArray_t *array, const struct cudaChannelFormatDesc *desc, size_t width, - size_t height __dv(0), unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - size_t, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, width, height, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFree(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFree"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeHost(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFreeHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeArray(cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t); - static auto func_ptr = LoadSymbol("cudaFreeArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t); - static auto func_ptr = LoadSymbol("cudaFreeMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostAlloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pHost, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostRegister(void *ptr, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostRegister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostUnregister(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaHostUnregister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaHostGetDevicePointer(void **pDevice, void *pHost, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostGetDevicePointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pDevice, pHost, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostGetFlags(unsigned int *pFlags, - void *pHost) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *, void *); - static auto func_ptr = LoadSymbol("cudaHostGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pFlags, pHost); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3D(struct cudaPitchedPtr *pitchedDevPtr, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr *, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMalloc3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, extent); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3DArray(cudaArray_t *array, const struct cudaChannelFormatDesc *desc, - struct cudaExtent extent, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int); - static auto func_ptr = LoadSymbol("cudaMalloc3DArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, extent, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, - const struct cudaChannelFormatDesc *desc, struct cudaExtent extent, - unsigned int numLevels, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, desc, extent, numLevels, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetMipmappedArrayLevel( - cudaArray_t *levelArray, cudaMipmappedArray_const_t mipmappedArray, - unsigned int level) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaMipmappedArray_const_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGetMipmappedArrayLevel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(levelArray, mipmappedArray, level); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3D(const struct cudaMemcpy3DParms *p) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync( - const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync( - const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemGetInfo(size_t *free, - size_t *total) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaMemGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(free, total); -} - -extern __host__ cudaError_t CUDARTAPI -cudaArrayGetInfo(struct cudaChannelFormatDesc *desc, struct cudaExtent *extent, - unsigned int *flags, cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - struct cudaExtent *, unsigned int *, - cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, extent, flags, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, - size_t count, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeer(void *dst, int dstDevice, - const void *src, - int srcDevice, - size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, int, const void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, - const void *src, - size_t spitch, size_t width, - size_t height, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, size_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, - size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - cudaArray_const_t, size_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol( - const void *symbol, const void *src, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol( - void *dst, const void *symbol, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemcpyAsync(void *dst, const void *src, size_t count, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, - size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, const void *, int, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync( - void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, - size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - const void *, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, - size_t, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync( - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync( - void *dst, const void *symbol, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, - size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, - int value, size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemset2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset3D( - struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMemset3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync( - void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemsetAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, - size_t height, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, - struct cudaExtent extent, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, - struct cudaExtent, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolAddress(void **devPtr, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolAddress"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolSize(size_t *size, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(size, symbol); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, size_t, int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemPrefetchAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, dstDevice, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, - enum cudaMemoryAdvise, int); - static auto func_ptr = LoadSymbol("cudaMemAdvise"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, advice, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute( - void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, - const void *devPtr, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, size_t, enum cudaMemRangeAttribute, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSize, attribute, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes( - void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, - size_t numAttributes, const void *devPtr, size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, enum cudaMemRangeAttribute *, - size_t, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSizes, attributes, numAttributes, devPtr, count); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t, size_t, size_t, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, cudaArray_const_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind, stream); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArrayAsync(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaPointerGetAttributes( - struct cudaPointerAttributes *attributes, const void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPointerAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaPointerGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attributes, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceCanAccessPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(canAccessPeer, device, peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, unsigned int); - static auto func_ptr = LoadSymbol("cudaDeviceEnablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceDisablePeerAccess(int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceDisablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnregisterResource"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceSetMapFlags( - cudaGraphicsResource_t resource, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphicsResourceSetMapFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsMapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsMapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnmapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnmapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedPointer( - void **devPtr, size_t *size, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsSubResourceGetMappedArray( - cudaArray_t *array, cudaGraphicsResource_t resource, - unsigned int arrayIndex, unsigned int mipLevel) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaGraphicsResource_t, unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaGraphicsSubResourceGetMappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, resource, arrayIndex, mipLevel); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsResourceGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindTexture( - size_t *offset, const struct textureReference *texref, const void *devPtr, - const struct cudaChannelFormatDesc *desc, size_t size __dv(UINT_MAX)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, size); -} - -extern __host__ cudaError_t CUDARTAPI -cudaBindTexture2D(size_t *offset, const struct textureReference *texref, - const void *devPtr, const struct cudaChannelFormatDesc *desc, - size_t width, size_t height, size_t pitch) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, width, height, pitch); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindTextureToArray( - const struct textureReference *texref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, array, desc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaBindTextureToMipmappedArray(const struct textureReference *texref, - cudaMipmappedArray_const_t mipmappedArray, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaMipmappedArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, mipmappedArray, desc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUnbindTexture(const struct textureReference *texref) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaUnbindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureAlignmentOffset( - size_t *offset, const struct textureReference *texref) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(size_t *, const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaGetTextureAlignmentOffset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureReference( - const struct textureReference **texref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct textureReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetTextureReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindSurfaceToArray( - const struct surfaceReference *surfref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct surfaceReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindSurfaceToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, array, desc); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceReference( - const struct surfaceReference **surfref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct surfaceReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSurfaceReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetChannelDesc( - struct cudaChannelFormatDesc *desc, cudaArray_const_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - cudaArray_const_t); - static auto func_ptr = LoadSymbol("cudaGetChannelDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, array); -} - -extern __host__ struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc( - int x, int y, int z, int w, enum cudaChannelFormatKind f) { - using FuncPtr = struct cudaChannelFormatDesc(CUDARTAPI *)( - int, int, int, int, enum cudaChannelFormatKind); - static auto func_ptr = LoadSymbol("cudaCreateChannelDesc"); - if (!func_ptr) { - return cudaChannelFormatDesc{cudaChannelFormatKind(-1), 0, 0, 0}; - } - return func_ptr(x, y, z, w, f); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject( - cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, - const struct cudaTextureDesc *pTexDesc, - const struct cudaResourceViewDesc *pResViewDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaTextureObject_t *, const struct cudaResourceDesc *, - const struct cudaTextureDesc *, const struct cudaResourceViewDesc *); - static auto func_ptr = LoadSymbol("cudaCreateTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexObject, pResDesc, pTexDesc, pResViewDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyTextureObject(cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaDestroyTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc( - struct cudaTextureDesc *pTexDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaTextureDesc *, cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaGetTextureObjectTextureDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceViewDesc( - struct cudaResourceViewDesc *pResViewDesc, cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaResourceViewDesc *, - cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceViewDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResViewDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateSurfaceObject( - cudaSurfaceObject_t *pSurfObject, const struct cudaResourceDesc *pResDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t *, - const struct cudaResourceDesc *); - static auto func_ptr = LoadSymbol("cudaCreateSurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pSurfObject, pResDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t); - static auto func_ptr = LoadSymbol("cudaDestroySurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaSurfaceObject_t surfObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaSurfaceObject_t); - static auto func_ptr = - LoadSymbol("cudaGetSurfaceObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaDriverGetVersion(int *driverVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaDriverGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(driverVersion); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaRuntimeGetVersion(int *runtimeVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaRuntimeGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(runtimeVersion); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphCreate(cudaGraph_t *pGraph, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraph, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddKernelNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddKernelNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetParams( - cudaGraphNode_t node, struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParams( - cudaGraphNode_t node, const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemcpy3DParms *pCopyParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pCopyParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeGetParams( - cudaGraphNode_t node, struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParams( - cudaGraphNode_t node, const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemsetNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemsetParams *pMemsetParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemsetNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pMemsetParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeGetParams( - cudaGraphNode_t node, struct cudaMemsetParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeSetParams( - cudaGraphNode_t node, const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddHostNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddHostNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeGetParams( - cudaGraphNode_t node, struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeSetParams( - cudaGraphNode_t node, const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddChildGraphNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaGraph_t childGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphAddChildGraphNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - childGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaGraphChildGraphNodeGetGraph"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddEmptyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEmptyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphClone(cudaGraph_t *pGraphClone, cudaGraph_t originalGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphClone, originalGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeFindInClone(cudaGraphNode_t *pNode, cudaGraphNode_t originalNode, - cudaGraph_t clonedGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphNodeFindInClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pNode, originalNode, clonedGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeGetType(cudaGraphNode_t node, enum cudaGraphNodeType *pType) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaGraphNodeType *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetType"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pType); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetNodes(cudaGraph_t graph, - cudaGraphNode_t *nodes, - size_t *numNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, nodes, numNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetRootNodes( - cudaGraph_t graph, cudaGraphNode_t *pRootNodes, size_t *pNumRootNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetRootNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, pRootNodes, pNumRootNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetEdges(cudaGraph_t graph, - cudaGraphNode_t *from, - cudaGraphNode_t *to, - size_t *numEdges) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, - cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetEdges"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numEdges); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependencies( - cudaGraphNode_t node, cudaGraphNode_t *pDependencies, - size_t *pNumDependencies) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependencies, pNumDependencies); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependentNodes( - cudaGraphNode_t node, cudaGraphNode_t *pDependentNodes, - size_t *pNumDependentNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependentNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependentNodes, pNumDependentNodes); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphRemoveDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphDestroyNode(cudaGraphNode_t node) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiate( - cudaGraphExec_t *pGraphExec, cudaGraph_t graph, cudaGraphNode_t *pErrorNode, - char *pLogBuffer, size_t bufferSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - cudaGraphNode_t *, char *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphInstantiate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, pErrorNode, pLogBuffer, bufferSize); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecKernelNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemsetNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphExecHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, - cudaGraphNode_t *hErrorNode_out, - enum cudaGraphExecUpdateResult *updateResult_out) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraph_t, cudaGraphNode_t *, - enum cudaGraphExecUpdateResult *); - static auto func_ptr = LoadSymbol("cudaGraphExecUpdate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hGraph, hErrorNode_out, updateResult_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphLaunch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecDestroy(cudaGraphExec_t graphExec) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t); - static auto func_ptr = LoadSymbol("cudaGraphExecDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDestroy(cudaGraph_t graph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetExportTable( - const void **ppExportTable, const cudaUUID_t *pExportTableId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void **, const cudaUUID_t *); - static auto func_ptr = LoadSymbol("cudaGetExportTable"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ppExportTable, pExportTableId); -} - -} // extern "C" diff --git a/source/lib/src/gpu/cudart/cuda_runtime_11_0.inc b/source/lib/src/gpu/cudart/cuda_runtime_11_0.inc deleted file mode 100644 index c9cd0a3769..0000000000 --- a/source/lib/src/gpu/cudart/cuda_runtime_11_0.inc +++ /dev/null @@ -1,2639 +0,0 @@ -// Auto-generated, do not edit. - -extern "C" { - -extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceReset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, - size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaDeviceGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetTexture1DLinearMaxWidth( - size_t *maxWidthInElements, const struct cudaChannelFormatDesc *fmtDesc, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct cudaChannelFormatDesc *, int); - static auto func_ptr = - LoadSymbol("cudaDeviceGetTexture1DLinearMaxWidth"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(maxWidthInElements, fmtDesc, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaDeviceGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int *); - static auto func_ptr = - LoadSymbol("cudaDeviceGetStreamPriorityRange"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(leastPriority, greatestPriority); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaDeviceSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig *); - static auto func_ptr = LoadSymbol("cudaDeviceGetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaDeviceSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetByPCIBusId(int *device, const char *pciBusId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const char *); - static auto func_ptr = LoadSymbol("cudaDeviceGetByPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, pciBusId); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, - int len, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(char *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pciBusId, len, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcEventHandle_t *, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaIpcGetEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, cudaIpcEventHandle_t); - static auto func_ptr = LoadSymbol("cudaIpcOpenEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, handle); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcMemHandle_t *, void *); - static auto func_ptr = LoadSymbol("cudaIpcGetMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle( - void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaIpcMemHandle_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaIpcOpenMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, handle, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaIpcCloseMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -#if CUDA_VERSION >= 11030 - -extern __host__ cudaError_t CUDARTAPI cudaDeviceFlushGPUDirectRDMAWrites( - enum cudaFlushGPUDirectRDMAWritesTarget target, - enum cudaFlushGPUDirectRDMAWritesScope scope) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(enum cudaFlushGPUDirectRDMAWritesTarget, - enum cudaFlushGPUDirectRDMAWritesScope); - static auto func_ptr = - LoadSymbol("cudaDeviceFlushGPUDirectRDMAWrites"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(target, scope); -} - -#endif // CUDA_VERSION >= 11030 - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadExit(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadExit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetLimit(enum cudaLimit limit, size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaThreadSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaThreadGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaThreadGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaThreadSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaGetLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaPeekAtLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaPeekAtLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorName(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorName"); - if (!func_ptr) return "cudaGetErrorName symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorString(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorString"); - if (!func_ptr) return "cudaGetErrorString symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceCount(int *count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceCount"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaDeviceProp *, int); - static auto func_ptr = LoadSymbol("cudaGetDeviceProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(prop, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceAttr, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, device); -} - -#if CUDA_VERSION >= 11020 - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetDefaultMemPool(cudaMemPool_t *memPool, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetDefaultMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, cudaMemPool_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, memPool); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetMemPool(cudaMemPool_t *memPool, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, device); -} - -#endif // CUDA_VERSION >= 11020 - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetNvSciSyncAttributes( - void *nvSciSyncAttrList, int device, int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, int); - static auto func_ptr = - LoadSymbol("cudaDeviceGetNvSciSyncAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(nvSciSyncAttrList, device, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, - int srcDevice, int dstDevice) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceP2PAttr, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetP2PAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, srcDevice, dstDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaChooseDevice(int *device, const struct cudaDeviceProp *prop) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const struct cudaDeviceProp *); - static auto func_ptr = LoadSymbol("cudaChooseDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, prop); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDevice(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaSetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDevice(int *device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetValidDevices(int *device_arr, - int len) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int); - static auto func_ptr = LoadSymbol("cudaSetValidDevices"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device_arr, len); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDeviceFlags(unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int); - static auto func_ptr = LoadSymbol("cudaSetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDeviceFlags(unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamCreate(cudaStream_t *pStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *); - static auto func_ptr = LoadSymbol("cudaStreamCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithPriority(cudaStream_t *pStream, unsigned int flags, - int priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int, int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetPriority(cudaStream_t hStream, int *priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, int *); - static auto func_ptr = LoadSymbol("cudaStreamGetPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, unsigned int *); - static auto func_ptr = LoadSymbol("cudaStreamGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaCtxResetPersistingL2Cache(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaCtxResetPersistingL2Cache"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamCopyAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetAttribute(cudaStream_t hStream, enum cudaStreamAttrID attr, - union cudaStreamAttrValue *value_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamAttrID, - union cudaStreamAttrValue *); - static auto func_ptr = LoadSymbol("cudaStreamGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, attr, value_out); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamSetAttribute(cudaStream_t hStream, enum cudaStreamAttrID attr, - const union cudaStreamAttrValue *value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamAttrID, - const union cudaStreamAttrValue *); - static auto func_ptr = LoadSymbol("cudaStreamSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, attr, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamDestroy(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent( - cudaStream_t stream, cudaEvent_t event, unsigned int flags __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, cudaEvent_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamWaitEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, event, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, - void *userData, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamCallback_t, - void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAddCallback"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, callback, userData, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamSynchronize(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, - size_t length __dv(0), unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAttachMemAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, devPtr, length, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamBeginCapture(cudaStream_t stream, enum cudaStreamCaptureMode mode) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureMode); - static auto func_ptr = LoadSymbol("cudaStreamBeginCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaThreadExchangeStreamCaptureMode(enum cudaStreamCaptureMode *mode) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaStreamCaptureMode *); - static auto func_ptr = - LoadSymbol("cudaThreadExchangeStreamCaptureMode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaStreamEndCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamIsCapturing( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureStatus *); - static auto func_ptr = LoadSymbol("cudaStreamIsCapturing"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus, - unsigned long long *pId) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaStream_t, enum cudaStreamCaptureStatus *, unsigned long long *); - static auto func_ptr = LoadSymbol("cudaStreamGetCaptureInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus, pId); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo_v2( - cudaStream_t stream, enum cudaStreamCaptureStatus *captureStatus_out, - unsigned long long *id_out __dv(0), cudaGraph_t *graph_out __dv(0), - const cudaGraphNode_t **dependencies_out __dv(0), - size_t *numDependencies_out __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaStream_t, enum cudaStreamCaptureStatus *, unsigned long long *, - cudaGraph_t *, const cudaGraphNode_t **, size_t *); - static auto func_ptr = LoadSymbol("cudaStreamGetCaptureInfo_v2"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, captureStatus_out, id_out, graph_out, - dependencies_out, numDependencies_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamUpdateCaptureDependencies( - cudaStream_t stream, cudaGraphNode_t *dependencies, size_t numDependencies, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraphNode_t *, - size_t, unsigned int); - static auto func_ptr = - LoadSymbol("cudaStreamUpdateCaptureDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, dependencies, numDependencies, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventCreate(cudaEvent_t *event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaEventCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaEventRecord"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream __dv(0), - unsigned int flags __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventRecordWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventQuery(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventSynchronize(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventDestroy(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventElapsedTime(float *ms, - cudaEvent_t start, - cudaEvent_t end) { - using FuncPtr = cudaError_t(CUDARTAPI *)(float *, cudaEvent_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventElapsedTime"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ms, start, end); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalMemory( - cudaExternalMemory_t *extMem_out, - const struct cudaExternalMemoryHandleDesc *memHandleDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaExternalMemory_t *, const struct cudaExternalMemoryHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem_out, memHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedBuffer( - void **devPtr, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryBufferDesc *bufferDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaExternalMemory_t, - const struct cudaExternalMemoryBufferDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedBuffer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, extMem, bufferDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmap, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryMipmappedArrayDesc *mipmapDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, cudaExternalMemory_t, - const struct cudaExternalMemoryMipmappedArrayDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmap, extMem, mipmapDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalMemory(cudaExternalMemory_t extMem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalMemory_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalSemaphore( - cudaExternalSemaphore_t *extSem_out, - const struct cudaExternalSemaphoreHandleDesc *semHandleDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem_out, semHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreSignalParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreSignalParams *, - unsigned int, cudaStream_t); - static auto func_ptr = - LoadSymbol("cudaSignalExternalSemaphoresAsync_v2"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreWaitParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreWaitParams *, - unsigned int, cudaStream_t); - static auto func_ptr = - LoadSymbol("cudaWaitExternalSemaphoresAsync_v2"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem); -} - -extern __host__ cudaError_t CUDARTAPI -cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel( - const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchCooperativeKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaLaunchCooperativeKernelMultiDevice( - struct cudaLaunchParams *launchParamsList, unsigned int numDevices, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaLaunchParams *, - unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaLaunchCooperativeKernelMultiDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(launchParamsList, numDevices, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetCacheConfig(const void *func, enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaFuncSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, cacheConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetSharedMemConfig(const void *func, enum cudaSharedMemConfig config) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaFuncSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, config); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaFuncAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaFuncGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attr, func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncAttribute, int); - static auto func_ptr = LoadSymbol("cudaFuncSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, attr, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForDevice(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForHost(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchHostFunc(cudaStream_t stream, - cudaHostFn_t fn, - void *userData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaHostFn_t, void *); - static auto func_ptr = LoadSymbol("cudaLaunchHostFunc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, fn, userData); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, - int blockSize, - size_t dynamicSMemSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxActiveBlocksPerMultiprocessor"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyAvailableDynamicSMemPerBlock(size_t *dynamicSmemSize, - const void *func, int numBlocks, - int blockSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *, int, int); - static auto func_ptr = - LoadSymbol("cudaOccupancyAvailableDynamicSMemPerBlock"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dynamicSmemSize, func, numBlocks, blockSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, - const void *func, - int blockSize, - size_t dynamicSMemSize, - unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t, unsigned int); - static auto func_ptr = LoadSymbol( - "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMallocManaged(void **devPtr, size_t size, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocManaged"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMalloc(void **devPtr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMalloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocHost(void **ptr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMallocHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocPitch(void **devPtr, - size_t *pitch, - size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMallocPitch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocArray( - cudaArray_t *array, const struct cudaChannelFormatDesc *desc, size_t width, - size_t height __dv(0), unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - size_t, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, width, height, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFree(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFree"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeHost(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFreeHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeArray(cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t); - static auto func_ptr = LoadSymbol("cudaFreeArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t); - static auto func_ptr = LoadSymbol("cudaFreeMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostAlloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pHost, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostRegister(void *ptr, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostRegister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostUnregister(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaHostUnregister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaHostGetDevicePointer(void **pDevice, void *pHost, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostGetDevicePointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pDevice, pHost, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostGetFlags(unsigned int *pFlags, - void *pHost) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *, void *); - static auto func_ptr = LoadSymbol("cudaHostGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pFlags, pHost); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3D(struct cudaPitchedPtr *pitchedDevPtr, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr *, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMalloc3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, extent); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3DArray(cudaArray_t *array, const struct cudaChannelFormatDesc *desc, - struct cudaExtent extent, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int); - static auto func_ptr = LoadSymbol("cudaMalloc3DArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, extent, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, - const struct cudaChannelFormatDesc *desc, struct cudaExtent extent, - unsigned int numLevels, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, desc, extent, numLevels, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetMipmappedArrayLevel( - cudaArray_t *levelArray, cudaMipmappedArray_const_t mipmappedArray, - unsigned int level) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaMipmappedArray_const_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGetMipmappedArrayLevel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(levelArray, mipmappedArray, level); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3D(const struct cudaMemcpy3DParms *p) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync( - const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync( - const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemGetInfo(size_t *free, - size_t *total) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaMemGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(free, total); -} - -extern __host__ cudaError_t CUDARTAPI -cudaArrayGetInfo(struct cudaChannelFormatDesc *desc, struct cudaExtent *extent, - unsigned int *flags, cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - struct cudaExtent *, unsigned int *, - cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, extent, flags, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaArrayGetPlane( - cudaArray_t *pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t *, cudaArray_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaArrayGetPlane"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pPlaneArray, hArray, planeIdx); -} - -#if CUDA_VERSION >= 11010 - -extern __host__ cudaError_t CUDARTAPI cudaArrayGetSparseProperties( - struct cudaArraySparseProperties *sparseProperties, cudaArray_t array) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaArraySparseProperties *, cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetSparseProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(sparseProperties, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaMipmappedArrayGetSparseProperties( - struct cudaArraySparseProperties *sparseProperties, - cudaMipmappedArray_t mipmap) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaArraySparseProperties *, - cudaMipmappedArray_t); - static auto func_ptr = - LoadSymbol("cudaMipmappedArrayGetSparseProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(sparseProperties, mipmap); -} - -#endif // CUDA_VERSION >= 11010 - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, - size_t count, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeer(void *dst, int dstDevice, - const void *src, - int srcDevice, - size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, int, const void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, - const void *src, - size_t spitch, size_t width, - size_t height, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, size_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, - size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - cudaArray_const_t, size_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol( - const void *symbol, const void *src, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol( - void *dst, const void *symbol, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemcpyAsync(void *dst, const void *src, size_t count, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, - size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, const void *, int, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync( - void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, - size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - const void *, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, - size_t, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync( - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync( - void *dst, const void *symbol, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, - size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, - int value, size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemset2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset3D( - struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMemset3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync( - void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemsetAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, - size_t height, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, - struct cudaExtent extent, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, - struct cudaExtent, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolAddress(void **devPtr, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolAddress"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolSize(size_t *size, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(size, symbol); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, size_t, int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemPrefetchAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, dstDevice, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, - enum cudaMemoryAdvise, int); - static auto func_ptr = LoadSymbol("cudaMemAdvise"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, advice, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute( - void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, - const void *devPtr, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, size_t, enum cudaMemRangeAttribute, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSize, attribute, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes( - void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, - size_t numAttributes, const void *devPtr, size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, enum cudaMemRangeAttribute *, - size_t, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSizes, attributes, numAttributes, devPtr, count); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t, size_t, size_t, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, cudaArray_const_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind, stream); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArrayAsync(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocAsync(void **devPtr, - size_t size, - cudaStream_t hStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMallocAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, hStream); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeAsync(void *devPtr, - cudaStream_t hStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaFreeAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, hStream); -} - -#if CUDA_VERSION >= 11020 - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolTrimTo(cudaMemPool_t memPool, - size_t minBytesToKeep) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemPoolTrimTo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, minBytesToKeep); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolSetAttribute( - cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMemPool_t, enum cudaMemPoolAttr, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolGetAttribute( - cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMemPool_t, enum cudaMemPoolAttr, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolSetAccess(cudaMemPool_t memPool, - const struct cudaMemAccessDesc *descList, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMemPool_t, const struct cudaMemAccessDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaMemPoolSetAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, descList, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolGetAccess(enum cudaMemAccessFlags *flags, cudaMemPool_t memPool, - struct cudaMemLocation *location) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - enum cudaMemAccessFlags *, cudaMemPool_t, struct cudaMemLocation *); - static auto func_ptr = LoadSymbol("cudaMemPoolGetAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags, memPool, location); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolCreate( - cudaMemPool_t *memPool, const struct cudaMemPoolProps *poolProps) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, - const struct cudaMemPoolProps *); - static auto func_ptr = LoadSymbol("cudaMemPoolCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, poolProps); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolDestroy(cudaMemPool_t memPool) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t); - static auto func_ptr = LoadSymbol("cudaMemPoolDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocFromPoolAsync( - void **ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t, cudaMemPool_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMallocFromPoolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, memPool, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportToShareableHandle( - void *shareableHandle, cudaMemPool_t memPool, - enum cudaMemAllocationHandleType handleType, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, cudaMemPool_t, enum cudaMemAllocationHandleType, unsigned int); - static auto func_ptr = - LoadSymbol("cudaMemPoolExportToShareableHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(shareableHandle, memPool, handleType, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolImportFromShareableHandle( - cudaMemPool_t *memPool, void *shareableHandle, - enum cudaMemAllocationHandleType handleType, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMemPool_t *, void *, enum cudaMemAllocationHandleType, unsigned int); - static auto func_ptr = - LoadSymbol("cudaMemPoolImportFromShareableHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, shareableHandle, handleType, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportPointer( - struct cudaMemPoolPtrExportData *exportData, void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaMemPoolPtrExportData *, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolExportPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(exportData, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolImportPointer(void **ptr, cudaMemPool_t memPool, - struct cudaMemPoolPtrExportData *exportData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, cudaMemPool_t, - struct cudaMemPoolPtrExportData *); - static auto func_ptr = LoadSymbol("cudaMemPoolImportPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, memPool, exportData); -} - -#endif // CUDA_VERSION >= 11020 - -extern __host__ cudaError_t CUDARTAPI cudaPointerGetAttributes( - struct cudaPointerAttributes *attributes, const void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPointerAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaPointerGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attributes, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceCanAccessPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(canAccessPeer, device, peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, unsigned int); - static auto func_ptr = LoadSymbol("cudaDeviceEnablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceDisablePeerAccess(int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceDisablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnregisterResource"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceSetMapFlags( - cudaGraphicsResource_t resource, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphicsResourceSetMapFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsMapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsMapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnmapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnmapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedPointer( - void **devPtr, size_t *size, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsSubResourceGetMappedArray( - cudaArray_t *array, cudaGraphicsResource_t resource, - unsigned int arrayIndex, unsigned int mipLevel) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaGraphicsResource_t, unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaGraphicsSubResourceGetMappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, resource, arrayIndex, mipLevel); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsResourceGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, resource); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindTexture( - size_t *offset, const struct textureReference *texref, const void *devPtr, - const struct cudaChannelFormatDesc *desc, size_t size __dv(UINT_MAX)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, size); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaBindTexture2D(size_t *offset, const struct textureReference *texref, - const void *devPtr, const struct cudaChannelFormatDesc *desc, - size_t width, size_t height, size_t pitch) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, width, height, pitch); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindTextureToArray( - const struct textureReference *texref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, array, desc); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaBindTextureToMipmappedArray(const struct textureReference *texref, - cudaMipmappedArray_const_t mipmappedArray, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaMipmappedArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, mipmappedArray, desc); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaUnbindTexture(const struct textureReference *texref) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaUnbindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaGetTextureAlignmentOffset(size_t *offset, - const struct textureReference *texref) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(size_t *, const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaGetTextureAlignmentOffset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGetTextureReference( - const struct textureReference **texref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct textureReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetTextureReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, symbol); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindSurfaceToArray( - const struct surfaceReference *surfref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct surfaceReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindSurfaceToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, array, desc); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGetSurfaceReference( - const struct surfaceReference **surfref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct surfaceReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSurfaceReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetChannelDesc( - struct cudaChannelFormatDesc *desc, cudaArray_const_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - cudaArray_const_t); - static auto func_ptr = LoadSymbol("cudaGetChannelDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, array); -} - -extern __host__ struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc( - int x, int y, int z, int w, enum cudaChannelFormatKind f) { - using FuncPtr = struct cudaChannelFormatDesc(CUDARTAPI *)( - int, int, int, int, enum cudaChannelFormatKind); - static auto func_ptr = LoadSymbol("cudaCreateChannelDesc"); - if (!func_ptr) { - return cudaChannelFormatDesc{cudaChannelFormatKind(-1), 0, 0, 0}; - } - return func_ptr(x, y, z, w, f); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject( - cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, - const struct cudaTextureDesc *pTexDesc, - const struct cudaResourceViewDesc *pResViewDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaTextureObject_t *, const struct cudaResourceDesc *, - const struct cudaTextureDesc *, const struct cudaResourceViewDesc *); - static auto func_ptr = LoadSymbol("cudaCreateTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexObject, pResDesc, pTexDesc, pResViewDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyTextureObject(cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaDestroyTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc( - struct cudaTextureDesc *pTexDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaTextureDesc *, cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaGetTextureObjectTextureDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceViewDesc( - struct cudaResourceViewDesc *pResViewDesc, cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaResourceViewDesc *, - cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceViewDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResViewDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateSurfaceObject( - cudaSurfaceObject_t *pSurfObject, const struct cudaResourceDesc *pResDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t *, - const struct cudaResourceDesc *); - static auto func_ptr = LoadSymbol("cudaCreateSurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pSurfObject, pResDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t); - static auto func_ptr = LoadSymbol("cudaDestroySurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaSurfaceObject_t surfObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaSurfaceObject_t); - static auto func_ptr = - LoadSymbol("cudaGetSurfaceObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaDriverGetVersion(int *driverVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaDriverGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(driverVersion); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaRuntimeGetVersion(int *runtimeVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaRuntimeGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(runtimeVersion); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphCreate(cudaGraph_t *pGraph, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraph, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddKernelNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddKernelNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetParams( - cudaGraphNode_t node, struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParams( - cudaGraphNode_t node, const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t); - static auto func_ptr = - LoadSymbol("cudaGraphKernelNodeCopyAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hSrc, hDst); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetAttribute( - cudaGraphNode_t hNode, enum cudaKernelNodeAttrID attr, - union cudaKernelNodeAttrValue *value_out) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaKernelNodeAttrID, - union cudaKernelNodeAttrValue *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, attr, value_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetAttribute( - cudaGraphNode_t hNode, enum cudaKernelNodeAttrID attr, - const union cudaKernelNodeAttrValue *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaKernelNodeAttrID, - const union cudaKernelNodeAttrValue *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemcpy3DParms *pCopyParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pCopyParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNodeToSymbol( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, - const void *, const void *, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNodeToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, symbol, - src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNodeFromSymbol( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, void *dst, - const void *symbol, size_t count, size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, void *, - const void *, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphAddMemcpyNodeFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, dst, - symbol, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode1D( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, void *dst, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, void *, - const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode1D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, dst, src, - count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeGetParams( - cudaGraphNode_t node, struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParams( - cudaGraphNode_t node, const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParamsToSymbol( - cudaGraphNode_t node, const void *symbol, const void *src, size_t count, - size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, const void *, const void *, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphMemcpyNodeSetParamsToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParamsFromSymbol( - cudaGraphNode_t node, void *dst, const void *symbol, size_t count, - size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphMemcpyNodeSetParamsFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, dst, symbol, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void *dst, const void *src, - size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, void *, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams1D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemsetNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemsetParams *pMemsetParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemsetNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pMemsetParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeGetParams( - cudaGraphNode_t node, struct cudaMemsetParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeSetParams( - cudaGraphNode_t node, const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddHostNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddHostNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeGetParams( - cudaGraphNode_t node, struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeSetParams( - cudaGraphNode_t node, const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddChildGraphNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaGraph_t childGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphAddChildGraphNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - childGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaGraphChildGraphNodeGetGraph"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddEmptyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEmptyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddEventRecordNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEventRecordNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t *event_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t *); - static auto func_ptr = - LoadSymbol("cudaGraphEventRecordNodeGetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = - LoadSymbol("cudaGraphEventRecordNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddEventWaitNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEventWaitNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t *event_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaGraphEventWaitNodeGetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphEventWaitNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event); -} - -#if CUDA_VERSION >= 11020 - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddExternalSemaphoresSignalNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaExternalSemaphoreSignalNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, - const struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphAddExternalSemaphoresSignalNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresSignalNodeGetParams( - cudaGraphNode_t hNode, - struct cudaExternalSemaphoreSignalNodeParams *params_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresSignalNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, params_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresSignalNodeSetParams( - cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreSignalNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, const struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresSignalNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddExternalSemaphoresWaitNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaExternalSemaphoreWaitNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, - const struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphAddExternalSemaphoresWaitNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresWaitNodeGetParams( - cudaGraphNode_t hNode, - struct cudaExternalSemaphoreWaitNodeParams *params_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresWaitNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, params_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresWaitNodeSetParams( - cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreWaitNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, const struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresWaitNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, nodeParams); -} - -#endif // CUDA_VERSION >= 11020 - -extern __host__ cudaError_t CUDARTAPI -cudaGraphClone(cudaGraph_t *pGraphClone, cudaGraph_t originalGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphClone, originalGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeFindInClone(cudaGraphNode_t *pNode, cudaGraphNode_t originalNode, - cudaGraph_t clonedGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphNodeFindInClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pNode, originalNode, clonedGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeGetType(cudaGraphNode_t node, enum cudaGraphNodeType *pType) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaGraphNodeType *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetType"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pType); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetNodes(cudaGraph_t graph, - cudaGraphNode_t *nodes, - size_t *numNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, nodes, numNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetRootNodes( - cudaGraph_t graph, cudaGraphNode_t *pRootNodes, size_t *pNumRootNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetRootNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, pRootNodes, pNumRootNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetEdges(cudaGraph_t graph, - cudaGraphNode_t *from, - cudaGraphNode_t *to, - size_t *numEdges) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, - cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetEdges"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numEdges); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependencies( - cudaGraphNode_t node, cudaGraphNode_t *pDependencies, - size_t *pNumDependencies) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependencies, pNumDependencies); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependentNodes( - cudaGraphNode_t node, cudaGraphNode_t *pDependentNodes, - size_t *pNumDependentNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependentNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependentNodes, pNumDependentNodes); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphRemoveDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphDestroyNode(cudaGraphNode_t node) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiate( - cudaGraphExec_t *pGraphExec, cudaGraph_t graph, cudaGraphNode_t *pErrorNode, - char *pLogBuffer, size_t bufferSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - cudaGraphNode_t *, char *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphInstantiate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, pErrorNode, pLogBuffer, bufferSize); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecKernelNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParamsToSymbol( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const void *symbol, - const void *src, size_t count, size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParamsToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecMemcpyNodeSetParamsFromSymbol(cudaGraphExec_t hGraphExec, - cudaGraphNode_t node, void *dst, - const void *symbol, size_t count, - size_t offset, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParamsFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, dst, symbol, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams1D( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void *dst, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, void *, - const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParams1D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemsetNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphExecHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecChildGraphNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = - LoadSymbol("cudaGraphExecChildGraphNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, childGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecEventRecordNodeSetEvent( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = - LoadSymbol("cudaGraphExecEventRecordNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, event); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecEventWaitNodeSetEvent( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = - LoadSymbol("cudaGraphExecEventWaitNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecExternalSemaphoresSignalNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreSignalNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphExec_t, cudaGraphNode_t, - const struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecExternalSemaphoresSignalNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecExternalSemaphoresWaitNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreWaitNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphExec_t, cudaGraphNode_t, - const struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecExternalSemaphoresWaitNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, - cudaGraphNode_t *hErrorNode_out, - enum cudaGraphExecUpdateResult *updateResult_out) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraph_t, cudaGraphNode_t *, - enum cudaGraphExecUpdateResult *); - static auto func_ptr = LoadSymbol("cudaGraphExecUpdate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hGraph, hErrorNode_out, updateResult_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphUpload(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphUpload"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphLaunch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecDestroy(cudaGraphExec_t graphExec) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t); - static auto func_ptr = LoadSymbol("cudaGraphExecDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDestroy(cudaGraph_t graph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDebugDotPrint( - cudaGraph_t graph, const char *path, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, const char *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphDebugDotPrint"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, path, flags); -} - -#if CUDA_VERSION >= 11030 - -extern __host__ cudaError_t CUDARTAPI cudaUserObjectCreate( - cudaUserObject_t *object_out, void *ptr, cudaHostFn_t destroy, - unsigned int initialRefcount, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaUserObject_t *, void *, cudaHostFn_t, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object_out, ptr, destroy, initialRefcount, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUserObjectRetain(cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectRetain"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUserObjectRelease(cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectRelease"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphRetainUserObject( - cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1), - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaUserObject_t, - unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphRetainUserObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, object, count, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphReleaseUserObject( - cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphReleaseUserObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, object, count); -} - -#endif // CUDA_VERSION >= 11030 - -extern __host__ cudaError_t CUDARTAPI cudaGetDriverEntryPoint( - const char *symbol, void **funcPtr, unsigned long long flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const char *, void **, unsigned long long); - static auto func_ptr = LoadSymbol("cudaGetDriverEntryPoint"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, funcPtr, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetExportTable( - const void **ppExportTable, const cudaUUID_t *pExportTableId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void **, const cudaUUID_t *); - static auto func_ptr = LoadSymbol("cudaGetExportTable"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ppExportTable, pExportTableId); -} - -#if CUDA_VERSION >= 11020 - -extern __host__ cudaError_t CUDARTAPI_CDECL -cudaGetFuncBySymbol(cudaFunction_t *functionPtr, const void *symbolPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaFunction_t *, const void *); - static auto func_ptr = LoadSymbol("cudaGetFuncBySymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(functionPtr, symbolPtr); -} - -#endif // CUDA_VERSION >= 11020 - -} // extern "C" diff --git a/source/lib/src/gpu/cudart/cuda_runtime_11_2.inc b/source/lib/src/gpu/cudart/cuda_runtime_11_2.inc deleted file mode 100644 index 5c0ba7fe6a..0000000000 --- a/source/lib/src/gpu/cudart/cuda_runtime_11_2.inc +++ /dev/null @@ -1,2259 +0,0 @@ -// Auto-generated, do not edit. - -extern "C" { -extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceReset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, - size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaDeviceGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaDeviceGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int *); - static auto func_ptr = - LoadSymbol("cudaDeviceGetStreamPriorityRange"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(leastPriority, greatestPriority); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaDeviceSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig *); - static auto func_ptr = LoadSymbol("cudaDeviceGetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaDeviceSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetByPCIBusId(int *device, const char *pciBusId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const char *); - static auto func_ptr = LoadSymbol("cudaDeviceGetByPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, pciBusId); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, - int len, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(char *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pciBusId, len, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcEventHandle_t *, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaIpcGetEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, cudaIpcEventHandle_t); - static auto func_ptr = LoadSymbol("cudaIpcOpenEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, handle); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcMemHandle_t *, void *); - static auto func_ptr = LoadSymbol("cudaIpcGetMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle( - void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaIpcMemHandle_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaIpcOpenMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, handle, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaIpcCloseMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadExit(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadExit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetLimit(enum cudaLimit limit, size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaThreadSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaThreadGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaThreadGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaThreadSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaGetLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaPeekAtLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaPeekAtLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorName(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorName"); - if (!func_ptr) return "cudaGetErrorName symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorString(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorString"); - if (!func_ptr) return "cudaGetErrorString symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceCount(int *count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceCount"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaDeviceProp *, int); - static auto func_ptr = LoadSymbol("cudaGetDeviceProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(prop, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceAttr, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetDefaultMemPool(cudaMemPool_t *memPool, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetDefaultMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, cudaMemPool_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, memPool); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetMemPool(cudaMemPool_t *memPool, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetNvSciSyncAttributes( - void *nvSciSyncAttrList, int device, int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, int); - static auto func_ptr = - LoadSymbol("cudaDeviceGetNvSciSyncAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(nvSciSyncAttrList, device, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, - int srcDevice, int dstDevice) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceP2PAttr, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetP2PAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, srcDevice, dstDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaChooseDevice(int *device, const struct cudaDeviceProp *prop) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const struct cudaDeviceProp *); - static auto func_ptr = LoadSymbol("cudaChooseDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, prop); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDevice(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaSetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDevice(int *device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetValidDevices(int *device_arr, - int len) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int); - static auto func_ptr = LoadSymbol("cudaSetValidDevices"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device_arr, len); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDeviceFlags(unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int); - static auto func_ptr = LoadSymbol("cudaSetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDeviceFlags(unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamCreate(cudaStream_t *pStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *); - static auto func_ptr = LoadSymbol("cudaStreamCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithPriority(cudaStream_t *pStream, unsigned int flags, - int priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int, int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetPriority(cudaStream_t hStream, int *priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, int *); - static auto func_ptr = LoadSymbol("cudaStreamGetPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, unsigned int *); - static auto func_ptr = LoadSymbol("cudaStreamGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaCtxResetPersistingL2Cache(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaCtxResetPersistingL2Cache"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamCopyAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetAttribute(cudaStream_t hStream, enum cudaStreamAttrID attr, - union cudaStreamAttrValue *value_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamAttrID, - union cudaStreamAttrValue *); - static auto func_ptr = LoadSymbol("cudaStreamGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, attr, value_out); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamSetAttribute(cudaStream_t hStream, enum cudaStreamAttrID attr, - const union cudaStreamAttrValue *value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamAttrID, - const union cudaStreamAttrValue *); - static auto func_ptr = LoadSymbol("cudaStreamSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, attr, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamDestroy(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent( - cudaStream_t stream, cudaEvent_t event, unsigned int flags __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, cudaEvent_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamWaitEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, event, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, - void *userData, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamCallback_t, - void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAddCallback"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, callback, userData, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamSynchronize(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, - size_t length __dv(0), unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAttachMemAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, devPtr, length, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamBeginCapture(cudaStream_t stream, enum cudaStreamCaptureMode mode) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureMode); - static auto func_ptr = LoadSymbol("cudaStreamBeginCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaThreadExchangeStreamCaptureMode(enum cudaStreamCaptureMode *mode) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaStreamCaptureMode *); - static auto func_ptr = - LoadSymbol("cudaThreadExchangeStreamCaptureMode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaStreamEndCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamIsCapturing( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureStatus *); - static auto func_ptr = LoadSymbol("cudaStreamIsCapturing"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus, - unsigned long long *pId) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaStream_t, enum cudaStreamCaptureStatus *, unsigned long long *); - static auto func_ptr = LoadSymbol("cudaStreamGetCaptureInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus, pId); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo_v2( - cudaStream_t stream, enum cudaStreamCaptureStatus *captureStatus_out, - unsigned long long *id_out __dv(0), cudaGraph_t *graph_out __dv(0), - const cudaGraphNode_t **dependencies_out __dv(0), - size_t *numDependencies_out __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaStream_t, enum cudaStreamCaptureStatus *, unsigned long long *, - cudaGraph_t *, const cudaGraphNode_t **, size_t *); - static auto func_ptr = LoadSymbol("cudaStreamGetCaptureInfo_v2"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, captureStatus_out, id_out, graph_out, - dependencies_out, numDependencies_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamUpdateCaptureDependencies( - cudaStream_t stream, cudaGraphNode_t *dependencies, size_t numDependencies, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraphNode_t *, - size_t, unsigned int); - static auto func_ptr = - LoadSymbol("cudaStreamUpdateCaptureDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, dependencies, numDependencies, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventCreate(cudaEvent_t *event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaEventCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaEventRecord"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventQuery(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventSynchronize(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventDestroy(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventElapsedTime(float *ms, - cudaEvent_t start, - cudaEvent_t end) { - using FuncPtr = cudaError_t(CUDARTAPI *)(float *, cudaEvent_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventElapsedTime"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ms, start, end); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalMemory( - cudaExternalMemory_t *extMem_out, - const struct cudaExternalMemoryHandleDesc *memHandleDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaExternalMemory_t *, const struct cudaExternalMemoryHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem_out, memHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedBuffer( - void **devPtr, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryBufferDesc *bufferDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaExternalMemory_t, - const struct cudaExternalMemoryBufferDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedBuffer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, extMem, bufferDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmap, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryMipmappedArrayDesc *mipmapDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, cudaExternalMemory_t, - const struct cudaExternalMemoryMipmappedArrayDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmap, extMem, mipmapDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalMemory(cudaExternalMemory_t extMem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalMemory_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalSemaphore( - cudaExternalSemaphore_t *extSem_out, - const struct cudaExternalSemaphoreHandleDesc *semHandleDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem_out, semHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreSignalParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreSignalParams *, - unsigned int, cudaStream_t); - static auto func_ptr = LoadSymbol( - "__CUDART_API_PTSZ(cudaSignalExternalSemaphoresAsync_v2)"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreWaitParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreWaitParams *, - unsigned int, cudaStream_t); - static auto func_ptr = LoadSymbol( - "__CUDART_API_PTSZ(cudaWaitExternalSemaphoresAsync_v2)"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem); -} - -extern __host__ cudaError_t CUDARTAPI -cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel( - const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchCooperativeKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernelMultiDevice( - struct cudaLaunchParams *launchParamsList, unsigned int numDevices, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaLaunchParams *, - unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaLaunchCooperativeKernelMultiDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(launchParamsList, numDevices, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetCacheConfig(const void *func, enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaFuncSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, cacheConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetSharedMemConfig(const void *func, enum cudaSharedMemConfig config) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaFuncSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, config); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaFuncAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaFuncGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attr, func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncAttribute, int); - static auto func_ptr = LoadSymbol("cudaFuncSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, attr, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForDevice(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForHost(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchHostFunc(cudaStream_t stream, - cudaHostFn_t fn, - void *userData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaHostFn_t, void *); - static auto func_ptr = LoadSymbol("cudaLaunchHostFunc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, fn, userData); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, - int blockSize, - size_t dynamicSMemSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxActiveBlocksPerMultiprocessor"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyAvailableDynamicSMemPerBlock(size_t *dynamicSmemSize, - const void *func, int numBlocks, - int blockSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *, int, int); - static auto func_ptr = - LoadSymbol("cudaOccupancyAvailableDynamicSMemPerBlock"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dynamicSmemSize, func, numBlocks, blockSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, - const void *func, - int blockSize, - size_t dynamicSMemSize, - unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t, unsigned int); - static auto func_ptr = LoadSymbol( - "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMallocManaged(void **devPtr, size_t size, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocManaged"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMalloc(void **devPtr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMalloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocHost(void **ptr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMallocHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocPitch(void **devPtr, - size_t *pitch, - size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMallocPitch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocArray( - cudaArray_t *array, const struct cudaChannelFormatDesc *desc, size_t width, - size_t height __dv(0), unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - size_t, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, width, height, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFree(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFree"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeHost(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFreeHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeArray(cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t); - static auto func_ptr = LoadSymbol("cudaFreeArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t); - static auto func_ptr = LoadSymbol("cudaFreeMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostAlloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pHost, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostRegister(void *ptr, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostRegister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostUnregister(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaHostUnregister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaHostGetDevicePointer(void **pDevice, void *pHost, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostGetDevicePointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pDevice, pHost, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostGetFlags(unsigned int *pFlags, - void *pHost) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *, void *); - static auto func_ptr = LoadSymbol("cudaHostGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pFlags, pHost); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3D(struct cudaPitchedPtr *pitchedDevPtr, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr *, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMalloc3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, extent); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3DArray(cudaArray_t *array, const struct cudaChannelFormatDesc *desc, - struct cudaExtent extent, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int); - static auto func_ptr = LoadSymbol("cudaMalloc3DArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, extent, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, - const struct cudaChannelFormatDesc *desc, struct cudaExtent extent, - unsigned int numLevels, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, desc, extent, numLevels, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetMipmappedArrayLevel( - cudaArray_t *levelArray, cudaMipmappedArray_const_t mipmappedArray, - unsigned int level) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaMipmappedArray_const_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGetMipmappedArrayLevel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(levelArray, mipmappedArray, level); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3D(const struct cudaMemcpy3DParms *p) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync( - const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync( - const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemGetInfo(size_t *free, - size_t *total) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaMemGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(free, total); -} - -extern __host__ cudaError_t CUDARTAPI -cudaArrayGetInfo(struct cudaChannelFormatDesc *desc, struct cudaExtent *extent, - unsigned int *flags, cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - struct cudaExtent *, unsigned int *, - cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, extent, flags, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaArrayGetPlane( - cudaArray_t *pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t *, cudaArray_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaArrayGetPlane"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pPlaneArray, hArray, planeIdx); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, - size_t count, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeer(void *dst, int dstDevice, - const void *src, - int srcDevice, - size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, int, const void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, - const void *src, - size_t spitch, size_t width, - size_t height, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, size_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, - size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - cudaArray_const_t, size_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol( - const void *symbol, const void *src, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol( - void *dst, const void *symbol, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemcpyAsync(void *dst, const void *src, size_t count, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, - size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, const void *, int, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync( - void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, - size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - const void *, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, - size_t, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync( - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync( - void *dst, const void *symbol, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, - size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, - int value, size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemset2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset3D( - struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMemset3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync( - void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemsetAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, - size_t height, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, - struct cudaExtent extent, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, - struct cudaExtent, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolAddress(void **devPtr, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolAddress"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolSize(size_t *size, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(size, symbol); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, size_t, int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemPrefetchAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, dstDevice, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, - enum cudaMemoryAdvise, int); - static auto func_ptr = LoadSymbol("cudaMemAdvise"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, advice, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute( - void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, - const void *devPtr, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, size_t, enum cudaMemRangeAttribute, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSize, attribute, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes( - void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, - size_t numAttributes, const void *devPtr, size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, enum cudaMemRangeAttribute *, - size_t, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSizes, attributes, numAttributes, devPtr, count); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t, size_t, size_t, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, cudaArray_const_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind, stream); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArrayAsync(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocAsync(void **devPtr, - size_t size, - cudaStream_t hStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMallocAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, hStream); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeAsync(void *devPtr, - cudaStream_t hStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaFreeAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, hStream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolTrimTo(cudaMemPool_t memPool, - size_t minBytesToKeep) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemPoolTrimTo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, minBytesToKeep); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolSetAttribute( - cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMemPool_t, enum cudaMemPoolAttr, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolGetAttribute( - cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMemPool_t, enum cudaMemPoolAttr, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolSetAccess(cudaMemPool_t memPool, - const struct cudaMemAccessDesc *descList, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMemPool_t, const struct cudaMemAccessDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaMemPoolSetAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, descList, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolGetAccess(enum cudaMemAccessFlags *flags, cudaMemPool_t memPool, - struct cudaMemLocation *location) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - enum cudaMemAccessFlags *, cudaMemPool_t, struct cudaMemLocation *); - static auto func_ptr = LoadSymbol("cudaMemPoolGetAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags, memPool, location); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolCreate( - cudaMemPool_t *memPool, const struct cudaMemPoolProps *poolProps) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, - const struct cudaMemPoolProps *); - static auto func_ptr = LoadSymbol("cudaMemPoolCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, poolProps); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolDestroy(cudaMemPool_t memPool) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t); - static auto func_ptr = LoadSymbol("cudaMemPoolDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocFromPoolAsync( - void **ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t, cudaMemPool_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMallocFromPoolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, memPool, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportToShareableHandle( - void *shareableHandle, cudaMemPool_t memPool, - enum cudaMemAllocationHandleType handleType, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, cudaMemPool_t, enum cudaMemAllocationHandleType, unsigned int); - static auto func_ptr = - LoadSymbol("cudaMemPoolExportToShareableHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(shareableHandle, memPool, handleType, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolImportFromShareableHandle( - cudaMemPool_t *memPool, void *shareableHandle, - enum cudaMemAllocationHandleType handleType, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMemPool_t *, void *, enum cudaMemAllocationHandleType, unsigned int); - static auto func_ptr = - LoadSymbol("cudaMemPoolImportFromShareableHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, shareableHandle, handleType, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportPointer( - struct cudaMemPoolPtrExportData *exportData, void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaMemPoolPtrExportData *, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolExportPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(exportData, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolImportPointer(void **ptr, cudaMemPool_t memPool, - struct cudaMemPoolPtrExportData *exportData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, cudaMemPool_t, - struct cudaMemPoolPtrExportData *); - static auto func_ptr = LoadSymbol("cudaMemPoolImportPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, memPool, exportData); -} - -extern __host__ cudaError_t CUDARTAPI cudaPointerGetAttributes( - struct cudaPointerAttributes *attributes, const void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPointerAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaPointerGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attributes, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceCanAccessPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(canAccessPeer, device, peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, unsigned int); - static auto func_ptr = LoadSymbol("cudaDeviceEnablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceDisablePeerAccess(int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceDisablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnregisterResource"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceSetMapFlags( - cudaGraphicsResource_t resource, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphicsResourceSetMapFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsMapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsMapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnmapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnmapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedPointer( - void **devPtr, size_t *size, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsSubResourceGetMappedArray( - cudaArray_t *array, cudaGraphicsResource_t resource, - unsigned int arrayIndex, unsigned int mipLevel) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaGraphicsResource_t, unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaGraphicsSubResourceGetMappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, resource, arrayIndex, mipLevel); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsResourceGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, resource); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindTexture( - size_t *offset, const struct textureReference *texref, const void *devPtr, - const struct cudaChannelFormatDesc *desc, size_t size __dv(UINT_MAX)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, size); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaBindTexture2D(size_t *offset, const struct textureReference *texref, - const void *devPtr, const struct cudaChannelFormatDesc *desc, - size_t width, size_t height, size_t pitch) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, width, height, pitch); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindTextureToArray( - const struct textureReference *texref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, array, desc); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaBindTextureToMipmappedArray(const struct textureReference *texref, - cudaMipmappedArray_const_t mipmappedArray, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaMipmappedArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, mipmappedArray, desc); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaUnbindTexture(const struct textureReference *texref) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaUnbindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaGetTextureAlignmentOffset(size_t *offset, - const struct textureReference *texref) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(size_t *, const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaGetTextureAlignmentOffset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGetTextureReference( - const struct textureReference **texref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct textureReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetTextureReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, symbol); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindSurfaceToArray( - const struct surfaceReference *surfref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct surfaceReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindSurfaceToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, array, desc); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGetSurfaceReference( - const struct surfaceReference **surfref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct surfaceReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSurfaceReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetChannelDesc( - struct cudaChannelFormatDesc *desc, cudaArray_const_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - cudaArray_const_t); - static auto func_ptr = LoadSymbol("cudaGetChannelDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, array); -} - -extern __host__ struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc( - int x, int y, int z, int w, enum cudaChannelFormatKind f) { - using FuncPtr = struct cudaChannelFormatDesc(CUDARTAPI *)( - int, int, int, int, enum cudaChannelFormatKind); - static auto func_ptr = LoadSymbol("cudaCreateChannelDesc"); - return func_ptr(x, y, z, w, f); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject( - cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, - const struct cudaTextureDesc *pTexDesc, - const struct cudaResourceViewDesc *pResViewDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaTextureObject_t *, const struct cudaResourceDesc *, - const struct cudaTextureDesc *, const struct cudaResourceViewDesc *); - static auto func_ptr = LoadSymbol("cudaCreateTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexObject, pResDesc, pTexDesc, pResViewDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyTextureObject(cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaDestroyTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc( - struct cudaTextureDesc *pTexDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaTextureDesc *, cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaGetTextureObjectTextureDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceViewDesc( - struct cudaResourceViewDesc *pResViewDesc, cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaResourceViewDesc *, - cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceViewDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResViewDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateSurfaceObject( - cudaSurfaceObject_t *pSurfObject, const struct cudaResourceDesc *pResDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t *, - const struct cudaResourceDesc *); - static auto func_ptr = LoadSymbol("cudaCreateSurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pSurfObject, pResDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t); - static auto func_ptr = LoadSymbol("cudaDestroySurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaSurfaceObject_t surfObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaSurfaceObject_t); - static auto func_ptr = - LoadSymbol("cudaGetSurfaceObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaDriverGetVersion(int *driverVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaDriverGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(driverVersion); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaRuntimeGetVersion(int *runtimeVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaRuntimeGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(runtimeVersion); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphCreate(cudaGraph_t *pGraph, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraph, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddKernelNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddKernelNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetParams( - cudaGraphNode_t node, struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParams( - cudaGraphNode_t node, const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t); - static auto func_ptr = - LoadSymbol("cudaGraphKernelNodeCopyAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hSrc, hDst); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetAttribute( - cudaGraphNode_t hNode, enum cudaKernelNodeAttrID attr, - union cudaKernelNodeAttrValue *value_out) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaKernelNodeAttrID, - union cudaKernelNodeAttrValue *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, attr, value_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetAttribute( - cudaGraphNode_t hNode, enum cudaKernelNodeAttrID attr, - const union cudaKernelNodeAttrValue *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaKernelNodeAttrID, - const union cudaKernelNodeAttrValue *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemcpy3DParms *pCopyParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pCopyParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeGetParams( - cudaGraphNode_t node, struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParams( - cudaGraphNode_t node, const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemsetNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemsetParams *pMemsetParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemsetNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pMemsetParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeGetParams( - cudaGraphNode_t node, struct cudaMemsetParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeSetParams( - cudaGraphNode_t node, const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddHostNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddHostNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeGetParams( - cudaGraphNode_t node, struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeSetParams( - cudaGraphNode_t node, const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddChildGraphNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaGraph_t childGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphAddChildGraphNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - childGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaGraphChildGraphNodeGetGraph"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddEmptyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEmptyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphClone(cudaGraph_t *pGraphClone, cudaGraph_t originalGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphClone, originalGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeFindInClone(cudaGraphNode_t *pNode, cudaGraphNode_t originalNode, - cudaGraph_t clonedGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphNodeFindInClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pNode, originalNode, clonedGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeGetType(cudaGraphNode_t node, enum cudaGraphNodeType *pType) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaGraphNodeType *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetType"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pType); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetNodes(cudaGraph_t graph, - cudaGraphNode_t *nodes, - size_t *numNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, nodes, numNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetRootNodes( - cudaGraph_t graph, cudaGraphNode_t *pRootNodes, size_t *pNumRootNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetRootNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, pRootNodes, pNumRootNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetEdges(cudaGraph_t graph, - cudaGraphNode_t *from, - cudaGraphNode_t *to, - size_t *numEdges) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, - cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetEdges"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numEdges); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependencies( - cudaGraphNode_t node, cudaGraphNode_t *pDependencies, - size_t *pNumDependencies) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependencies, pNumDependencies); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependentNodes( - cudaGraphNode_t node, cudaGraphNode_t *pDependentNodes, - size_t *pNumDependentNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependentNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependentNodes, pNumDependentNodes); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphRemoveDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphDestroyNode(cudaGraphNode_t node) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiate( - cudaGraphExec_t *pGraphExec, cudaGraph_t graph, cudaGraphNode_t *pErrorNode, - char *pLogBuffer, size_t bufferSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - cudaGraphNode_t *, char *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphInstantiate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, pErrorNode, pLogBuffer, bufferSize); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecKernelNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemsetNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphExecHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, - cudaGraphNode_t *hErrorNode_out, - enum cudaGraphExecUpdateResult *updateResult_out) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraph_t, cudaGraphNode_t *, - enum cudaGraphExecUpdateResult *); - static auto func_ptr = LoadSymbol("cudaGraphExecUpdate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hGraph, hErrorNode_out, updateResult_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphLaunch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecDestroy(cudaGraphExec_t graphExec) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t); - static auto func_ptr = LoadSymbol("cudaGraphExecDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDestroy(cudaGraph_t graph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetExportTable( - const void **ppExportTable, const cudaUUID_t *pExportTableId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void **, const cudaUUID_t *); - static auto func_ptr = LoadSymbol("cudaGetExportTable"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ppExportTable, pExportTableId); -} - -extern __host__ cudaError_t CUDARTAPI_CDECL -cudaGetFuncBySymbol(cudaFunction_t *functionPtr, const void *symbolPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaFunction_t *, const void *); - static auto func_ptr = LoadSymbol("_CDECL cudaGetFuncBySymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(functionPtr, symbolPtr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddEventRecordNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEventRecordNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddEventWaitNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEventWaitNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, event); -} - -#if CUDA_VERSION >= 11030 - -extern __host__ cudaError_t CUDARTAPI cudaUserObjectCreate( - cudaUserObject_t *object_out, void *ptr, cudaHostFn_t destroy, - unsigned int initialRefcount, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaUserObject_t *, void *, cudaHostFn_t, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object_out, ptr, destroy, initialRefcount, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUserObjectRetain(cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectRetain"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUserObjectRelease(cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectRelease"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphRetainUserObject( - cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1), - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaUserObject_t, - unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphRetainUserObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, object, count, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphReleaseUserObject( - cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphReleaseUserObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, object, count); -} - -#endif // CUDA_VERSION >= 11030 - -extern __host__ cudaError_t CUDARTAPI cudaGetDriverEntryPoint( - const char *symbol, void **funcPtr, unsigned long long flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const char *, void **, unsigned long long); - static auto func_ptr = LoadSymbol("cudaGetDriverEntryPoint"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, funcPtr, flags); -} - -} // extern "C" diff --git a/source/lib/src/gpu/cudart/cuda_runtime_11_8.inc b/source/lib/src/gpu/cudart/cuda_runtime_11_8.inc deleted file mode 100644 index 8000ce1f92..0000000000 --- a/source/lib/src/gpu/cudart/cuda_runtime_11_8.inc +++ /dev/null @@ -1,2771 +0,0 @@ -// Auto-generated, do not edit. - -extern "C" { -extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceReset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, - size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaDeviceGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetTexture1DLinearMaxWidth( - size_t *maxWidthInElements, const struct cudaChannelFormatDesc *fmtDesc, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct cudaChannelFormatDesc *, int); - static auto func_ptr = - LoadSymbol("cudaDeviceGetTexture1DLinearMaxWidth"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(maxWidthInElements, fmtDesc, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaDeviceGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int *); - static auto func_ptr = - LoadSymbol("cudaDeviceGetStreamPriorityRange"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(leastPriority, greatestPriority); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaDeviceSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig *); - static auto func_ptr = LoadSymbol("cudaDeviceGetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaDeviceSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetByPCIBusId(int *device, const char *pciBusId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const char *); - static auto func_ptr = LoadSymbol("cudaDeviceGetByPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, pciBusId); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, - int len, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(char *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pciBusId, len, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcEventHandle_t *, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaIpcGetEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, cudaIpcEventHandle_t); - static auto func_ptr = LoadSymbol("cudaIpcOpenEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, handle); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcMemHandle_t *, void *); - static auto func_ptr = LoadSymbol("cudaIpcGetMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle( - void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaIpcMemHandle_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaIpcOpenMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, handle, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaIpcCloseMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceFlushGPUDirectRDMAWrites( - enum cudaFlushGPUDirectRDMAWritesTarget target, - enum cudaFlushGPUDirectRDMAWritesScope scope) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(enum cudaFlushGPUDirectRDMAWritesTarget, - enum cudaFlushGPUDirectRDMAWritesScope); - static auto func_ptr = - LoadSymbol("cudaDeviceFlushGPUDirectRDMAWrites"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(target, scope); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadExit(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadExit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetLimit(enum cudaLimit limit, size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaThreadSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaThreadGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaThreadGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaThreadSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaGetLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaPeekAtLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaPeekAtLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorName(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorName"); - if (!func_ptr) return "cudaGetErrorName symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorString(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorString"); - if (!func_ptr) return "cudaGetErrorString symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceCount(int *count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceCount"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaDeviceProp *, int); - static auto func_ptr = LoadSymbol("cudaGetDeviceProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(prop, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceAttr, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetDefaultMemPool(cudaMemPool_t *memPool, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetDefaultMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, cudaMemPool_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, memPool); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetMemPool(cudaMemPool_t *memPool, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetNvSciSyncAttributes( - void *nvSciSyncAttrList, int device, int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, int); - static auto func_ptr = - LoadSymbol("cudaDeviceGetNvSciSyncAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(nvSciSyncAttrList, device, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, - int srcDevice, int dstDevice) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceP2PAttr, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetP2PAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, srcDevice, dstDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaChooseDevice(int *device, const struct cudaDeviceProp *prop) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const struct cudaDeviceProp *); - static auto func_ptr = LoadSymbol("cudaChooseDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, prop); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDevice(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaSetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDevice(int *device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetValidDevices(int *device_arr, - int len) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int); - static auto func_ptr = LoadSymbol("cudaSetValidDevices"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device_arr, len); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDeviceFlags(unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int); - static auto func_ptr = LoadSymbol("cudaSetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDeviceFlags(unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamCreate(cudaStream_t *pStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *); - static auto func_ptr = LoadSymbol("cudaStreamCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithPriority(cudaStream_t *pStream, unsigned int flags, - int priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int, int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetPriority(cudaStream_t hStream, int *priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, int *); - static auto func_ptr = LoadSymbol("cudaStreamGetPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, unsigned int *); - static auto func_ptr = LoadSymbol("cudaStreamGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaCtxResetPersistingL2Cache(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaCtxResetPersistingL2Cache"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamCopyAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, - cudaStreamAttrValue *value_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamAttrID, - cudaStreamAttrValue *); - static auto func_ptr = LoadSymbol("cudaStreamGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, attr, value_out); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, - const cudaStreamAttrValue *value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamAttrID, - const cudaStreamAttrValue *); - static auto func_ptr = LoadSymbol("cudaStreamSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, attr, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamDestroy(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent( - cudaStream_t stream, cudaEvent_t event, unsigned int flags __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, cudaEvent_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamWaitEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, event, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, - void *userData, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamCallback_t, - void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAddCallback"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, callback, userData, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamSynchronize(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, - size_t length __dv(0), unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAttachMemAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, devPtr, length, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamBeginCapture(cudaStream_t stream, enum cudaStreamCaptureMode mode) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureMode); - static auto func_ptr = LoadSymbol("cudaStreamBeginCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaThreadExchangeStreamCaptureMode(enum cudaStreamCaptureMode *mode) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaStreamCaptureMode *); - static auto func_ptr = - LoadSymbol("cudaThreadExchangeStreamCaptureMode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaStreamEndCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamIsCapturing( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureStatus *); - static auto func_ptr = LoadSymbol("cudaStreamIsCapturing"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus, - unsigned long long *pId) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaStream_t, enum cudaStreamCaptureStatus *, unsigned long long *); - static auto func_ptr = LoadSymbol("cudaStreamGetCaptureInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus, pId); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo_v2( - cudaStream_t stream, enum cudaStreamCaptureStatus *captureStatus_out, - unsigned long long *id_out __dv(0), cudaGraph_t *graph_out __dv(0), - const cudaGraphNode_t **dependencies_out __dv(0), - size_t *numDependencies_out __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaStream_t, enum cudaStreamCaptureStatus *, unsigned long long *, - cudaGraph_t *, const cudaGraphNode_t **, size_t *); - static auto func_ptr = LoadSymbol("cudaStreamGetCaptureInfo_v2"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, captureStatus_out, id_out, graph_out, - dependencies_out, numDependencies_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamUpdateCaptureDependencies( - cudaStream_t stream, cudaGraphNode_t *dependencies, size_t numDependencies, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraphNode_t *, - size_t, unsigned int); - static auto func_ptr = - LoadSymbol("cudaStreamUpdateCaptureDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, dependencies, numDependencies, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventCreate(cudaEvent_t *event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaEventCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaEventRecord"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream __dv(0), - unsigned int flags __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventRecordWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventQuery(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventSynchronize(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventDestroy(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventElapsedTime(float *ms, - cudaEvent_t start, - cudaEvent_t end) { - using FuncPtr = cudaError_t(CUDARTAPI *)(float *, cudaEvent_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventElapsedTime"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ms, start, end); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalMemory( - cudaExternalMemory_t *extMem_out, - const struct cudaExternalMemoryHandleDesc *memHandleDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaExternalMemory_t *, const struct cudaExternalMemoryHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem_out, memHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedBuffer( - void **devPtr, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryBufferDesc *bufferDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaExternalMemory_t, - const struct cudaExternalMemoryBufferDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedBuffer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, extMem, bufferDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmap, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryMipmappedArrayDesc *mipmapDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, cudaExternalMemory_t, - const struct cudaExternalMemoryMipmappedArrayDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmap, extMem, mipmapDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalMemory(cudaExternalMemory_t extMem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalMemory_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalSemaphore( - cudaExternalSemaphore_t *extSem_out, - const struct cudaExternalSemaphoreHandleDesc *semHandleDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem_out, semHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreSignalParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreSignalParams *, - unsigned int, cudaStream_t); - static auto func_ptr = LoadSymbol( - "__CUDART_API_PTSZ(cudaSignalExternalSemaphoresAsync_v2)"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreWaitParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreWaitParams *, - unsigned int, cudaStream_t); - static auto func_ptr = LoadSymbol( - "__CUDART_API_PTSZ(cudaWaitExternalSemaphoresAsync_v2)"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem); -} - -extern __host__ cudaError_t CUDARTAPI -cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchKernelExC( - const cudaLaunchConfig_t *config, const void *func, void **args) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const cudaLaunchConfig_t *, - const void *, void **); - static auto func_ptr = LoadSymbol("cudaLaunchKernelExC"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config, func, args); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel( - const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchCooperativeKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaLaunchCooperativeKernelMultiDevice( - struct cudaLaunchParams *launchParamsList, unsigned int numDevices, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaLaunchParams *, - unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaLaunchCooperativeKernelMultiDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(launchParamsList, numDevices, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetCacheConfig(const void *func, enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaFuncSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, cacheConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetSharedMemConfig(const void *func, enum cudaSharedMemConfig config) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaFuncSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, config); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaFuncAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaFuncGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attr, func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncAttribute, int); - static auto func_ptr = LoadSymbol("cudaFuncSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, attr, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForDevice(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForHost(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchHostFunc(cudaStream_t stream, - cudaHostFn_t fn, - void *userData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaHostFn_t, void *); - static auto func_ptr = LoadSymbol("cudaLaunchHostFunc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, fn, userData); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, - int blockSize, - size_t dynamicSMemSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxActiveBlocksPerMultiprocessor"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyAvailableDynamicSMemPerBlock(size_t *dynamicSmemSize, - const void *func, int numBlocks, - int blockSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *, int, int); - static auto func_ptr = - LoadSymbol("cudaOccupancyAvailableDynamicSMemPerBlock"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dynamicSmemSize, func, numBlocks, blockSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, - const void *func, - int blockSize, - size_t dynamicSMemSize, - unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t, unsigned int); - static auto func_ptr = LoadSymbol( - "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxPotentialClusterSize(int *clusterSize, const void *func, - const cudaLaunchConfig_t *launchConfig) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, const cudaLaunchConfig_t *); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxPotentialClusterSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(clusterSize, func, launchConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveClusters(int *numClusters, const void *func, - const cudaLaunchConfig_t *launchConfig) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, const cudaLaunchConfig_t *); - static auto func_ptr = LoadSymbol("cudaOccupancyMaxActiveClusters"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numClusters, func, launchConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMallocManaged(void **devPtr, size_t size, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocManaged"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMalloc(void **devPtr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMalloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocHost(void **ptr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMallocHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocPitch(void **devPtr, - size_t *pitch, - size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMallocPitch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocArray( - cudaArray_t *array, const struct cudaChannelFormatDesc *desc, size_t width, - size_t height __dv(0), unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - size_t, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, width, height, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFree(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFree"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeHost(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFreeHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeArray(cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t); - static auto func_ptr = LoadSymbol("cudaFreeArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t); - static auto func_ptr = LoadSymbol("cudaFreeMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostAlloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pHost, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostRegister(void *ptr, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostRegister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostUnregister(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaHostUnregister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaHostGetDevicePointer(void **pDevice, void *pHost, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostGetDevicePointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pDevice, pHost, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostGetFlags(unsigned int *pFlags, - void *pHost) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *, void *); - static auto func_ptr = LoadSymbol("cudaHostGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pFlags, pHost); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3D(struct cudaPitchedPtr *pitchedDevPtr, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr *, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMalloc3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, extent); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3DArray(cudaArray_t *array, const struct cudaChannelFormatDesc *desc, - struct cudaExtent extent, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int); - static auto func_ptr = LoadSymbol("cudaMalloc3DArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, extent, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, - const struct cudaChannelFormatDesc *desc, struct cudaExtent extent, - unsigned int numLevels, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, desc, extent, numLevels, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetMipmappedArrayLevel( - cudaArray_t *levelArray, cudaMipmappedArray_const_t mipmappedArray, - unsigned int level) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaMipmappedArray_const_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGetMipmappedArrayLevel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(levelArray, mipmappedArray, level); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3D(const struct cudaMemcpy3DParms *p) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync( - const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync( - const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemGetInfo(size_t *free, - size_t *total) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaMemGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(free, total); -} - -extern __host__ cudaError_t CUDARTAPI -cudaArrayGetInfo(struct cudaChannelFormatDesc *desc, struct cudaExtent *extent, - unsigned int *flags, cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - struct cudaExtent *, unsigned int *, - cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, extent, flags, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaArrayGetPlane( - cudaArray_t *pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t *, cudaArray_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaArrayGetPlane"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pPlaneArray, hArray, planeIdx); -} - -extern __host__ cudaError_t CUDARTAPI cudaArrayGetMemoryRequirements( - struct cudaArrayMemoryRequirements *memoryRequirements, cudaArray_t array, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaArrayMemoryRequirements *, - cudaArray_t, int); - static auto func_ptr = LoadSymbol("cudaArrayGetMemoryRequirements"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memoryRequirements, array, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMipmappedArrayGetMemoryRequirements( - struct cudaArrayMemoryRequirements *memoryRequirements, - cudaMipmappedArray_t mipmap, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaArrayMemoryRequirements *, - cudaMipmappedArray_t, int); - static auto func_ptr = - LoadSymbol("cudaMipmappedArrayGetMemoryRequirements"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memoryRequirements, mipmap, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaArrayGetSparseProperties( - struct cudaArraySparseProperties *sparseProperties, cudaArray_t array) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaArraySparseProperties *, cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetSparseProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(sparseProperties, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaMipmappedArrayGetSparseProperties( - struct cudaArraySparseProperties *sparseProperties, - cudaMipmappedArray_t mipmap) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaArraySparseProperties *, - cudaMipmappedArray_t); - static auto func_ptr = - LoadSymbol("cudaMipmappedArrayGetSparseProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(sparseProperties, mipmap); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, - size_t count, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeer(void *dst, int dstDevice, - const void *src, - int srcDevice, - size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, int, const void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, - const void *src, - size_t spitch, size_t width, - size_t height, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, size_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, - size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - cudaArray_const_t, size_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol( - const void *symbol, const void *src, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol( - void *dst, const void *symbol, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemcpyAsync(void *dst, const void *src, size_t count, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, - size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, const void *, int, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync( - void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, - size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - const void *, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, - size_t, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync( - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync( - void *dst, const void *symbol, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, - size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, - int value, size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemset2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset3D( - struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMemset3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync( - void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemsetAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, - size_t height, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, - struct cudaExtent extent, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, - struct cudaExtent, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolAddress(void **devPtr, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolAddress"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolSize(size_t *size, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(size, symbol); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, size_t, int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemPrefetchAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, dstDevice, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, - enum cudaMemoryAdvise, int); - static auto func_ptr = LoadSymbol("cudaMemAdvise"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, advice, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute( - void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, - const void *devPtr, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, size_t, enum cudaMemRangeAttribute, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSize, attribute, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes( - void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, - size_t numAttributes, const void *devPtr, size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, enum cudaMemRangeAttribute *, - size_t, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSizes, attributes, numAttributes, devPtr, count); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t, size_t, size_t, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, cudaArray_const_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind, stream); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArrayAsync(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocAsync(void **devPtr, - size_t size, - cudaStream_t hStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMallocAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, hStream); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeAsync(void *devPtr, - cudaStream_t hStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaFreeAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, hStream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolTrimTo(cudaMemPool_t memPool, - size_t minBytesToKeep) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemPoolTrimTo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, minBytesToKeep); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolSetAttribute( - cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMemPool_t, enum cudaMemPoolAttr, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolGetAttribute( - cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMemPool_t, enum cudaMemPoolAttr, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolSetAccess(cudaMemPool_t memPool, - const struct cudaMemAccessDesc *descList, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMemPool_t, const struct cudaMemAccessDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaMemPoolSetAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, descList, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolGetAccess(enum cudaMemAccessFlags *flags, cudaMemPool_t memPool, - struct cudaMemLocation *location) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - enum cudaMemAccessFlags *, cudaMemPool_t, struct cudaMemLocation *); - static auto func_ptr = LoadSymbol("cudaMemPoolGetAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags, memPool, location); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolCreate( - cudaMemPool_t *memPool, const struct cudaMemPoolProps *poolProps) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, - const struct cudaMemPoolProps *); - static auto func_ptr = LoadSymbol("cudaMemPoolCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, poolProps); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolDestroy(cudaMemPool_t memPool) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t); - static auto func_ptr = LoadSymbol("cudaMemPoolDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocFromPoolAsync( - void **ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t, cudaMemPool_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMallocFromPoolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, memPool, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportToShareableHandle( - void *shareableHandle, cudaMemPool_t memPool, - enum cudaMemAllocationHandleType handleType, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, cudaMemPool_t, enum cudaMemAllocationHandleType, unsigned int); - static auto func_ptr = - LoadSymbol("cudaMemPoolExportToShareableHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(shareableHandle, memPool, handleType, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolImportFromShareableHandle( - cudaMemPool_t *memPool, void *shareableHandle, - enum cudaMemAllocationHandleType handleType, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMemPool_t *, void *, enum cudaMemAllocationHandleType, unsigned int); - static auto func_ptr = - LoadSymbol("cudaMemPoolImportFromShareableHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, shareableHandle, handleType, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportPointer( - struct cudaMemPoolPtrExportData *exportData, void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaMemPoolPtrExportData *, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolExportPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(exportData, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolImportPointer(void **ptr, cudaMemPool_t memPool, - struct cudaMemPoolPtrExportData *exportData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, cudaMemPool_t, - struct cudaMemPoolPtrExportData *); - static auto func_ptr = LoadSymbol("cudaMemPoolImportPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, memPool, exportData); -} - -extern __host__ cudaError_t CUDARTAPI cudaPointerGetAttributes( - struct cudaPointerAttributes *attributes, const void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPointerAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaPointerGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attributes, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceCanAccessPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(canAccessPeer, device, peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, unsigned int); - static auto func_ptr = LoadSymbol("cudaDeviceEnablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceDisablePeerAccess(int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceDisablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnregisterResource"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceSetMapFlags( - cudaGraphicsResource_t resource, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphicsResourceSetMapFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsMapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsMapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnmapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnmapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedPointer( - void **devPtr, size_t *size, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsSubResourceGetMappedArray( - cudaArray_t *array, cudaGraphicsResource_t resource, - unsigned int arrayIndex, unsigned int mipLevel) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaGraphicsResource_t, unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaGraphicsSubResourceGetMappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, resource, arrayIndex, mipLevel); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsResourceGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, resource); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindTexture( - size_t *offset, const struct textureReference *texref, const void *devPtr, - const struct cudaChannelFormatDesc *desc, size_t size __dv(UINT_MAX)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, size); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaBindTexture2D(size_t *offset, const struct textureReference *texref, - const void *devPtr, const struct cudaChannelFormatDesc *desc, - size_t width, size_t height, size_t pitch) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, width, height, pitch); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindTextureToArray( - const struct textureReference *texref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, array, desc); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaBindTextureToMipmappedArray(const struct textureReference *texref, - cudaMipmappedArray_const_t mipmappedArray, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaMipmappedArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, mipmappedArray, desc); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaUnbindTexture(const struct textureReference *texref) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaUnbindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaGetTextureAlignmentOffset(size_t *offset, - const struct textureReference *texref) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(size_t *, const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaGetTextureAlignmentOffset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGetTextureReference( - const struct textureReference **texref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct textureReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetTextureReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, symbol); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaBindSurfaceToArray( - const struct surfaceReference *surfref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct surfaceReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindSurfaceToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, array, desc); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGetSurfaceReference( - const struct surfaceReference **surfref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct surfaceReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSurfaceReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetChannelDesc( - struct cudaChannelFormatDesc *desc, cudaArray_const_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - cudaArray_const_t); - static auto func_ptr = LoadSymbol("cudaGetChannelDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, array); -} - -extern __host__ struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc( - int x, int y, int z, int w, enum cudaChannelFormatKind f) { - using FuncPtr = struct cudaChannelFormatDesc(CUDARTAPI *)( - int, int, int, int, enum cudaChannelFormatKind); - static auto func_ptr = LoadSymbol("cudaCreateChannelDesc"); - return func_ptr(x, y, z, w, f); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject( - cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, - const struct cudaTextureDesc *pTexDesc, - const struct cudaResourceViewDesc *pResViewDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaTextureObject_t *, const struct cudaResourceDesc *, - const struct cudaTextureDesc *, const struct cudaResourceViewDesc *); - static auto func_ptr = LoadSymbol("cudaCreateTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexObject, pResDesc, pTexDesc, pResViewDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject_v2( - cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, - const struct cudaTextureDesc_v2 *pTexDesc, - const struct cudaResourceViewDesc *pResViewDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaTextureObject_t *, const struct cudaResourceDesc *, - const struct cudaTextureDesc_v2 *, const struct cudaResourceViewDesc *); - static auto func_ptr = LoadSymbol("cudaCreateTextureObject_v2"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexObject, pResDesc, pTexDesc, pResViewDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyTextureObject(cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaDestroyTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc( - struct cudaTextureDesc *pTexDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaTextureDesc *, cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaGetTextureObjectTextureDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc_v2( - struct cudaTextureDesc_v2 *pTexDesc, cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaTextureDesc_v2 *, - cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectTextureDesc_v2"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceViewDesc( - struct cudaResourceViewDesc *pResViewDesc, cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaResourceViewDesc *, - cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceViewDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResViewDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateSurfaceObject( - cudaSurfaceObject_t *pSurfObject, const struct cudaResourceDesc *pResDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t *, - const struct cudaResourceDesc *); - static auto func_ptr = LoadSymbol("cudaCreateSurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pSurfObject, pResDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t); - static auto func_ptr = LoadSymbol("cudaDestroySurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaSurfaceObject_t surfObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaSurfaceObject_t); - static auto func_ptr = - LoadSymbol("cudaGetSurfaceObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaDriverGetVersion(int *driverVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaDriverGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(driverVersion); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaRuntimeGetVersion(int *runtimeVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaRuntimeGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(runtimeVersion); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphCreate(cudaGraph_t *pGraph, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraph, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddKernelNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddKernelNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetParams( - cudaGraphNode_t node, struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParams( - cudaGraphNode_t node, const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t); - static auto func_ptr = - LoadSymbol("cudaGraphKernelNodeCopyAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hSrc, hDst); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetAttribute( - cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, - cudaKernelNodeAttrValue *value_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, cudaKernelNodeAttrID, cudaKernelNodeAttrValue *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, attr, value_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetAttribute( - cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, - const cudaKernelNodeAttrValue *value) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, cudaKernelNodeAttrID, const cudaKernelNodeAttrValue *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemcpy3DParms *pCopyParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pCopyParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNodeToSymbol( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, - const void *, const void *, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNodeToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, symbol, - src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNodeFromSymbol( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, void *dst, - const void *symbol, size_t count, size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, void *, - const void *, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphAddMemcpyNodeFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, dst, - symbol, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode1D( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, void *dst, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, void *, - const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode1D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, dst, src, - count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeGetParams( - cudaGraphNode_t node, struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParams( - cudaGraphNode_t node, const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParamsToSymbol( - cudaGraphNode_t node, const void *symbol, const void *src, size_t count, - size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, const void *, const void *, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphMemcpyNodeSetParamsToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParamsFromSymbol( - cudaGraphNode_t node, void *dst, const void *symbol, size_t count, - size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphMemcpyNodeSetParamsFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, dst, symbol, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void *dst, const void *src, - size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, void *, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams1D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemsetNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemsetParams *pMemsetParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemsetNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pMemsetParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeGetParams( - cudaGraphNode_t node, struct cudaMemsetParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeSetParams( - cudaGraphNode_t node, const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddHostNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddHostNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeGetParams( - cudaGraphNode_t node, struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeSetParams( - cudaGraphNode_t node, const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddChildGraphNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaGraph_t childGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphAddChildGraphNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - childGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaGraphChildGraphNodeGetGraph"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddEmptyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEmptyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddEventRecordNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEventRecordNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t *event_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t *); - static auto func_ptr = - LoadSymbol("cudaGraphEventRecordNodeGetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = - LoadSymbol("cudaGraphEventRecordNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddEventWaitNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEventWaitNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t *event_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaGraphEventWaitNodeGetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphEventWaitNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddExternalSemaphoresSignalNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaExternalSemaphoreSignalNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, - const struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphAddExternalSemaphoresSignalNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresSignalNodeGetParams( - cudaGraphNode_t hNode, - struct cudaExternalSemaphoreSignalNodeParams *params_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresSignalNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, params_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresSignalNodeSetParams( - cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreSignalNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, const struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresSignalNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddExternalSemaphoresWaitNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaExternalSemaphoreWaitNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, - const struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphAddExternalSemaphoresWaitNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresWaitNodeGetParams( - cudaGraphNode_t hNode, - struct cudaExternalSemaphoreWaitNodeParams *params_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresWaitNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, params_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresWaitNodeSetParams( - cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreWaitNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, const struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresWaitNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemAllocNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - struct cudaMemAllocNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - struct cudaMemAllocNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemAllocNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemAllocNodeGetParams( - cudaGraphNode_t node, struct cudaMemAllocNodeParams *params_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - struct cudaMemAllocNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemAllocNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, params_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemFreeNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, void *dptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, void *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemFreeNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, dptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void *dptr_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, void *); - static auto func_ptr = LoadSymbol("cudaGraphMemFreeNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, dptr_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGraphMemTrim(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceGraphMemTrim"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetGraphMemAttribute( - int device, enum cudaGraphMemAttributeType attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, enum cudaGraphMemAttributeType, void *); - static auto func_ptr = LoadSymbol("cudaDeviceGetGraphMemAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetGraphMemAttribute( - int device, enum cudaGraphMemAttributeType attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, enum cudaGraphMemAttributeType, void *); - static auto func_ptr = LoadSymbol("cudaDeviceSetGraphMemAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphClone(cudaGraph_t *pGraphClone, cudaGraph_t originalGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphClone, originalGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeFindInClone(cudaGraphNode_t *pNode, cudaGraphNode_t originalNode, - cudaGraph_t clonedGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphNodeFindInClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pNode, originalNode, clonedGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeGetType(cudaGraphNode_t node, enum cudaGraphNodeType *pType) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaGraphNodeType *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetType"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pType); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetNodes(cudaGraph_t graph, - cudaGraphNode_t *nodes, - size_t *numNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, nodes, numNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetRootNodes( - cudaGraph_t graph, cudaGraphNode_t *pRootNodes, size_t *pNumRootNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetRootNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, pRootNodes, pNumRootNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetEdges(cudaGraph_t graph, - cudaGraphNode_t *from, - cudaGraphNode_t *to, - size_t *numEdges) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, - cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetEdges"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numEdges); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependencies( - cudaGraphNode_t node, cudaGraphNode_t *pDependencies, - size_t *pNumDependencies) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependencies, pNumDependencies); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependentNodes( - cudaGraphNode_t node, cudaGraphNode_t *pDependentNodes, - size_t *pNumDependentNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependentNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependentNodes, pNumDependentNodes); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphRemoveDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphDestroyNode(cudaGraphNode_t node) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiate( - cudaGraphExec_t *pGraphExec, cudaGraph_t graph, cudaGraphNode_t *pErrorNode, - char *pLogBuffer, size_t bufferSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - cudaGraphNode_t *, char *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphInstantiate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, pErrorNode, pLogBuffer, bufferSize); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphInstantiateWithFlags( - cudaGraphExec_t *pGraphExec, cudaGraph_t graph, unsigned long long flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - unsigned long long); - static auto func_ptr = LoadSymbol("cudaGraphInstantiateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecKernelNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParamsToSymbol( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const void *symbol, - const void *src, size_t count, size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParamsToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecMemcpyNodeSetParamsFromSymbol(cudaGraphExec_t hGraphExec, - cudaGraphNode_t node, void *dst, - const void *symbol, size_t count, - size_t offset, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParamsFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, dst, symbol, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams1D( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void *dst, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, void *, - const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParams1D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemsetNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphExecHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecChildGraphNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = - LoadSymbol("cudaGraphExecChildGraphNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, childGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecEventRecordNodeSetEvent( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = - LoadSymbol("cudaGraphExecEventRecordNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, event); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecEventWaitNodeSetEvent( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = - LoadSymbol("cudaGraphExecEventWaitNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecExternalSemaphoresSignalNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreSignalNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphExec_t, cudaGraphNode_t, - const struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecExternalSemaphoresSignalNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecExternalSemaphoresWaitNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreWaitNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphExec_t, cudaGraphNode_t, - const struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecExternalSemaphoresWaitNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeSetEnabled( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphNodeSetEnabled"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, isEnabled); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, - unsigned int *isEnabled) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - unsigned int *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetEnabled"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, isEnabled); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, - cudaGraphNode_t *hErrorNode_out, - enum cudaGraphExecUpdateResult *updateResult_out) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraph_t, cudaGraphNode_t *, - enum cudaGraphExecUpdateResult *); - static auto func_ptr = LoadSymbol("cudaGraphExecUpdate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hGraph, hErrorNode_out, updateResult_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphUpload(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphUpload"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphLaunch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecDestroy(cudaGraphExec_t graphExec) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t); - static auto func_ptr = LoadSymbol("cudaGraphExecDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDestroy(cudaGraph_t graph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDebugDotPrint( - cudaGraph_t graph, const char *path, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, const char *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphDebugDotPrint"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, path, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaUserObjectCreate( - cudaUserObject_t *object_out, void *ptr, cudaHostFn_t destroy, - unsigned int initialRefcount, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaUserObject_t *, void *, cudaHostFn_t, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object_out, ptr, destroy, initialRefcount, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUserObjectRetain(cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectRetain"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUserObjectRelease(cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectRelease"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphRetainUserObject( - cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1), - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaUserObject_t, - unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphRetainUserObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, object, count, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphReleaseUserObject( - cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphReleaseUserObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, object, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDriverEntryPoint( - const char *symbol, void **funcPtr, unsigned long long flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const char *, void **, unsigned long long); - static auto func_ptr = LoadSymbol("cudaGetDriverEntryPoint"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, funcPtr, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetExportTable( - const void **ppExportTable, const cudaUUID_t *pExportTableId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void **, const cudaUUID_t *); - static auto func_ptr = LoadSymbol("cudaGetExportTable"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ppExportTable, pExportTableId); -} - -extern __host__ cudaError_t CUDARTAPI_CDECL -cudaGetFuncBySymbol(cudaFunction_t *functionPtr, const void *symbolPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaFunction_t *, const void *); - static auto func_ptr = LoadSymbol("_CDECL cudaGetFuncBySymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(functionPtr, symbolPtr); -} - -} // extern "C" diff --git a/source/lib/src/gpu/cudart/cuda_runtime_12_0.inc b/source/lib/src/gpu/cudart/cuda_runtime_12_0.inc deleted file mode 100644 index 343db23132..0000000000 --- a/source/lib/src/gpu/cudart/cuda_runtime_12_0.inc +++ /dev/null @@ -1,2676 +0,0 @@ -// Auto-generated, do not edit. - -extern "C" { -extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceReset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, - size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaDeviceGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetTexture1DLinearMaxWidth( - size_t *maxWidthInElements, const struct cudaChannelFormatDesc *fmtDesc, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct cudaChannelFormatDesc *, int); - static auto func_ptr = - LoadSymbol("cudaDeviceGetTexture1DLinearMaxWidth"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(maxWidthInElements, fmtDesc, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaDeviceGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int *); - static auto func_ptr = - LoadSymbol("cudaDeviceGetStreamPriorityRange"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(leastPriority, greatestPriority); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaDeviceSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig *); - static auto func_ptr = LoadSymbol("cudaDeviceGetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaDeviceSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetByPCIBusId(int *device, const char *pciBusId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const char *); - static auto func_ptr = LoadSymbol("cudaDeviceGetByPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, pciBusId); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, - int len, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(char *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pciBusId, len, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcEventHandle_t *, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaIpcGetEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, cudaIpcEventHandle_t); - static auto func_ptr = LoadSymbol("cudaIpcOpenEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, handle); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcMemHandle_t *, void *); - static auto func_ptr = LoadSymbol("cudaIpcGetMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle( - void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaIpcMemHandle_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaIpcOpenMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, handle, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaIpcCloseMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceFlushGPUDirectRDMAWrites( - enum cudaFlushGPUDirectRDMAWritesTarget target, - enum cudaFlushGPUDirectRDMAWritesScope scope) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(enum cudaFlushGPUDirectRDMAWritesTarget, - enum cudaFlushGPUDirectRDMAWritesScope); - static auto func_ptr = - LoadSymbol("cudaDeviceFlushGPUDirectRDMAWrites"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(target, scope); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadExit(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadExit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetLimit(enum cudaLimit limit, size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaThreadSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaThreadGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaThreadGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaThreadSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaThreadSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaGetLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaPeekAtLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaPeekAtLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorName(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorName"); - if (!func_ptr) return "cudaGetErrorName symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorString(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorString"); - if (!func_ptr) return "cudaGetErrorString symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceCount(int *count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceCount"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaDeviceProp *, int); - static auto func_ptr = LoadSymbol("cudaGetDeviceProperties_v2"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(prop, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceAttr, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetDefaultMemPool(cudaMemPool_t *memPool, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetDefaultMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, cudaMemPool_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, memPool); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetMemPool(cudaMemPool_t *memPool, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetMemPool"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetNvSciSyncAttributes( - void *nvSciSyncAttrList, int device, int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, int); - static auto func_ptr = - LoadSymbol("cudaDeviceGetNvSciSyncAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(nvSciSyncAttrList, device, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, - int srcDevice, int dstDevice) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceP2PAttr, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetP2PAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, srcDevice, dstDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaChooseDevice(int *device, const struct cudaDeviceProp *prop) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const struct cudaDeviceProp *); - static auto func_ptr = LoadSymbol("cudaChooseDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, prop); -} - -extern __host__ cudaError_t CUDARTAPI cudaInitDevice(int device, - unsigned int deviceFlags, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaInitDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, deviceFlags, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDevice(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaSetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDevice(int *device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetValidDevices(int *device_arr, - int len) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int); - static auto func_ptr = LoadSymbol("cudaSetValidDevices"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device_arr, len); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDeviceFlags(unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int); - static auto func_ptr = LoadSymbol("cudaSetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDeviceFlags(unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamCreate(cudaStream_t *pStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *); - static auto func_ptr = LoadSymbol("cudaStreamCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithPriority(cudaStream_t *pStream, unsigned int flags, - int priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int, int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetPriority(cudaStream_t hStream, int *priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, int *); - static auto func_ptr = LoadSymbol("cudaStreamGetPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, unsigned int *); - static auto func_ptr = LoadSymbol("cudaStreamGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetId(cudaStream_t hStream, unsigned long long *streamId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, unsigned long long *); - static auto func_ptr = LoadSymbol("cudaStreamGetId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, streamId); -} - -extern __host__ cudaError_t CUDARTAPI cudaCtxResetPersistingL2Cache(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaCtxResetPersistingL2Cache"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamCopyAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, - cudaStreamAttrValue *value_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamAttrID, - cudaStreamAttrValue *); - static auto func_ptr = LoadSymbol("cudaStreamGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, attr, value_out); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, - const cudaStreamAttrValue *value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamAttrID, - const cudaStreamAttrValue *); - static auto func_ptr = LoadSymbol("cudaStreamSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, attr, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamDestroy(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent( - cudaStream_t stream, cudaEvent_t event, unsigned int flags __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, cudaEvent_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamWaitEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, event, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, - void *userData, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamCallback_t, - void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAddCallback"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, callback, userData, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamSynchronize(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, - size_t length __dv(0), unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAttachMemAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, devPtr, length, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamBeginCapture(cudaStream_t stream, enum cudaStreamCaptureMode mode) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureMode); - static auto func_ptr = LoadSymbol("cudaStreamBeginCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaThreadExchangeStreamCaptureMode(enum cudaStreamCaptureMode *mode) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaStreamCaptureMode *); - static auto func_ptr = - LoadSymbol("cudaThreadExchangeStreamCaptureMode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mode); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaStreamEndCapture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamIsCapturing( - cudaStream_t stream, enum cudaStreamCaptureStatus *pCaptureStatus) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, enum cudaStreamCaptureStatus *); - static auto func_ptr = LoadSymbol("cudaStreamIsCapturing"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, pCaptureStatus); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamGetCaptureInfo( - cudaStream_t stream, enum cudaStreamCaptureStatus *captureStatus_out, - unsigned long long *id_out __dv(0), cudaGraph_t *graph_out __dv(0), - const cudaGraphNode_t **dependencies_out __dv(0), - size_t *numDependencies_out __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaStream_t, enum cudaStreamCaptureStatus *, unsigned long long *, - cudaGraph_t *, const cudaGraphNode_t **, size_t *); - static auto func_ptr = - LoadSymbol("__CUDART_API_PTSZ(cudaStreamGetCaptureInfo_v2)"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, captureStatus_out, id_out, graph_out, - dependencies_out, numDependencies_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamUpdateCaptureDependencies( - cudaStream_t stream, cudaGraphNode_t *dependencies, size_t numDependencies, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaGraphNode_t *, - size_t, unsigned int); - static auto func_ptr = - LoadSymbol("cudaStreamUpdateCaptureDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, dependencies, numDependencies, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventCreate(cudaEvent_t *event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaEventCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaEventRecord"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream __dv(0), - unsigned int flags __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventRecordWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventQuery(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventSynchronize(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventDestroy(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventElapsedTime(float *ms, - cudaEvent_t start, - cudaEvent_t end) { - using FuncPtr = cudaError_t(CUDARTAPI *)(float *, cudaEvent_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventElapsedTime"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ms, start, end); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalMemory( - cudaExternalMemory_t *extMem_out, - const struct cudaExternalMemoryHandleDesc *memHandleDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaExternalMemory_t *, const struct cudaExternalMemoryHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem_out, memHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedBuffer( - void **devPtr, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryBufferDesc *bufferDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaExternalMemory_t, - const struct cudaExternalMemoryBufferDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedBuffer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, extMem, bufferDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaExternalMemoryGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmap, cudaExternalMemory_t extMem, - const struct cudaExternalMemoryMipmappedArrayDesc *mipmapDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, cudaExternalMemory_t, - const struct cudaExternalMemoryMipmappedArrayDesc *); - static auto func_ptr = - LoadSymbol("cudaExternalMemoryGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmap, extMem, mipmapDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalMemory(cudaExternalMemory_t extMem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalMemory_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalMemory"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extMem); -} - -extern __host__ cudaError_t CUDARTAPI cudaImportExternalSemaphore( - cudaExternalSemaphore_t *extSem_out, - const struct cudaExternalSemaphoreHandleDesc *semHandleDesc) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreHandleDesc *); - static auto func_ptr = LoadSymbol("cudaImportExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem_out, semHandleDesc); -} - -extern __host__ cudaError_t CUDARTAPI cudaSignalExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreSignalParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreSignalParams *, - unsigned int, cudaStream_t); - static auto func_ptr = LoadSymbol( - "__CUDART_API_PTSZ(cudaSignalExternalSemaphoresAsync_v2)"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaWaitExternalSemaphoresAsync( - const cudaExternalSemaphore_t *extSemArray, - const struct cudaExternalSemaphoreWaitParams *paramsArray, - unsigned int numExtSems, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const cudaExternalSemaphore_t *, - const struct cudaExternalSemaphoreWaitParams *, - unsigned int, cudaStream_t); - static auto func_ptr = LoadSymbol( - "__CUDART_API_PTSZ(cudaWaitExternalSemaphoresAsync_v2)"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSemArray, paramsArray, numExtSems, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaExternalSemaphore_t); - static auto func_ptr = LoadSymbol("cudaDestroyExternalSemaphore"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(extSem); -} - -extern __host__ cudaError_t CUDARTAPI -cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchKernelExC( - const cudaLaunchConfig_t *config, const void *func, void **args) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const cudaLaunchConfig_t *, - const void *, void **); - static auto func_ptr = LoadSymbol("cudaLaunchKernelExC"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config, func, args); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel( - const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchCooperativeKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaLaunchCooperativeKernelMultiDevice( - struct cudaLaunchParams *launchParamsList, unsigned int numDevices, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaLaunchParams *, - unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaLaunchCooperativeKernelMultiDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(launchParamsList, numDevices, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetCacheConfig(const void *func, enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaFuncSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, cacheConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetSharedMemConfig(const void *func, enum cudaSharedMemConfig config) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaFuncSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, config); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaFuncAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaFuncGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attr, func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncAttribute, int); - static auto func_ptr = LoadSymbol("cudaFuncSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, attr, value); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForDevice(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaSetDoubleForHost(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchHostFunc(cudaStream_t stream, - cudaHostFn_t fn, - void *userData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaHostFn_t, void *); - static auto func_ptr = LoadSymbol("cudaLaunchHostFunc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, fn, userData); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, - int blockSize, - size_t dynamicSMemSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxActiveBlocksPerMultiprocessor"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyAvailableDynamicSMemPerBlock(size_t *dynamicSmemSize, - const void *func, int numBlocks, - int blockSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *, int, int); - static auto func_ptr = - LoadSymbol("cudaOccupancyAvailableDynamicSMemPerBlock"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dynamicSmemSize, func, numBlocks, blockSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, - const void *func, - int blockSize, - size_t dynamicSMemSize, - unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t, unsigned int); - static auto func_ptr = LoadSymbol( - "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxPotentialClusterSize(int *clusterSize, const void *func, - const cudaLaunchConfig_t *launchConfig) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, const cudaLaunchConfig_t *); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxPotentialClusterSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(clusterSize, func, launchConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveClusters(int *numClusters, const void *func, - const cudaLaunchConfig_t *launchConfig) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, const cudaLaunchConfig_t *); - static auto func_ptr = LoadSymbol("cudaOccupancyMaxActiveClusters"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numClusters, func, launchConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMallocManaged(void **devPtr, size_t size, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocManaged"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMalloc(void **devPtr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMalloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocHost(void **ptr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMallocHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocPitch(void **devPtr, - size_t *pitch, - size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMallocPitch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocArray( - cudaArray_t *array, const struct cudaChannelFormatDesc *desc, size_t width, - size_t height __dv(0), unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - size_t, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, width, height, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFree(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFree"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeHost(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFreeHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeArray(cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t); - static auto func_ptr = LoadSymbol("cudaFreeArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t); - static auto func_ptr = LoadSymbol("cudaFreeMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostAlloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pHost, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostRegister(void *ptr, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostRegister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostUnregister(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaHostUnregister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaHostGetDevicePointer(void **pDevice, void *pHost, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostGetDevicePointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pDevice, pHost, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostGetFlags(unsigned int *pFlags, - void *pHost) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *, void *); - static auto func_ptr = LoadSymbol("cudaHostGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pFlags, pHost); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3D(struct cudaPitchedPtr *pitchedDevPtr, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr *, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMalloc3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, extent); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3DArray(cudaArray_t *array, const struct cudaChannelFormatDesc *desc, - struct cudaExtent extent, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int); - static auto func_ptr = LoadSymbol("cudaMalloc3DArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, extent, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, - const struct cudaChannelFormatDesc *desc, struct cudaExtent extent, - unsigned int numLevels, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, desc, extent, numLevels, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetMipmappedArrayLevel( - cudaArray_t *levelArray, cudaMipmappedArray_const_t mipmappedArray, - unsigned int level) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaMipmappedArray_const_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGetMipmappedArrayLevel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(levelArray, mipmappedArray, level); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3D(const struct cudaMemcpy3DParms *p) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync( - const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync( - const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemGetInfo(size_t *free, - size_t *total) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaMemGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(free, total); -} - -extern __host__ cudaError_t CUDARTAPI -cudaArrayGetInfo(struct cudaChannelFormatDesc *desc, struct cudaExtent *extent, - unsigned int *flags, cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - struct cudaExtent *, unsigned int *, - cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, extent, flags, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaArrayGetPlane( - cudaArray_t *pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t *, cudaArray_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaArrayGetPlane"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pPlaneArray, hArray, planeIdx); -} - -extern __host__ cudaError_t CUDARTAPI cudaArrayGetMemoryRequirements( - struct cudaArrayMemoryRequirements *memoryRequirements, cudaArray_t array, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaArrayMemoryRequirements *, - cudaArray_t, int); - static auto func_ptr = LoadSymbol("cudaArrayGetMemoryRequirements"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memoryRequirements, array, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMipmappedArrayGetMemoryRequirements( - struct cudaArrayMemoryRequirements *memoryRequirements, - cudaMipmappedArray_t mipmap, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaArrayMemoryRequirements *, - cudaMipmappedArray_t, int); - static auto func_ptr = - LoadSymbol("cudaMipmappedArrayGetMemoryRequirements"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memoryRequirements, mipmap, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaArrayGetSparseProperties( - struct cudaArraySparseProperties *sparseProperties, cudaArray_t array) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaArraySparseProperties *, cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetSparseProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(sparseProperties, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaMipmappedArrayGetSparseProperties( - struct cudaArraySparseProperties *sparseProperties, - cudaMipmappedArray_t mipmap) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaArraySparseProperties *, - cudaMipmappedArray_t); - static auto func_ptr = - LoadSymbol("cudaMipmappedArrayGetSparseProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(sparseProperties, mipmap); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, - size_t count, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeer(void *dst, int dstDevice, - const void *src, - int srcDevice, - size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, int, const void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, - const void *src, - size_t spitch, size_t width, - size_t height, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, size_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, - size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - cudaArray_const_t, size_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol( - const void *symbol, const void *src, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol( - void *dst, const void *symbol, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemcpyAsync(void *dst, const void *src, size_t count, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, - size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, const void *, int, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync( - void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, - size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - const void *, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, - size_t, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync( - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync( - void *dst, const void *symbol, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, - size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, - int value, size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemset2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset3D( - struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMemset3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync( - void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemsetAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, - size_t height, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, - struct cudaExtent extent, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, - struct cudaExtent, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolAddress(void **devPtr, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolAddress"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolSize(size_t *size, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(size, symbol); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, size_t, int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemPrefetchAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, dstDevice, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, - enum cudaMemoryAdvise, int); - static auto func_ptr = LoadSymbol("cudaMemAdvise"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, advice, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute( - void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, - const void *devPtr, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, size_t, enum cudaMemRangeAttribute, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSize, attribute, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes( - void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, - size_t numAttributes, const void *devPtr, size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, enum cudaMemRangeAttribute *, - size_t, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSizes, attributes, numAttributes, devPtr, count); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t, size_t, size_t, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, cudaArray_const_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - count, kind); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind, stream); -} - -extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArrayAsync(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocAsync(void **devPtr, - size_t size, - cudaStream_t hStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMallocAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, hStream); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeAsync(void *devPtr, - cudaStream_t hStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaFreeAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, hStream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolTrimTo(cudaMemPool_t memPool, - size_t minBytesToKeep) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemPoolTrimTo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, minBytesToKeep); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolSetAttribute( - cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMemPool_t, enum cudaMemPoolAttr, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolGetAttribute( - cudaMemPool_t memPool, enum cudaMemPoolAttr attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMemPool_t, enum cudaMemPoolAttr, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolSetAccess(cudaMemPool_t memPool, - const struct cudaMemAccessDesc *descList, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMemPool_t, const struct cudaMemAccessDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaMemPoolSetAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, descList, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolGetAccess(enum cudaMemAccessFlags *flags, cudaMemPool_t memPool, - struct cudaMemLocation *location) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - enum cudaMemAccessFlags *, cudaMemPool_t, struct cudaMemLocation *); - static auto func_ptr = LoadSymbol("cudaMemPoolGetAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags, memPool, location); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolCreate( - cudaMemPool_t *memPool, const struct cudaMemPoolProps *poolProps) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t *, - const struct cudaMemPoolProps *); - static auto func_ptr = LoadSymbol("cudaMemPoolCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, poolProps); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolDestroy(cudaMemPool_t memPool) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMemPool_t); - static auto func_ptr = LoadSymbol("cudaMemPoolDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocFromPoolAsync( - void **ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t, cudaMemPool_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMallocFromPoolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, memPool, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportToShareableHandle( - void *shareableHandle, cudaMemPool_t memPool, - enum cudaMemAllocationHandleType handleType, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, cudaMemPool_t, enum cudaMemAllocationHandleType, unsigned int); - static auto func_ptr = - LoadSymbol("cudaMemPoolExportToShareableHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(shareableHandle, memPool, handleType, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolImportFromShareableHandle( - cudaMemPool_t *memPool, void *shareableHandle, - enum cudaMemAllocationHandleType handleType, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMemPool_t *, void *, enum cudaMemAllocationHandleType, unsigned int); - static auto func_ptr = - LoadSymbol("cudaMemPoolImportFromShareableHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(memPool, shareableHandle, handleType, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemPoolExportPointer( - struct cudaMemPoolPtrExportData *exportData, void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaMemPoolPtrExportData *, void *); - static auto func_ptr = LoadSymbol("cudaMemPoolExportPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(exportData, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPoolImportPointer(void **ptr, cudaMemPool_t memPool, - struct cudaMemPoolPtrExportData *exportData) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, cudaMemPool_t, - struct cudaMemPoolPtrExportData *); - static auto func_ptr = LoadSymbol("cudaMemPoolImportPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, memPool, exportData); -} - -extern __host__ cudaError_t CUDARTAPI cudaPointerGetAttributes( - struct cudaPointerAttributes *attributes, const void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPointerAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaPointerGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attributes, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceCanAccessPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(canAccessPeer, device, peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, unsigned int); - static auto func_ptr = LoadSymbol("cudaDeviceEnablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceDisablePeerAccess(int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceDisablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnregisterResource"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceSetMapFlags( - cudaGraphicsResource_t resource, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphicsResourceSetMapFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsMapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsMapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnmapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnmapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedPointer( - void **devPtr, size_t *size, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsSubResourceGetMappedArray( - cudaArray_t *array, cudaGraphicsResource_t resource, - unsigned int arrayIndex, unsigned int mipLevel) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaGraphicsResource_t, unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaGraphicsSubResourceGetMappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, resource, arrayIndex, mipLevel); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsResourceGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetChannelDesc( - struct cudaChannelFormatDesc *desc, cudaArray_const_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - cudaArray_const_t); - static auto func_ptr = LoadSymbol("cudaGetChannelDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, array); -} - -extern __host__ struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc( - int x, int y, int z, int w, enum cudaChannelFormatKind f) { - using FuncPtr = struct cudaChannelFormatDesc(CUDARTAPI *)( - int, int, int, int, enum cudaChannelFormatKind); - static auto func_ptr = LoadSymbol("cudaCreateChannelDesc"); - return func_ptr(x, y, z, w, f); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject( - cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, - const struct cudaTextureDesc *pTexDesc, - const struct cudaResourceViewDesc *pResViewDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaTextureObject_t *, const struct cudaResourceDesc *, - const struct cudaTextureDesc *, const struct cudaResourceViewDesc *); - static auto func_ptr = LoadSymbol("cudaCreateTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexObject, pResDesc, pTexDesc, pResViewDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyTextureObject(cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaDestroyTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc( - struct cudaTextureDesc *pTexDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaTextureDesc *, cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaGetTextureObjectTextureDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceViewDesc( - struct cudaResourceViewDesc *pResViewDesc, cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaResourceViewDesc *, - cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceViewDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResViewDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateSurfaceObject( - cudaSurfaceObject_t *pSurfObject, const struct cudaResourceDesc *pResDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t *, - const struct cudaResourceDesc *); - static auto func_ptr = LoadSymbol("cudaCreateSurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pSurfObject, pResDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t); - static auto func_ptr = LoadSymbol("cudaDestroySurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaSurfaceObject_t surfObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaSurfaceObject_t); - static auto func_ptr = - LoadSymbol("cudaGetSurfaceObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaDriverGetVersion(int *driverVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaDriverGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(driverVersion); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaRuntimeGetVersion(int *runtimeVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaRuntimeGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(runtimeVersion); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphCreate(cudaGraph_t *pGraph, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraph, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddKernelNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddKernelNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetParams( - cudaGraphNode_t node, struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParams( - cudaGraphNode_t node, const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t); - static auto func_ptr = - LoadSymbol("cudaGraphKernelNodeCopyAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hSrc, hDst); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeGetAttribute( - cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, - cudaKernelNodeAttrValue *value_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, cudaKernelNodeAttrID, cudaKernelNodeAttrValue *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, attr, value_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetAttribute( - cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, - const cudaKernelNodeAttrValue *value) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, cudaKernelNodeAttrID, const cudaKernelNodeAttrValue *); - static auto func_ptr = LoadSymbol("cudaGraphKernelNodeSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemcpy3DParms *pCopyParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pCopyParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNodeToSymbol( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, - const void *, const void *, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNodeToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, symbol, - src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNodeFromSymbol( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, void *dst, - const void *symbol, size_t count, size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, void *, - const void *, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphAddMemcpyNodeFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, dst, - symbol, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemcpyNode1D( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, void *dst, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, void *, - const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaGraphAddMemcpyNode1D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, dst, src, - count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeGetParams( - cudaGraphNode_t node, struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParams( - cudaGraphNode_t node, const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParamsToSymbol( - cudaGraphNode_t node, const void *symbol, const void *src, size_t count, - size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, const void *, const void *, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphMemcpyNodeSetParamsToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemcpyNodeSetParamsFromSymbol( - cudaGraphNode_t node, void *dst, const void *symbol, size_t count, - size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphMemcpyNodeSetParamsFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, dst, symbol, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void *dst, const void *src, - size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, void *, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaGraphMemcpyNodeSetParams1D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemsetNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaMemsetParams *pMemsetParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemsetNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pMemsetParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeGetParams( - cudaGraphNode_t node, struct cudaMemsetParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemsetNodeSetParams( - cudaGraphNode_t node, const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddHostNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddHostNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeGetParams( - cudaGraphNode_t node, struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphHostNodeSetParams( - cudaGraphNode_t node, const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddChildGraphNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaGraph_t childGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphAddChildGraphNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - childGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t *pGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraph_t *); - static auto func_ptr = LoadSymbol("cudaGraphChildGraphNodeGetGraph"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddEmptyNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEmptyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddEventRecordNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEventRecordNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t *event_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t *); - static auto func_ptr = - LoadSymbol("cudaGraphEventRecordNodeGetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = - LoadSymbol("cudaGraphEventRecordNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddEventWaitNode(cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, - size_t numDependencies, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphAddEventWaitNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t *event_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaGraphEventWaitNodeGetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaGraphEventWaitNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, event); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddExternalSemaphoresSignalNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaExternalSemaphoreSignalNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, - const struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphAddExternalSemaphoresSignalNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresSignalNodeGetParams( - cudaGraphNode_t hNode, - struct cudaExternalSemaphoreSignalNodeParams *params_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresSignalNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, params_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresSignalNodeSetParams( - cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreSignalNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, const struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresSignalNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddExternalSemaphoresWaitNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - const struct cudaExternalSemaphoreWaitNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, - const struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphAddExternalSemaphoresWaitNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresWaitNodeGetParams( - cudaGraphNode_t hNode, - struct cudaExternalSemaphoreWaitNodeParams *params_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresWaitNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, params_out); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExternalSemaphoresWaitNodeSetParams( - cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreWaitNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t, const struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExternalSemaphoresWaitNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemAllocNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, - struct cudaMemAllocNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraph_t, - const cudaGraphNode_t *, size_t, - struct cudaMemAllocNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemAllocNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, - nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphMemAllocNodeGetParams( - cudaGraphNode_t node, struct cudaMemAllocNodeParams *params_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, - struct cudaMemAllocNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphMemAllocNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, params_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphAddMemFreeNode( - cudaGraphNode_t *pGraphNode, cudaGraph_t graph, - const cudaGraphNode_t *pDependencies, size_t numDependencies, void *dptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphNode_t *, cudaGraph_t, const cudaGraphNode_t *, size_t, void *); - static auto func_ptr = LoadSymbol("cudaGraphAddMemFreeNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphNode, graph, pDependencies, numDependencies, dptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void *dptr_out) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t, void *); - static auto func_ptr = LoadSymbol("cudaGraphMemFreeNodeGetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, dptr_out); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGraphMemTrim(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceGraphMemTrim"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetGraphMemAttribute( - int device, enum cudaGraphMemAttributeType attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, enum cudaGraphMemAttributeType, void *); - static auto func_ptr = LoadSymbol("cudaDeviceGetGraphMemAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetGraphMemAttribute( - int device, enum cudaGraphMemAttributeType attr, void *value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, enum cudaGraphMemAttributeType, void *); - static auto func_ptr = LoadSymbol("cudaDeviceSetGraphMemAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphClone(cudaGraph_t *pGraphClone, cudaGraph_t originalGraph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t *, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphClone, originalGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeFindInClone(cudaGraphNode_t *pNode, cudaGraphNode_t originalNode, - cudaGraph_t clonedGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t *, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphNodeFindInClone"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pNode, originalNode, clonedGraph); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeGetType(cudaGraphNode_t node, enum cudaGraphNodeType *pType) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, enum cudaGraphNodeType *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetType"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pType); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetNodes(cudaGraph_t graph, - cudaGraphNode_t *nodes, - size_t *numNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, nodes, numNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetRootNodes( - cudaGraph_t graph, cudaGraphNode_t *pRootNodes, size_t *pNumRootNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetRootNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, pRootNodes, pNumRootNodes); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphGetEdges(cudaGraph_t graph, - cudaGraphNode_t *from, - cudaGraphNode_t *to, - size_t *numEdges) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaGraphNode_t *, - cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphGetEdges"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numEdges); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependencies( - cudaGraphNode_t node, cudaGraphNode_t *pDependencies, - size_t *pNumDependencies) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependencies, pNumDependencies); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeGetDependentNodes( - cudaGraphNode_t node, cudaGraphNode_t *pDependentNodes, - size_t *pNumDependentNodes) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphNode_t, cudaGraphNode_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetDependentNodes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node, pDependentNodes, pNumDependentNodes); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphAddDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t *from, - const cudaGraphNode_t *to, size_t numDependencies) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, const cudaGraphNode_t *, - const cudaGraphNode_t *, size_t); - static auto func_ptr = LoadSymbol("cudaGraphRemoveDependencies"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, from, to, numDependencies); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphDestroyNode(cudaGraphNode_t node) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphNode_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroyNode"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(node); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphInstantiate(cudaGraphExec_t *pGraphExec, cudaGraph_t graph, - unsigned long long flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - unsigned long long); - static auto func_ptr = LoadSymbol("cudaGraphInstantiate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphInstantiateWithFlags(cudaGraphExec_t *pGraphExec, cudaGraph_t graph, - unsigned long long flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - unsigned long long); - static auto func_ptr = LoadSymbol("cudaGraphInstantiateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphInstantiateWithParams(cudaGraphExec_t *pGraphExec, cudaGraph_t graph, - cudaGraphInstantiateParams *instantiateParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t *, cudaGraph_t, - cudaGraphInstantiateParams *); - static auto func_ptr = LoadSymbol("cudaGraphInstantiateWithParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pGraphExec, graph, instantiateParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long *flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, unsigned long long *); - static auto func_ptr = LoadSymbol("cudaGraphExecGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecKernelNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaKernelNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaKernelNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecKernelNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemcpy3DParms *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemcpy3DParms *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParamsToSymbol( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const void *symbol, - const void *src, size_t count, size_t offset, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParamsToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecMemcpyNodeSetParamsFromSymbol(cudaGraphExec_t hGraphExec, - cudaGraphNode_t node, void *dst, - const void *symbol, size_t count, - size_t offset, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParamsFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, dst, symbol, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemcpyNodeSetParams1D( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void *dst, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, void *, - const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemcpyNodeSetParams1D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecMemsetNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaMemsetParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaMemsetParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecMemsetNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, - const struct cudaHostNodeParams *pNodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - const struct cudaHostNodeParams *); - static auto func_ptr = LoadSymbol("cudaGraphExecHostNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, pNodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecChildGraphNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, cudaGraph_t); - static auto func_ptr = - LoadSymbol("cudaGraphExecChildGraphNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, node, childGraph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecEventRecordNodeSetEvent( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = - LoadSymbol("cudaGraphExecEventRecordNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, event); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphExecEventWaitNodeSetEvent( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, cudaEvent_t); - static auto func_ptr = - LoadSymbol("cudaGraphExecEventWaitNodeSetEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecExternalSemaphoresSignalNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreSignalNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphExec_t, cudaGraphNode_t, - const struct cudaExternalSemaphoreSignalNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecExternalSemaphoresSignalNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecExternalSemaphoresWaitNodeSetParams( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, - const struct cudaExternalSemaphoreWaitNodeParams *nodeParams) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaGraphExec_t, cudaGraphNode_t, - const struct cudaExternalSemaphoreWaitNodeParams *); - static auto func_ptr = - LoadSymbol("cudaGraphExecExternalSemaphoresWaitNodeSetParams"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, nodeParams); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphNodeSetEnabled( - cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphNodeSetEnabled"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, isEnabled); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, - unsigned int *isEnabled) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraphNode_t, - unsigned int *); - static auto func_ptr = LoadSymbol("cudaGraphNodeGetEnabled"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hNode, isEnabled); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, - cudaGraphExecUpdateResultInfo *resultInfo) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaGraph_t, - cudaGraphExecUpdateResultInfo *); - static auto func_ptr = LoadSymbol("cudaGraphExecUpdate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hGraphExec, hGraph, resultInfo); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphUpload(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphUpload"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, - cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphLaunch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphExecDestroy(cudaGraphExec_t graphExec) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphExec_t); - static auto func_ptr = LoadSymbol("cudaGraphExecDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graphExec); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDestroy(cudaGraph_t graph) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t); - static auto func_ptr = LoadSymbol("cudaGraphDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphDebugDotPrint( - cudaGraph_t graph, const char *path, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, const char *, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphDebugDotPrint"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, path, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaUserObjectCreate( - cudaUserObject_t *object_out, void *ptr, cudaHostFn_t destroy, - unsigned int initialRefcount, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaUserObject_t *, void *, cudaHostFn_t, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object_out, ptr, destroy, initialRefcount, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUserObjectRetain(cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectRetain"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUserObjectRelease(cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaUserObjectRelease"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(object, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphRetainUserObject( - cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1), - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaUserObject_t, - unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphRetainUserObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, object, count, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphReleaseUserObject( - cudaGraph_t graph, cudaUserObject_t object, unsigned int count __dv(1)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraph_t, cudaUserObject_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphReleaseUserObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(graph, object, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDriverEntryPoint( - const char *symbol, void **funcPtr, unsigned long long flags, - enum cudaDriverEntryPointQueryResult *driverStatus) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const char *, void **, unsigned long long, - enum cudaDriverEntryPointQueryResult *); - static auto func_ptr = LoadSymbol("cudaGetDriverEntryPoint"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, funcPtr, flags, driverStatus); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetExportTable( - const void **ppExportTable, const cudaUUID_t *pExportTableId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void **, const cudaUUID_t *); - static auto func_ptr = LoadSymbol("cudaGetExportTable"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ppExportTable, pExportTableId); -} - -} // extern "C" diff --git a/source/lib/src/gpu/cudart/cuda_runtime_9_0.inc b/source/lib/src/gpu/cudart/cuda_runtime_9_0.inc deleted file mode 100644 index 6753ddcf78..0000000000 --- a/source/lib/src/gpu/cudart/cuda_runtime_9_0.inc +++ /dev/null @@ -1,1421 +0,0 @@ -// Auto-generated, do not edit. - -extern "C" { - -extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceReset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaDeviceSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, - size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaDeviceSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaDeviceGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaDeviceGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int *); - static auto func_ptr = - LoadSymbol("cudaDeviceGetStreamPriorityRange"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(leastPriority, greatestPriority); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaDeviceSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig *); - static auto func_ptr = LoadSymbol("cudaDeviceGetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaDeviceSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(config); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceGetByPCIBusId(int *device, const char *pciBusId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const char *); - static auto func_ptr = LoadSymbol("cudaDeviceGetByPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, pciBusId); -} - -extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, - int len, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(char *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetPCIBusId"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pciBusId, len, device); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcEventHandle_t *, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaIpcGetEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, event); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, cudaIpcEventHandle_t); - static auto func_ptr = LoadSymbol("cudaIpcOpenEventHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, handle); -} - -extern __host__ cudaError_t CUDARTAPI -cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaIpcMemHandle_t *, void *); - static auto func_ptr = LoadSymbol("cudaIpcGetMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(handle, devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle( - void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, cudaIpcMemHandle_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaIpcOpenMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, handle, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaIpcCloseMemHandle"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaThreadExit(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadExit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaThreadSynchronize(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaThreadSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ cudaError_t CUDARTAPI cudaThreadSetLimit(enum cudaLimit limit, - size_t value) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaLimit, size_t); - static auto func_ptr = LoadSymbol("cudaThreadSetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(limit, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaThreadGetLimit(size_t *pValue, - enum cudaLimit limit) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, enum cudaLimit); - static auto func_ptr = LoadSymbol("cudaThreadGetLimit"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pValue, limit); -} - -extern __host__ cudaError_t CUDARTAPI -cudaThreadGetCacheConfig(enum cudaFuncCache *pCacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache *); - static auto func_ptr = LoadSymbol("cudaThreadGetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pCacheConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaThreadSetCacheConfig(enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaThreadSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(cacheConfig); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaGetLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaPeekAtLastError(void) { - using FuncPtr = cudaError_t(CUDARTAPI *)(); - static auto func_ptr = LoadSymbol("cudaPeekAtLastError"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorName(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorName"); - if (!func_ptr) return "cudaGetErrorName symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ const char *CUDARTAPI -cudaGetErrorString(cudaError_t error) { - using FuncPtr = const char *(CUDARTAPI *)(cudaError_t); - static auto func_ptr = LoadSymbol("cudaGetErrorString"); - if (!func_ptr) return "cudaGetErrorString symbol not found."; - return func_ptr(error); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceCount(int *count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceCount"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDeviceProperties(struct cudaDeviceProp *prop, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaDeviceProp *, int); - static auto func_ptr = LoadSymbol("cudaGetDeviceProperties"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(prop, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceAttr, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, - int srcDevice, int dstDevice) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, enum cudaDeviceP2PAttr, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceGetP2PAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(value, attr, srcDevice, dstDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaChooseDevice(int *device, const struct cudaDeviceProp *prop) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const struct cudaDeviceProp *); - static auto func_ptr = LoadSymbol("cudaChooseDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device, prop); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDevice(int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaSetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaGetDevice(int *device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaGetDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetValidDevices(int *device_arr, - int len) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int); - static auto func_ptr = LoadSymbol("cudaSetValidDevices"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(device_arr, len); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDeviceFlags(unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int); - static auto func_ptr = LoadSymbol("cudaSetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetDeviceFlags(unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *); - static auto func_ptr = LoadSymbol("cudaGetDeviceFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamCreate(cudaStream_t *pStream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *); - static auto func_ptr = LoadSymbol("cudaStreamCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamCreateWithPriority(cudaStream_t *pStream, unsigned int flags, - int priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t *, unsigned int, int); - static auto func_ptr = LoadSymbol("cudaStreamCreateWithPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pStream, flags, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetPriority(cudaStream_t hStream, int *priority) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, int *); - static auto func_ptr = LoadSymbol("cudaStreamGetPriority"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, priority); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamGetFlags(cudaStream_t hStream, unsigned int *flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, unsigned int *); - static auto func_ptr = LoadSymbol("cudaStreamGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(hStream, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamDestroy(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent( - cudaStream_t stream, cudaEvent_t event, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, cudaEvent_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamWaitEvent"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, event, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, - void *userData, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t, cudaStreamCallback_t, - void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAddCallback"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, callback, userData, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaStreamSynchronize(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaStreamQuery(cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaStream_t); - static auto func_ptr = LoadSymbol("cudaStreamQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, - size_t length __dv(0), - unsigned int flags __dv(cudaMemAttachSingle)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaStream_t, void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaStreamAttachMemAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(stream, devPtr, length, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventCreate(cudaEvent_t *event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *); - static auto func_ptr = LoadSymbol("cudaEventCreate"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t *, unsigned int); - static auto func_ptr = LoadSymbol("cudaEventCreateWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventRecord(cudaEvent_t event, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaEventRecord"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventQuery(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventQuery"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventSynchronize(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventSynchronize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaEventDestroy(cudaEvent_t event) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventDestroy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(event); -} - -extern __host__ cudaError_t CUDARTAPI cudaEventElapsedTime(float *ms, - cudaEvent_t start, - cudaEvent_t end) { - using FuncPtr = cudaError_t(CUDARTAPI *)(float *, cudaEvent_t, cudaEvent_t); - static auto func_ptr = LoadSymbol("cudaEventElapsedTime"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ms, start, end); -} - -extern __host__ cudaError_t CUDARTAPI -cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernel( - const void *func, dim3 gridDim, dim3 blockDim, void **args, - size_t sharedMem, cudaStream_t stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, dim3, dim3, void **, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaLaunchCooperativeKernel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, gridDim, blockDim, args, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunchCooperativeKernelMultiDevice( - struct cudaLaunchParams *launchParamsList, unsigned int numDevices, - unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaLaunchParams *, - unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaLaunchCooperativeKernelMultiDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(launchParamsList, numDevices, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetCacheConfig(const void *func, enum cudaFuncCache cacheConfig) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncCache); - static auto func_ptr = LoadSymbol("cudaFuncSetCacheConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, cacheConfig); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFuncSetSharedMemConfig(const void *func, enum cudaSharedMemConfig config) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaSharedMemConfig); - static auto func_ptr = LoadSymbol("cudaFuncSetSharedMemConfig"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, config); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaFuncAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaFuncGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attr, func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFuncSetAttribute(const void *func, enum cudaFuncAttribute attr, int value) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, enum cudaFuncAttribute, int); - static auto func_ptr = LoadSymbol("cudaFuncSetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func, attr, value); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDoubleForDevice(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForDevice"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetDoubleForHost(double *d) { - using FuncPtr = cudaError_t(CUDARTAPI *)(double *); - static auto func_ptr = LoadSymbol("cudaSetDoubleForHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(d); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, - int blockSize, - size_t dynamicSMemSize) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t); - static auto func_ptr = - LoadSymbol("cudaOccupancyMaxActiveBlocksPerMultiprocessor"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, - const void *func, - int blockSize, - size_t dynamicSMemSize, - unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int *, const void *, int, size_t, unsigned int); - static auto func_ptr = LoadSymbol( - "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(numBlocks, func, blockSize, dynamicSMemSize, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaConfigureCall(dim3 gridDim, dim3 blockDim, size_t sharedMem __dv(0), - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(dim3, dim3, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaConfigureCall"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(gridDim, blockDim, sharedMem, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaSetupArgument(const void *arg, - size_t size, - size_t offset) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaSetupArgument"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(arg, size, offset); -} - -extern __host__ cudaError_t CUDARTAPI cudaLaunch(const void *func) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *); - static auto func_ptr = LoadSymbol("cudaLaunch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(func); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMallocManaged( - void **devPtr, size_t size, unsigned int flags __dv(cudaMemAttachGlobal)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocManaged"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMalloc(void **devPtr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMalloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocHost(void **ptr, size_t size) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t); - static auto func_ptr = LoadSymbol("cudaMallocHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocPitch(void **devPtr, - size_t *pitch, - size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t *, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMallocPitch"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocArray( - cudaArray_t *array, const struct cudaChannelFormatDesc *desc, size_t width, - size_t height __dv(0), unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - size_t, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, width, height, flags); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaFree(void *devPtr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFree"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeHost(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaFreeHost"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI cudaFreeArray(cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t); - static auto func_ptr = LoadSymbol("cudaFreeArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array); -} - -extern __host__ cudaError_t CUDARTAPI -cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t); - static auto func_ptr = LoadSymbol("cudaFreeMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostAlloc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pHost, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostRegister(void *ptr, size_t size, - unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostRegister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr, size, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostUnregister(void *ptr) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *); - static auto func_ptr = LoadSymbol("cudaHostUnregister"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaHostGetDevicePointer(void **pDevice, void *pHost, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, void *, unsigned int); - static auto func_ptr = LoadSymbol("cudaHostGetDevicePointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pDevice, pHost, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaHostGetFlags(unsigned int *pFlags, - void *pHost) { - using FuncPtr = cudaError_t(CUDARTAPI *)(unsigned int *, void *); - static auto func_ptr = LoadSymbol("cudaHostGetFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pFlags, pHost); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3D(struct cudaPitchedPtr *pitchedDevPtr, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr *, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMalloc3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, extent); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMalloc3DArray(cudaArray_t *array, const struct cudaChannelFormatDesc *desc, - struct cudaExtent extent, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t *, - const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int); - static auto func_ptr = LoadSymbol("cudaMalloc3DArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, desc, extent, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaMallocMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, - const struct cudaChannelFormatDesc *desc, struct cudaExtent extent, - unsigned int numLevels, unsigned int flags __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaMipmappedArray_t *, const struct cudaChannelFormatDesc *, - struct cudaExtent, unsigned int, unsigned int); - static auto func_ptr = LoadSymbol("cudaMallocMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, desc, extent, numLevels, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetMipmappedArrayLevel( - cudaArray_t *levelArray, cudaMipmappedArray_const_t mipmappedArray, - unsigned int level) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaMipmappedArray_const_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGetMipmappedArrayLevel"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(levelArray, mipmappedArray, level); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3D(const struct cudaMemcpy3DParms *p) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpy3DPeer(const struct cudaMemcpy3DPeerParms *p) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync( - const struct cudaMemcpy3DParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DParms *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy3DPeerAsync( - const struct cudaMemcpy3DPeerParms *p, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct cudaMemcpy3DPeerParms *, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy3DPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(p, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemGetInfo(size_t *free, - size_t *total) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, size_t *); - static auto func_ptr = LoadSymbol("cudaMemGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(free, total); -} - -extern __host__ cudaError_t CUDARTAPI -cudaArrayGetInfo(struct cudaChannelFormatDesc *desc, struct cudaExtent *extent, - unsigned int *flags, cudaArray_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - struct cudaExtent *, unsigned int *, - cudaArray_t); - static auto func_ptr = LoadSymbol("cudaArrayGetInfo"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, extent, flags, array); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy(void *dst, const void *src, - size_t count, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyPeer(void *dst, int dstDevice, - const void *src, - int srcDevice, - size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, int, const void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, - const void *src, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t, size_t, size_t, const void *, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyFromArray(void *dst, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t count, enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, cudaArray_const_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - count, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2D(void *dst, size_t dpitch, - const void *src, - size_t spitch, size_t width, - size_t height, - enum cudaMemcpyKind kind) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArray( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArray( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, size_t, - size_t, size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DArrayToArray( - cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, - cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, - size_t height, enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - cudaArray_const_t, size_t, size_t, - size_t, size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpy2DArrayToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, - width, height, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbol( - const void *symbol, const void *src, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyHostToDevice)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, - size_t, enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbol( - void *dst, const void *symbol, size_t count, size_t offset __dv(0), - enum cudaMemcpyKind kind __dv(cudaMemcpyDeviceToHost)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbol"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemcpyAsync(void *dst, const void *src, size_t count, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, - size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, const void *, int, - size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyPeerAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dstDevice, src, srcDevice, count, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, const void *, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, count, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromArrayAsync( - void *dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, - size_t count, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, cudaArray_const_t, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, src, wOffset, hOffset, count, kind, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync( - void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, - size_t height, enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void *, size_t, const void *, size_t, size_t, - size_t, enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, spitch, width, height, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DToArrayAsync( - cudaArray_t dst, size_t wOffset, size_t hOffset, const void *src, - size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaArray_t, size_t, size_t, - const void *, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DToArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, wOffset, hOffset, src, spitch, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpy2DFromArrayAsync( - void *dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, - size_t hOffset, size_t width, size_t height, enum cudaMemcpyKind kind, - cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, cudaArray_const_t, - size_t, size_t, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpy2DFromArrayAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, dpitch, src, wOffset, hOffset, width, height, kind, - stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyToSymbolAsync( - const void *symbol, const void *src, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyToSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(symbol, src, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemcpyFromSymbolAsync( - void *dst, const void *symbol, size_t count, size_t offset, - enum cudaMemcpyKind kind, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, const void *, size_t, size_t, - enum cudaMemcpyKind, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemcpyFromSymbolAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(dst, symbol, count, offset, kind, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset(void *devPtr, int value, - size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t); - static auto func_ptr = LoadSymbol("cudaMemset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset2D(void *devPtr, size_t pitch, - int value, size_t width, - size_t height) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaMemset2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemset3D( - struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, struct cudaExtent); - static auto func_ptr = LoadSymbol("cudaMemset3D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync( - void *devPtr, int value, size_t count, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, int, size_t, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemsetAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, value, count, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, - size_t height, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void *, size_t, int, size_t, size_t, - cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset2DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, pitch, value, width, height, stream); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, - struct cudaExtent extent, cudaStream_t stream __dv(0)) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaPitchedPtr, int, - struct cudaExtent, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemset3DAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pitchedDevPtr, value, extent, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolAddress(void **devPtr, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(void **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolAddress"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSymbolSize(size_t *size, - const void *symbol) { - using FuncPtr = cudaError_t(CUDARTAPI *)(size_t *, const void *); - static auto func_ptr = LoadSymbol("cudaGetSymbolSize"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(size, symbol); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemPrefetchAsync(const void *devPtr, size_t count, int dstDevice, - cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const void *, size_t, int, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaMemPrefetchAsync"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, dstDevice, stream); -} - -extern __host__ cudaError_t CUDARTAPI -cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, - int device) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void *, size_t, - enum cudaMemoryAdvise, int); - static auto func_ptr = LoadSymbol("cudaMemAdvise"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, count, advice, device); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute( - void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, - const void *devPtr, size_t count) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - void *, size_t, enum cudaMemRangeAttribute, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttribute"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSize, attribute, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes( - void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, - size_t numAttributes, const void *devPtr, size_t count) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, enum cudaMemRangeAttribute *, - size_t, const void *, size_t); - static auto func_ptr = LoadSymbol("cudaMemRangeGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(data, dataSizes, attributes, numAttributes, devPtr, count); -} - -extern __host__ cudaError_t CUDARTAPI cudaPointerGetAttributes( - struct cudaPointerAttributes *attributes, const void *ptr) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaPointerAttributes *, const void *); - static auto func_ptr = LoadSymbol("cudaPointerGetAttributes"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(attributes, ptr); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *, int, int); - static auto func_ptr = LoadSymbol("cudaDeviceCanAccessPeer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(canAccessPeer, device, peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int, unsigned int); - static auto func_ptr = LoadSymbol("cudaDeviceEnablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice, flags); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDeviceDisablePeerAccess(int peerDevice) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int); - static auto func_ptr = LoadSymbol("cudaDeviceDisablePeerAccess"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(peerDevice); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnregisterResource"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceSetMapFlags( - cudaGraphicsResource_t resource, unsigned int flags) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaGraphicsResource_t, unsigned int); - static auto func_ptr = LoadSymbol("cudaGraphicsResourceSetMapFlags"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(resource, flags); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsMapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsMapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsUnmapResources( - int count, cudaGraphicsResource_t *resources, cudaStream_t stream __dv(0)) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(int, cudaGraphicsResource_t *, cudaStream_t); - static auto func_ptr = LoadSymbol("cudaGraphicsUnmapResources"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(count, resources, stream); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedPointer( - void **devPtr, size_t *size, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(void **, size_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedPointer"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(devPtr, size, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGraphicsSubResourceGetMappedArray( - cudaArray_t *array, cudaGraphicsResource_t resource, - unsigned int arrayIndex, unsigned int mipLevel) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaArray_t *, cudaGraphicsResource_t, unsigned int, unsigned int); - static auto func_ptr = - LoadSymbol("cudaGraphicsSubResourceGetMappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(array, resource, arrayIndex, mipLevel); -} - -extern __host__ cudaError_t CUDARTAPI -cudaGraphicsResourceGetMappedMipmappedArray( - cudaMipmappedArray_t *mipmappedArray, cudaGraphicsResource_t resource) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(cudaMipmappedArray_t *, cudaGraphicsResource_t); - static auto func_ptr = - LoadSymbol("cudaGraphicsResourceGetMappedMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(mipmappedArray, resource); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetChannelDesc( - struct cudaChannelFormatDesc *desc, cudaArray_const_t array) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaChannelFormatDesc *, - cudaArray_const_t); - static auto func_ptr = LoadSymbol("cudaGetChannelDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(desc, array); -} - -extern __host__ struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc( - int x, int y, int z, int w, enum cudaChannelFormatKind f) { - using FuncPtr = struct cudaChannelFormatDesc(CUDARTAPI *)( - int, int, int, int, enum cudaChannelFormatKind); - static auto func_ptr = LoadSymbol("cudaCreateChannelDesc"); - if (!func_ptr) { - return cudaChannelFormatDesc{cudaChannelFormatKind(-1), 0, 0, 0}; - } - return func_ptr(x, y, z, w, f); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindTexture( - size_t *offset, const struct textureReference *texref, const void *devPtr, - const struct cudaChannelFormatDesc *desc, size_t size __dv(UINT_MAX)) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, size); -} - -extern __host__ cudaError_t CUDARTAPI -cudaBindTexture2D(size_t *offset, const struct textureReference *texref, - const void *devPtr, const struct cudaChannelFormatDesc *desc, - size_t width, size_t height, size_t pitch) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - size_t *, const struct textureReference *, const void *, - const struct cudaChannelFormatDesc *, size_t, size_t, size_t); - static auto func_ptr = LoadSymbol("cudaBindTexture2D"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref, devPtr, desc, width, height, pitch); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindTextureToArray( - const struct textureReference *texref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, array, desc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaBindTextureToMipmappedArray(const struct textureReference *texref, - cudaMipmappedArray_const_t mipmappedArray, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct textureReference *, cudaMipmappedArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindTextureToMipmappedArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, mipmappedArray, desc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaUnbindTexture(const struct textureReference *texref) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaUnbindTexture"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureAlignmentOffset( - size_t *offset, const struct textureReference *texref) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(size_t *, const struct textureReference *); - static auto func_ptr = LoadSymbol("cudaGetTextureAlignmentOffset"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(offset, texref); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureReference( - const struct textureReference **texref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct textureReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetTextureReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaBindSurfaceToArray( - const struct surfaceReference *surfref, cudaArray_const_t array, - const struct cudaChannelFormatDesc *desc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - const struct surfaceReference *, cudaArray_const_t, - const struct cudaChannelFormatDesc *); - static auto func_ptr = LoadSymbol("cudaBindSurfaceToArray"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, array, desc); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceReference( - const struct surfaceReference **surfref, const void *symbol) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(const struct surfaceReference **, const void *); - static auto func_ptr = LoadSymbol("cudaGetSurfaceReference"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfref, symbol); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateTextureObject( - cudaTextureObject_t *pTexObject, const struct cudaResourceDesc *pResDesc, - const struct cudaTextureDesc *pTexDesc, - const struct cudaResourceViewDesc *pResViewDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)( - cudaTextureObject_t *, const struct cudaResourceDesc *, - const struct cudaTextureDesc *, const struct cudaResourceViewDesc *); - static auto func_ptr = LoadSymbol("cudaCreateTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexObject, pResDesc, pTexDesc, pResViewDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroyTextureObject(cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaDestroyTextureObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectTextureDesc( - struct cudaTextureDesc *pTexDesc, cudaTextureObject_t texObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaTextureDesc *, cudaTextureObject_t); - static auto func_ptr = LoadSymbol("cudaGetTextureObjectTextureDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pTexDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetTextureObjectResourceViewDesc( - struct cudaResourceViewDesc *pResViewDesc, cudaTextureObject_t texObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(struct cudaResourceViewDesc *, - cudaTextureObject_t); - static auto func_ptr = - LoadSymbol("cudaGetTextureObjectResourceViewDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResViewDesc, texObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaCreateSurfaceObject( - cudaSurfaceObject_t *pSurfObject, const struct cudaResourceDesc *pResDesc) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t *, - const struct cudaResourceDesc *); - static auto func_ptr = LoadSymbol("cudaCreateSurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pSurfObject, pResDesc); -} - -extern __host__ cudaError_t CUDARTAPI -cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) { - using FuncPtr = cudaError_t(CUDARTAPI *)(cudaSurfaceObject_t); - static auto func_ptr = LoadSymbol("cudaDestroySurfaceObject"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetSurfaceObjectResourceDesc( - struct cudaResourceDesc *pResDesc, cudaSurfaceObject_t surfObject) { - using FuncPtr = - cudaError_t(CUDARTAPI *)(struct cudaResourceDesc *, cudaSurfaceObject_t); - static auto func_ptr = - LoadSymbol("cudaGetSurfaceObjectResourceDesc"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(pResDesc, surfObject); -} - -extern __host__ cudaError_t CUDARTAPI cudaDriverGetVersion(int *driverVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaDriverGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(driverVersion); -} - -extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI -cudaRuntimeGetVersion(int *runtimeVersion) { - using FuncPtr = cudaError_t(CUDARTAPI *)(int *); - static auto func_ptr = LoadSymbol("cudaRuntimeGetVersion"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(runtimeVersion); -} - -extern __host__ cudaError_t CUDARTAPI cudaGetExportTable( - const void **ppExportTable, const cudaUUID_t *pExportTableId) { - using FuncPtr = cudaError_t(CUDARTAPI *)(const void **, const cudaUUID_t *); - static auto func_ptr = LoadSymbol("cudaGetExportTable"); - if (!func_ptr) return GetSymbolNotFoundError(); - return func_ptr(ppExportTable, pExportTableId); -} - -} // extern "C" diff --git a/source/lib/src/gpu/cudart/cudart_stub.cc b/source/lib/src/gpu/cudart/cudart_stub.cc index 7ad8529189..8083a0a89d 100644 --- a/source/lib/src/gpu/cudart/cudart_stub.cc +++ b/source/lib/src/gpu/cudart/cudart_stub.cc @@ -10,18 +10,14 @@ #include "cuda_runtime_api.h" -// wraps cuda runtime with dso loader +extern "C" { -namespace { -void *GetDsoHandle() { - static auto handle = []() -> void * { -#if defined(__gnu_linux__) - std::string libname = "libcudart.so"; -#elif defined(__APPLE__) - std::string libname = "libcudart.dylib"; -#elif defined(_WIN32) - std::string libname = "cudart.dll"; -#endif +static cudaError_t DP_CudartGetSymbolNotFoundError() { + return cudaErrorSharedObjectSymbolNotFound; +} + +void *DP_cudart_dlopen(char *libname) { + static auto handle = [](std::string libname) -> void * { #if defined(_WIN32) void *dso_handle = LoadLibrary(libname.c_str()); #else @@ -33,164 +29,20 @@ void *GetDsoHandle() { } std::cerr << "DeePMD-kit: Successfully load " << libname << std::endl; return dso_handle; - }(); + }(std::string(libname)); return handle; } -template -T LoadSymbol(const char *symbol_name) { - void *symbol = nullptr; - void *handle = GetDsoHandle(); - if (handle) { - symbol = dlsym(handle, symbol_name); - } - return reinterpret_cast(symbol); -} - -// the following is copied from TensorFlow -/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -cudaError_t GetSymbolNotFoundError() { - return cudaErrorSharedObjectSymbolNotFound; -} -} // namespace - -#define __dv(v) -#define __CUDA_DEPRECATED -// CUDART_VERSION is defined in cuda_runtime_api.h -#if CUDART_VERSION < 10000 -#include "cuda_runtime_9_0.inc" -#elif CUDART_VERSION < 10010 -#include "cuda_runtime_10_0.inc" -#elif CUDART_VERSION < 10020 -#include "cuda_runtime_10_1.inc" -#elif CUDART_VERSION < 11000 -#include "cuda_runtime_10_2.inc" -#elif CUDART_VERSION < 11020 -#include "cuda_runtime_11_0.inc" -#elif CUDART_VERSION < 11080 -#include "cuda_runtime_11_2.inc" -#elif CUDART_VERSION < 12000 -#include "cuda_runtime_11_8.inc" -#else -#include "cuda_runtime_12_0.inc" -#endif -#undef __dv -#undef __CUDA_DEPRECATED - -extern "C" { - -// Following are private symbols in libcudart that got inserted by nvcc. -extern void CUDARTAPI __cudaRegisterFunction(void **fatCubinHandle, - const char *hostFun, - char *deviceFun, - const char *deviceName, - int thread_limit, - uint3 *tid, - uint3 *bid, - dim3 *bDim, - dim3 *gDim, - int *wSize) { - using FuncPtr = void(CUDARTAPI *)(void **fatCubinHandle, const char *hostFun, - char *deviceFun, const char *deviceName, - int thread_limit, uint3 *tid, uint3 *bid, - dim3 *bDim, dim3 *gDim, int *wSize); - static auto func_ptr = LoadSymbol("__cudaRegisterFunction"); - if (!func_ptr) { - return; +void *DP_cudart_dlsym(void *handle, const char *sym_name) { + // check if the handle is nullptr, if so, return a function that + // returns cudaErrorSharedObjectSymbolNotFound + if (!handle) { + return reinterpret_cast(&DP_CudartGetSymbolNotFoundError); } - func_ptr(fatCubinHandle, hostFun, deviceFun, deviceName, thread_limit, tid, - bid, bDim, gDim, wSize); -} - -extern void CUDARTAPI __cudaUnregisterFatBinary(void **fatCubinHandle) { - using FuncPtr = void(CUDARTAPI *)(void **fatCubinHandle); - static auto func_ptr = LoadSymbol("__cudaUnregisterFatBinary"); - if (!func_ptr) { - return; + void *symbol = dlsym(handle, sym_name); + if (!symbol) { + return reinterpret_cast(&DP_CudartGetSymbolNotFoundError); } - func_ptr(fatCubinHandle); -} - -extern void CUDARTAPI __cudaRegisterVar(void **fatCubinHandle, - char *hostVar, - char *deviceAddress, - const char *deviceName, - int ext, - size_t size, - int constant, - int global) { - using FuncPtr = void(CUDARTAPI *)( - void **fatCubinHandle, char *hostVar, char *deviceAddress, - const char *deviceName, int ext, size_t size, int constant, int global); - static auto func_ptr = LoadSymbol("__cudaRegisterVar"); - if (!func_ptr) { - return; - } - func_ptr(fatCubinHandle, hostVar, deviceAddress, deviceName, ext, size, - constant, global); -} - -extern void **CUDARTAPI __cudaRegisterFatBinary(void *fatCubin) { - using FuncPtr = void **(CUDARTAPI *)(void *fatCubin); - static auto func_ptr = LoadSymbol("__cudaRegisterFatBinary"); - if (!func_ptr) { - return nullptr; - } - return (void **)func_ptr(fatCubin); -} - -extern cudaError_t CUDARTAPI __cudaPopCallConfiguration(dim3 *gridDim, - dim3 *blockDim, - size_t *sharedMem, - void *stream) { - using FuncPtr = cudaError_t(CUDARTAPI *)(dim3 * gridDim, dim3 * blockDim, - size_t * sharedMem, void *stream); - static auto func_ptr = LoadSymbol("__cudaPopCallConfiguration"); - if (!func_ptr) { - return GetSymbolNotFoundError(); - } - return func_ptr(gridDim, blockDim, sharedMem, stream); -} - -extern __host__ __device__ unsigned CUDARTAPI __cudaPushCallConfiguration( - dim3 gridDim, dim3 blockDim, size_t sharedMem = 0, void *stream = 0) { - using FuncPtr = unsigned(CUDARTAPI *)(dim3 gridDim, dim3 blockDim, - size_t sharedMem, void *stream); - static auto func_ptr = LoadSymbol("__cudaPushCallConfiguration"); - if (!func_ptr) { - return 0; - } - return func_ptr(gridDim, blockDim, sharedMem, stream); -} - -extern char CUDARTAPI __cudaInitModule(void **fatCubinHandle) { - using FuncPtr = char(CUDARTAPI *)(void **fatCubinHandle); - static auto func_ptr = LoadSymbol("__cudaInitModule"); - if (!func_ptr) { - return 0; - } - return func_ptr(fatCubinHandle); -} - -#if CUDART_VERSION >= 10010 -extern void CUDARTAPI __cudaRegisterFatBinaryEnd(void **fatCubinHandle) { - using FuncPtr = void(CUDARTAPI *)(void **fatCubinHandle); - static auto func_ptr = LoadSymbol("__cudaRegisterFatBinaryEnd"); - if (!func_ptr) { - return; - } - func_ptr(fatCubinHandle); -} -#endif + return symbol; +}; }