nv-sgl 0.6.0__cp313-cp313-win_amd64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. include/tevclient.h +393 -0
  2. nv_sgl-0.6.0.dist-info/LICENSE +29 -0
  3. nv_sgl-0.6.0.dist-info/METADATA +21 -0
  4. nv_sgl-0.6.0.dist-info/RECORD +142 -0
  5. nv_sgl-0.6.0.dist-info/WHEEL +5 -0
  6. nv_sgl-0.6.0.dist-info/top_level.txt +1 -0
  7. sgl/__init__.py +15 -0
  8. sgl/__init__.pyi +6738 -0
  9. sgl/d3d12/D3D12Core.dll +0 -0
  10. sgl/d3d12/d3d12SDKLayers.dll +0 -0
  11. sgl/dxcompiler.dll +0 -0
  12. sgl/dxil.dll +0 -0
  13. sgl/gfx.dll +0 -0
  14. sgl/include/sgl/app/app.h +113 -0
  15. sgl/include/sgl/core/bitmap.h +302 -0
  16. sgl/include/sgl/core/crypto.h +89 -0
  17. sgl/include/sgl/core/data_type.h +46 -0
  18. sgl/include/sgl/core/dds_file.h +103 -0
  19. sgl/include/sgl/core/enum.h +201 -0
  20. sgl/include/sgl/core/error.h +161 -0
  21. sgl/include/sgl/core/file_stream.h +77 -0
  22. sgl/include/sgl/core/file_system_watcher.h +141 -0
  23. sgl/include/sgl/core/format.h +36 -0
  24. sgl/include/sgl/core/fwd.h +90 -0
  25. sgl/include/sgl/core/hash.h +45 -0
  26. sgl/include/sgl/core/input.h +522 -0
  27. sgl/include/sgl/core/logger.h +214 -0
  28. sgl/include/sgl/core/macros.h +184 -0
  29. sgl/include/sgl/core/maths.h +45 -0
  30. sgl/include/sgl/core/memory_mapped_file.h +112 -0
  31. sgl/include/sgl/core/memory_mapped_file_stream.h +32 -0
  32. sgl/include/sgl/core/memory_stream.h +74 -0
  33. sgl/include/sgl/core/object.h +683 -0
  34. sgl/include/sgl/core/platform.h +239 -0
  35. sgl/include/sgl/core/plugin.h +331 -0
  36. sgl/include/sgl/core/resolver.h +39 -0
  37. sgl/include/sgl/core/short_vector.h +141 -0
  38. sgl/include/sgl/core/static_vector.h +111 -0
  39. sgl/include/sgl/core/stream.h +54 -0
  40. sgl/include/sgl/core/string.h +276 -0
  41. sgl/include/sgl/core/struct.h +360 -0
  42. sgl/include/sgl/core/thread.h +28 -0
  43. sgl/include/sgl/core/timer.h +52 -0
  44. sgl/include/sgl/core/traits.h +15 -0
  45. sgl/include/sgl/core/type_utils.h +19 -0
  46. sgl/include/sgl/core/window.h +177 -0
  47. sgl/include/sgl/device/agility_sdk.h +24 -0
  48. sgl/include/sgl/device/blit.h +88 -0
  49. sgl/include/sgl/device/buffer_cursor.h +162 -0
  50. sgl/include/sgl/device/command.h +539 -0
  51. sgl/include/sgl/device/cuda_api.h +766 -0
  52. sgl/include/sgl/device/cuda_interop.h +39 -0
  53. sgl/include/sgl/device/cuda_utils.h +107 -0
  54. sgl/include/sgl/device/cursor_utils.h +129 -0
  55. sgl/include/sgl/device/device.h +668 -0
  56. sgl/include/sgl/device/device_resource.h +37 -0
  57. sgl/include/sgl/device/fence.h +91 -0
  58. sgl/include/sgl/device/formats.h +330 -0
  59. sgl/include/sgl/device/framebuffer.h +85 -0
  60. sgl/include/sgl/device/fwd.h +164 -0
  61. sgl/include/sgl/device/helpers.h +20 -0
  62. sgl/include/sgl/device/hot_reload.h +75 -0
  63. sgl/include/sgl/device/input_layout.h +74 -0
  64. sgl/include/sgl/device/kernel.h +69 -0
  65. sgl/include/sgl/device/memory_heap.h +155 -0
  66. sgl/include/sgl/device/native_formats.h +342 -0
  67. sgl/include/sgl/device/native_handle.h +73 -0
  68. sgl/include/sgl/device/native_handle_traits.h +65 -0
  69. sgl/include/sgl/device/pipeline.h +138 -0
  70. sgl/include/sgl/device/print.h +45 -0
  71. sgl/include/sgl/device/python/cursor_utils.h +853 -0
  72. sgl/include/sgl/device/query.h +52 -0
  73. sgl/include/sgl/device/raytracing.h +84 -0
  74. sgl/include/sgl/device/reflection.h +1254 -0
  75. sgl/include/sgl/device/resource.h +705 -0
  76. sgl/include/sgl/device/sampler.h +57 -0
  77. sgl/include/sgl/device/shader.h +516 -0
  78. sgl/include/sgl/device/shader_cursor.h +85 -0
  79. sgl/include/sgl/device/shader_object.h +94 -0
  80. sgl/include/sgl/device/shader_offset.h +67 -0
  81. sgl/include/sgl/device/shared_handle.h +12 -0
  82. sgl/include/sgl/device/slang_utils.h +54 -0
  83. sgl/include/sgl/device/swapchain.h +74 -0
  84. sgl/include/sgl/device/types.h +782 -0
  85. sgl/include/sgl/math/colorspace.h +56 -0
  86. sgl/include/sgl/math/constants.h +7 -0
  87. sgl/include/sgl/math/float16.h +146 -0
  88. sgl/include/sgl/math/matrix.h +6 -0
  89. sgl/include/sgl/math/matrix_math.h +746 -0
  90. sgl/include/sgl/math/matrix_types.h +207 -0
  91. sgl/include/sgl/math/python/primitivetype.h +33 -0
  92. sgl/include/sgl/math/quaternion.h +6 -0
  93. sgl/include/sgl/math/quaternion_math.h +484 -0
  94. sgl/include/sgl/math/quaternion_types.h +83 -0
  95. sgl/include/sgl/math/ray.h +47 -0
  96. sgl/include/sgl/math/scalar_math.h +249 -0
  97. sgl/include/sgl/math/scalar_types.h +107 -0
  98. sgl/include/sgl/math/vector.h +6 -0
  99. sgl/include/sgl/math/vector_math.h +1796 -0
  100. sgl/include/sgl/math/vector_types.h +336 -0
  101. sgl/include/sgl/python/nanobind.h +489 -0
  102. sgl/include/sgl/python/py_doc.h +11600 -0
  103. sgl/include/sgl/python/sgl_ext_pch.h +8 -0
  104. sgl/include/sgl/sgl.h +21 -0
  105. sgl/include/sgl/sgl_pch.h +6 -0
  106. sgl/include/sgl/stl/bit.h +377 -0
  107. sgl/include/sgl/tests/testing.h +54 -0
  108. sgl/include/sgl/ui/fwd.h +34 -0
  109. sgl/include/sgl/ui/imgui_config.h +43 -0
  110. sgl/include/sgl/ui/ui.h +71 -0
  111. sgl/include/sgl/ui/widgets.h +918 -0
  112. sgl/include/sgl/utils/python/slangpy.h +366 -0
  113. sgl/include/sgl/utils/renderdoc.h +50 -0
  114. sgl/include/sgl/utils/slangpy.h +153 -0
  115. sgl/include/sgl/utils/tev.h +93 -0
  116. sgl/include/sgl/utils/texture_loader.h +106 -0
  117. sgl/math/__init__.pyi +5083 -0
  118. sgl/platform/__init__.pyi +102 -0
  119. sgl/renderdoc/__init__.pyi +51 -0
  120. sgl/sgl.dll +0 -0
  121. sgl/sgl_ext.cp313-win_amd64.pyd +0 -0
  122. sgl/shaders/nvapi/nvHLSLExtns.h +2315 -0
  123. sgl/shaders/nvapi/nvHLSLExtnsInternal.h +758 -0
  124. sgl/shaders/nvapi/nvShaderExtnEnums.h +142 -0
  125. sgl/shaders/sgl/device/blit.slang +93 -0
  126. sgl/shaders/sgl/device/nvapi.slang +5 -0
  127. sgl/shaders/sgl/device/nvapi.slangh +7 -0
  128. sgl/shaders/sgl/device/print.slang +445 -0
  129. sgl/shaders/sgl/math/constants.slang +4 -0
  130. sgl/shaders/sgl/math/ray.slang +29 -0
  131. sgl/shaders/sgl/ui/imgui.slang +49 -0
  132. sgl/slang-glslang.dll +0 -0
  133. sgl/slang-llvm.dll +0 -0
  134. sgl/slang-rt.dll +0 -0
  135. sgl/slang.dll +0 -0
  136. sgl/slangpy/__init__.pyi +268 -0
  137. sgl/tev/__init__.pyi +108 -0
  138. sgl/tevclient.lib +0 -0
  139. sgl/thread/__init__.pyi +4 -0
  140. sgl/ui/__init__.pyi +1118 -0
  141. share/cmake/tevclient/tevclient-config-release.cmake +19 -0
  142. share/cmake/tevclient/tevclient-config.cmake +108 -0
@@ -0,0 +1,766 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+
3
+ #pragma once
4
+
5
+ #include "sgl/core/config.h"
6
+
7
+ bool sgl_cuda_api_init();
8
+ void sgl_cuda_api_shutdown();
9
+
10
+ #if SGL_USE_DYNAMIC_CUDA
11
+
12
+ #include <cstdint>
13
+ #include <cstdlib>
14
+
15
+ using cuuint32_t = uint32_t;
16
+ using cuuint64_t = uint64_t;
17
+
18
+ using CUdeviceptr = uintptr_t;
19
+ using CUdevice = int;
20
+ using CUcontext = struct CUctx_st*;
21
+ using CUarray = struct CUarray_st*;
22
+ using CUmipmappedArray = struct CUmipmappedArray_st*;
23
+ using CUtexref = struct CUtexref_st*;
24
+ using CUsurfref = struct CUsurfref_st*;
25
+ using CUevent = struct CUevent_st*;
26
+ using CUstream = struct CUstream_st*;
27
+ using CUgraphicsResource = struct CUgraphicsResource_st*;
28
+ using CUtexObject = uint64_t;
29
+ using CUsurfObject = uint64_t;
30
+ using CUexternalMemory = struct CUextMemory_st*;
31
+ using CUexternalSemaphore = struct CUextSemaphore_st*;
32
+
33
+ #ifndef CU_UUID_HAS_BEEN_DEFINED
34
+ #define CU_UUID_HAS_BEEN_DEFINED
35
+ typedef struct CUuuid_st {
36
+ char bytes[16];
37
+ } CUuuid;
38
+ #endif
39
+
40
+ enum CUstream_flags {
41
+ CU_STREAM_DEFAULT = 0x0,
42
+ CU_STREAM_NON_BLOCKING = 0x1,
43
+ };
44
+
45
+ enum CUevent_flags {
46
+ CU_EVENT_DEFAULT = 0x0,
47
+ CU_EVENT_BLOCKING_SYNC = 0x1,
48
+ CU_EVENT_DISABLE_TIMING = 0x2,
49
+ CU_EVENT_INTERPROCESS = 0x4,
50
+ };
51
+
52
+ enum CUevent_wait_flags {
53
+ CU_EVENT_WAIT_DEFAULT = 0x0,
54
+ CU_EVENT_WAIT_EXTERNAL = 0x1,
55
+ };
56
+
57
+ enum CUarray_format {
58
+ CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
59
+ CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
60
+ CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
61
+ CU_AD_FORMAT_SIGNED_INT8 = 0x08,
62
+ CU_AD_FORMAT_SIGNED_INT16 = 0x09,
63
+ CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
64
+ CU_AD_FORMAT_HALF = 0x10,
65
+ CU_AD_FORMAT_FLOAT = 0x20,
66
+ CU_AD_FORMAT_NV12 = 0xb0,
67
+ CU_AD_FORMAT_UNORM_INT8X1 = 0xc0,
68
+ CU_AD_FORMAT_UNORM_INT8X2 = 0xc1,
69
+ CU_AD_FORMAT_UNORM_INT8X4 = 0xc2,
70
+ CU_AD_FORMAT_UNORM_INT16X1 = 0xc3,
71
+ CU_AD_FORMAT_UNORM_INT16X2 = 0xc4,
72
+ CU_AD_FORMAT_UNORM_INT16X4 = 0xc5,
73
+ CU_AD_FORMAT_SNORM_INT8X1 = 0xc6,
74
+ CU_AD_FORMAT_SNORM_INT8X2 = 0xc7,
75
+ CU_AD_FORMAT_SNORM_INT8X4 = 0xc8,
76
+ CU_AD_FORMAT_SNORM_INT16X1 = 0xc9,
77
+ CU_AD_FORMAT_SNORM_INT16X2 = 0xca,
78
+ CU_AD_FORMAT_SNORM_INT16X4 = 0xcb,
79
+ CU_AD_FORMAT_BC1_UNORM = 0x91,
80
+ CU_AD_FORMAT_BC1_UNORM_SRGB = 0x92,
81
+ CU_AD_FORMAT_BC2_UNORM = 0x93,
82
+ CU_AD_FORMAT_BC2_UNORM_SRGB = 0x94,
83
+ CU_AD_FORMAT_BC3_UNORM = 0x95,
84
+ CU_AD_FORMAT_BC3_UNORM_SRGB = 0x96,
85
+ CU_AD_FORMAT_BC4_UNORM = 0x97,
86
+ CU_AD_FORMAT_BC4_SNORM = 0x98,
87
+ CU_AD_FORMAT_BC5_UNORM = 0x99,
88
+ CU_AD_FORMAT_BC5_SNORM = 0x9a,
89
+ CU_AD_FORMAT_BC6H_UF16 = 0x9b,
90
+ CU_AD_FORMAT_BC6H_SF16 = 0x9c,
91
+ CU_AD_FORMAT_BC7_UNORM = 0x9d,
92
+ CU_AD_FORMAT_BC7_UNORM_SRGB = 0x9e,
93
+ };
94
+
95
+ enum CUaddress_mode {
96
+ CU_TR_ADDRESS_MODE_WRAP = 0,
97
+ CU_TR_ADDRESS_MODE_CLAMP = 1,
98
+ CU_TR_ADDRESS_MODE_MIRROR = 2,
99
+ CU_TR_ADDRESS_MODE_BORDER = 3,
100
+ };
101
+
102
+ enum CUfilter_mode {
103
+ CU_TR_FILTER_MODE_POINT = 0,
104
+ CU_TR_FILTER_MODE_LINEAR = 1,
105
+ };
106
+
107
+ enum CUdevice_attribute {
108
+ CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1,
109
+ CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2,
110
+ CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3,
111
+ CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4,
112
+ CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5,
113
+ CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6,
114
+ CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7,
115
+ CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8,
116
+ CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8,
117
+ CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9,
118
+ CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10,
119
+ CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11,
120
+ CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12,
121
+ CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12,
122
+ CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13,
123
+ CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14,
124
+ CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15,
125
+ CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16,
126
+ CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17,
127
+ CU_DEVICE_ATTRIBUTE_INTEGRATED = 18,
128
+ CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19,
129
+ CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20,
130
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21,
131
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22,
132
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23,
133
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24,
134
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25,
135
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26,
136
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = 27,
137
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = 28,
138
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = 29,
139
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27,
140
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28,
141
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29,
142
+ CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30,
143
+ CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31,
144
+ CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32,
145
+ CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33,
146
+ CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34,
147
+ CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35,
148
+ CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36,
149
+ CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37,
150
+ CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = 38,
151
+ CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = 39,
152
+ CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40,
153
+ CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41,
154
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = 42,
155
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = 43,
156
+ CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = 44,
157
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = 45,
158
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = 46,
159
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = 47,
160
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = 48,
161
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = 49,
162
+ CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50,
163
+ CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51,
164
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = 52,
165
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = 53,
166
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = 54,
167
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = 55,
168
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = 56,
169
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = 57,
170
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = 58,
171
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = 59,
172
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = 60,
173
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = 61,
174
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = 62,
175
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = 63,
176
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = 64,
177
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = 65,
178
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = 66,
179
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = 67,
180
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = 68,
181
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = 69,
182
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = 70,
183
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = 71,
184
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = 72,
185
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = 73,
186
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = 74,
187
+ CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75,
188
+ CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76,
189
+ CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = 77,
190
+ CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = 78,
191
+ CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = 79,
192
+ CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = 80,
193
+ CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = 81,
194
+ CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = 82,
195
+ CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83,
196
+ CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84,
197
+ CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85,
198
+ CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED = 86,
199
+ CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO = 87,
200
+ CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = 88,
201
+ CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS = 89,
202
+ CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED = 90,
203
+ CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM = 91,
204
+ CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS_V1 = 92,
205
+ CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS_V1 = 93,
206
+ CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR_V1 = 94,
207
+ CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH = 95,
208
+ CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH = 96,
209
+ CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN = 97,
210
+ CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES = 98,
211
+ CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED = 99,
212
+ CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES = 100,
213
+ CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST = 101,
214
+ CU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED = 102,
215
+ CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED = 102,
216
+ CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR_SUPPORTED = 103,
217
+ CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_HANDLE_SUPPORTED = 104,
218
+ CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_WIN32_KMT_HANDLE_SUPPORTED = 105,
219
+ CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR = 106,
220
+ CU_DEVICE_ATTRIBUTE_GENERIC_COMPRESSION_SUPPORTED = 107,
221
+ CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE = 108,
222
+ CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE = 109,
223
+ CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED = 110,
224
+ CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK = 111,
225
+ CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED = 112,
226
+ CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED = 113,
227
+ CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED = 114,
228
+ CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED = 115,
229
+ CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED = 116,
230
+ CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS = 117,
231
+ CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING = 118,
232
+ CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES = 119,
233
+ CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH = 120,
234
+ CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED = 121,
235
+ CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = 122,
236
+ CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR = 123,
237
+ CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED = 124,
238
+ CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED = 125,
239
+ CU_DEVICE_ATTRIBUTE_MEM_SYNC_DOMAIN_COUNT = 126,
240
+ CU_DEVICE_ATTRIBUTE_TENSOR_MAP_ACCESS_SUPPORTED = 127,
241
+ CU_DEVICE_ATTRIBUTE_HANDLE_TYPE_FABRIC_SUPPORTED = 128,
242
+ CU_DEVICE_ATTRIBUTE_UNIFIED_FUNCTION_POINTERS = 129,
243
+ CU_DEVICE_ATTRIBUTE_NUMA_CONFIG = 130,
244
+ CU_DEVICE_ATTRIBUTE_NUMA_ID = 131,
245
+ CU_DEVICE_ATTRIBUTE_MULTICAST_SUPPORTED = 132,
246
+ CU_DEVICE_ATTRIBUTE_MPS_ENABLED = 133,
247
+ CU_DEVICE_ATTRIBUTE_HOST_NUMA_ID = 134,
248
+ CU_DEVICE_ATTRIBUTE_MAX,
249
+ };
250
+
251
+ enum CUmemorytype {
252
+ CU_MEMORYTYPE_HOST = 0x01,
253
+ CU_MEMORYTYPE_DEVICE = 0x02,
254
+ CU_MEMORYTYPE_ARRAY = 0x03,
255
+ CU_MEMORYTYPE_UNIFIED = 0x04,
256
+ };
257
+
258
+ enum CUmem_advise {
259
+ CU_MEM_ADVISE_SET_READ_MOSTLY = 1,
260
+ CU_MEM_ADVISE_UNSET_READ_MOSTLY = 2,
261
+ CU_MEM_ADVISE_SET_PREFERRED_LOCATION = 3,
262
+ CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION = 4,
263
+ CU_MEM_ADVISE_SET_ACCESSED_BY = 5,
264
+ CU_MEM_ADVISE_UNSET_ACCESSED_BY = 6,
265
+ };
266
+
267
+ enum CUarray_cubemap_face {
268
+ CU_CUBEMAP_FACE_POSITIVE_X = 0x00,
269
+ CU_CUBEMAP_FACE_NEGATIVE_X = 0x01,
270
+ CU_CUBEMAP_FACE_POSITIVE_Y = 0x02,
271
+ CU_CUBEMAP_FACE_NEGATIVE_Y = 0x03,
272
+ CU_CUBEMAP_FACE_POSITIVE_Z = 0x04,
273
+ CU_CUBEMAP_FACE_NEGATIVE_Z = 0x05,
274
+ };
275
+
276
+ enum CUresourcetype {
277
+ CU_RESOURCE_TYPE_ARRAY = 0x00,
278
+ CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01,
279
+ CU_RESOURCE_TYPE_LINEAR = 0x02,
280
+ CU_RESOURCE_TYPE_PITCH2D = 0x03,
281
+ };
282
+
283
+ enum CUresult {
284
+ CUDA_SUCCESS = 0,
285
+ CUDA_ERROR_INVALID_VALUE = 1,
286
+ CUDA_ERROR_OUT_OF_MEMORY = 2,
287
+ CUDA_ERROR_NOT_INITIALIZED = 3,
288
+ CUDA_ERROR_DEINITIALIZED = 4,
289
+ CUDA_ERROR_PROFILER_DISABLED = 5,
290
+ CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6,
291
+ CUDA_ERROR_PROFILER_ALREADY_STARTED = 7,
292
+ CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8,
293
+ CUDA_ERROR_STUB_LIBRARY = 34,
294
+ CUDA_ERROR_DEVICE_UNAVAILABLE = 46,
295
+ CUDA_ERROR_NO_DEVICE = 100,
296
+ CUDA_ERROR_INVALID_DEVICE = 101,
297
+ CUDA_ERROR_DEVICE_NOT_LICENSED = 102,
298
+ CUDA_ERROR_INVALID_IMAGE = 200,
299
+ CUDA_ERROR_INVALID_CONTEXT = 201,
300
+ CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202,
301
+ CUDA_ERROR_MAP_FAILED = 205,
302
+ CUDA_ERROR_UNMAP_FAILED = 206,
303
+ CUDA_ERROR_ARRAY_IS_MAPPED = 207,
304
+ CUDA_ERROR_ALREADY_MAPPED = 208,
305
+ CUDA_ERROR_NO_BINARY_FOR_GPU = 209,
306
+ CUDA_ERROR_ALREADY_ACQUIRED = 210,
307
+ CUDA_ERROR_NOT_MAPPED = 211,
308
+ CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212,
309
+ CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213,
310
+ CUDA_ERROR_ECC_UNCORRECTABLE = 214,
311
+ CUDA_ERROR_UNSUPPORTED_LIMIT = 215,
312
+ CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216,
313
+ CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = 217,
314
+ CUDA_ERROR_INVALID_PTX = 218,
315
+ CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219,
316
+ CUDA_ERROR_NVLINK_UNCORRECTABLE = 220,
317
+ CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221,
318
+ CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222,
319
+ CUDA_ERROR_JIT_COMPILATION_DISABLED = 223,
320
+ CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY = 224,
321
+ CUDA_ERROR_UNSUPPORTED_DEVSIDE_SYNC = 225,
322
+ CUDA_ERROR_INVALID_SOURCE = 300,
323
+ CUDA_ERROR_FILE_NOT_FOUND = 301,
324
+ CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
325
+ CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303,
326
+ CUDA_ERROR_OPERATING_SYSTEM = 304,
327
+ CUDA_ERROR_INVALID_HANDLE = 400,
328
+ CUDA_ERROR_ILLEGAL_STATE = 401,
329
+ CUDA_ERROR_LOSSY_QUERY = 402,
330
+ CUDA_ERROR_NOT_FOUND = 500,
331
+ CUDA_ERROR_NOT_READY = 600,
332
+ CUDA_ERROR_ILLEGAL_ADDRESS = 700,
333
+ CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701,
334
+ CUDA_ERROR_LAUNCH_TIMEOUT = 702,
335
+ CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703,
336
+ CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = 704,
337
+ CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = 705,
338
+ CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = 708,
339
+ CUDA_ERROR_CONTEXT_IS_DESTROYED = 709,
340
+ CUDA_ERROR_ASSERT = 710,
341
+ CUDA_ERROR_TOO_MANY_PEERS = 711,
342
+ CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712,
343
+ CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = 713,
344
+ CUDA_ERROR_HARDWARE_STACK_ERROR = 714,
345
+ CUDA_ERROR_ILLEGAL_INSTRUCTION = 715,
346
+ CUDA_ERROR_MISALIGNED_ADDRESS = 716,
347
+ CUDA_ERROR_INVALID_ADDRESS_SPACE = 717,
348
+ CUDA_ERROR_INVALID_PC = 718,
349
+ CUDA_ERROR_LAUNCH_FAILED = 719,
350
+ CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = 720,
351
+ CUDA_ERROR_NOT_PERMITTED = 800,
352
+ CUDA_ERROR_NOT_SUPPORTED = 801,
353
+ CUDA_ERROR_SYSTEM_NOT_READY = 802,
354
+ CUDA_ERROR_SYSTEM_DRIVER_MISMATCH = 803,
355
+ CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE = 804,
356
+ CUDA_ERROR_MPS_CONNECTION_FAILED = 805,
357
+ CUDA_ERROR_MPS_RPC_FAILURE = 806,
358
+ CUDA_ERROR_MPS_SERVER_NOT_READY = 807,
359
+ CUDA_ERROR_MPS_MAX_CLIENTS_REACHED = 808,
360
+ CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED = 809,
361
+ CUDA_ERROR_MPS_CLIENT_TERMINATED = 810,
362
+ CUDA_ERROR_CDP_NOT_SUPPORTED = 811,
363
+ CUDA_ERROR_CDP_VERSION_MISMATCH = 812,
364
+ CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED = 900,
365
+ CUDA_ERROR_STREAM_CAPTURE_INVALIDATED = 901,
366
+ CUDA_ERROR_STREAM_CAPTURE_MERGE = 902,
367
+ CUDA_ERROR_STREAM_CAPTURE_UNMATCHED = 903,
368
+ CUDA_ERROR_STREAM_CAPTURE_UNJOINED = 904,
369
+ CUDA_ERROR_STREAM_CAPTURE_ISOLATION = 905,
370
+ CUDA_ERROR_STREAM_CAPTURE_IMPLICIT = 906,
371
+ CUDA_ERROR_CAPTURED_EVENT = 907,
372
+ CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD = 908,
373
+ CUDA_ERROR_TIMEOUT = 909,
374
+ CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE = 910,
375
+ CUDA_ERROR_EXTERNAL_DEVICE = 911,
376
+ CUDA_ERROR_INVALID_CLUSTER_SIZE = 912,
377
+ CUDA_ERROR_UNKNOWN = 999,
378
+ };
379
+
380
+ struct CUDA_MEMCPY2D {
381
+ size_t srcXInBytes;
382
+ size_t srcY;
383
+
384
+ CUmemorytype srcMemoryType;
385
+ const void* srcHost;
386
+ CUdeviceptr srcDevice;
387
+ CUarray srcArray;
388
+ size_t srcPitch;
389
+
390
+ size_t dstXInBytes;
391
+ size_t dstY;
392
+
393
+ CUmemorytype dstMemoryType;
394
+ void* dstHost;
395
+ CUdeviceptr dstDevice;
396
+ CUarray dstArray;
397
+ size_t dstPitch;
398
+
399
+ size_t WidthInBytes;
400
+ size_t Height;
401
+ };
402
+
403
+ struct CUDA_MEMCPY3D {
404
+ size_t srcXInBytes;
405
+ size_t srcY;
406
+ size_t srcZ;
407
+ size_t srcLOD;
408
+ CUmemorytype srcMemoryType;
409
+ const void* srcHost;
410
+ CUdeviceptr srcDevice;
411
+ CUarray srcArray;
412
+ void* reserved0;
413
+ size_t srcPitch;
414
+ size_t srcHeight;
415
+
416
+ size_t dstXInBytes;
417
+ size_t dstY;
418
+ size_t dstZ;
419
+ size_t dstLOD;
420
+ CUmemorytype dstMemoryType;
421
+ void* dstHost;
422
+ CUdeviceptr dstDevice;
423
+ CUarray dstArray;
424
+ void* reserved1;
425
+ size_t dstPitch;
426
+ size_t dstHeight;
427
+
428
+ size_t WidthInBytes;
429
+ size_t Height;
430
+ size_t Depth;
431
+ };
432
+
433
+ struct CUDA_ARRAY_DESCRIPTOR {
434
+ size_t Width;
435
+ size_t Height;
436
+
437
+ CUarray_format Format;
438
+ unsigned int NumChannels;
439
+ };
440
+
441
+ struct CUDA_ARRAY3D_DESCRIPTOR {
442
+ size_t Width;
443
+ size_t Height;
444
+ size_t Depth;
445
+
446
+ CUarray_format Format;
447
+ unsigned int NumChannels;
448
+ unsigned int Flags;
449
+ };
450
+
451
+ struct CUDA_ARRAY_MEMORY_REQUIREMENTS {
452
+ size_t size;
453
+ size_t alignment;
454
+ unsigned int reserved[4];
455
+ };
456
+
457
+ struct CUDA_RESOURCE_DESC {
458
+ CUresourcetype resType;
459
+
460
+ union {
461
+ struct {
462
+ CUarray hArray;
463
+ } array;
464
+ struct {
465
+ CUmipmappedArray hMipmappedArray;
466
+ } mipmap;
467
+ struct {
468
+ CUdeviceptr devPtr;
469
+ CUarray_format format;
470
+ unsigned int numChannels;
471
+ size_t sizeInBytes;
472
+ } linear;
473
+ struct {
474
+ CUdeviceptr devPtr;
475
+ CUarray_format format;
476
+ unsigned int numChannels;
477
+ size_t width;
478
+ size_t height;
479
+ size_t pitchInBytes;
480
+ } pitch2D;
481
+ struct {
482
+ int reserved[32];
483
+ } reserved;
484
+ } res;
485
+
486
+ unsigned int flags;
487
+ };
488
+
489
+ struct CUDA_TEXTURE_DESC {
490
+ CUaddress_mode addressMode[3];
491
+ CUfilter_mode filterMode;
492
+ unsigned int flags;
493
+ unsigned int maxAnisotropy;
494
+ CUfilter_mode mipmapFilterMode;
495
+ float mipmapLevelBias;
496
+ float minMipmapLevelClamp;
497
+ float maxMipmapLevelClamp;
498
+ float borderColor[4];
499
+ int reserved[12];
500
+ };
501
+
502
+ enum CUresourceViewFormat {
503
+ CU_RES_VIEW_FORMAT_NONE = 0x00,
504
+ CU_RES_VIEW_FORMAT_UINT_1X8 = 0x01,
505
+ CU_RES_VIEW_FORMAT_UINT_2X8 = 0x02,
506
+ CU_RES_VIEW_FORMAT_UINT_4X8 = 0x03,
507
+ CU_RES_VIEW_FORMAT_SINT_1X8 = 0x04,
508
+ CU_RES_VIEW_FORMAT_SINT_2X8 = 0x05,
509
+ CU_RES_VIEW_FORMAT_SINT_4X8 = 0x06,
510
+ CU_RES_VIEW_FORMAT_UINT_1X16 = 0x07,
511
+ CU_RES_VIEW_FORMAT_UINT_2X16 = 0x08,
512
+ CU_RES_VIEW_FORMAT_UINT_4X16 = 0x09,
513
+ CU_RES_VIEW_FORMAT_SINT_1X16 = 0x0a,
514
+ CU_RES_VIEW_FORMAT_SINT_2X16 = 0x0b,
515
+ CU_RES_VIEW_FORMAT_SINT_4X16 = 0x0c,
516
+ CU_RES_VIEW_FORMAT_UINT_1X32 = 0x0d,
517
+ CU_RES_VIEW_FORMAT_UINT_2X32 = 0x0e,
518
+ CU_RES_VIEW_FORMAT_UINT_4X32 = 0x0f,
519
+ CU_RES_VIEW_FORMAT_SINT_1X32 = 0x10,
520
+ CU_RES_VIEW_FORMAT_SINT_2X32 = 0x11,
521
+ CU_RES_VIEW_FORMAT_SINT_4X32 = 0x12,
522
+ CU_RES_VIEW_FORMAT_FLOAT_1X16 = 0x13,
523
+ CU_RES_VIEW_FORMAT_FLOAT_2X16 = 0x14,
524
+ CU_RES_VIEW_FORMAT_FLOAT_4X16 = 0x15,
525
+ CU_RES_VIEW_FORMAT_FLOAT_1X32 = 0x16,
526
+ CU_RES_VIEW_FORMAT_FLOAT_2X32 = 0x17,
527
+ CU_RES_VIEW_FORMAT_FLOAT_4X32 = 0x18,
528
+ CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = 0x19,
529
+ CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = 0x1a,
530
+ CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = 0x1b,
531
+ CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = 0x1c,
532
+ CU_RES_VIEW_FORMAT_SIGNED_BC4 = 0x1d,
533
+ CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = 0x1e,
534
+ CU_RES_VIEW_FORMAT_SIGNED_BC5 = 0x1f,
535
+ CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = 0x20,
536
+ CU_RES_VIEW_FORMAT_SIGNED_BC6H = 0x21,
537
+ CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = 0x22,
538
+ };
539
+
540
+ struct CUDA_RESOURCE_VIEW_DESC {
541
+ CUresourceViewFormat format;
542
+ size_t width;
543
+ size_t height;
544
+ size_t depth;
545
+ unsigned int firstMipmapLevel;
546
+ unsigned int lastMipmapLevel;
547
+ unsigned int firstLayer;
548
+ unsigned int lastLayer;
549
+ unsigned int reserved[16];
550
+ };
551
+
552
+
553
+ enum CUexternalMemoryHandleType {
554
+ CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = 1,
555
+ CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = 2,
556
+ CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
557
+ CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = 4,
558
+ CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = 5,
559
+ CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE = 6,
560
+ CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT = 7,
561
+ CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF = 8,
562
+ };
563
+
564
+ #define CUDA_EXTERNAL_MEMORY_DEDICATED 0x1
565
+
566
+ struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC {
567
+ CUexternalMemoryHandleType type;
568
+ union {
569
+ int fd;
570
+ struct {
571
+ void* handle;
572
+ const void* name;
573
+ } win32;
574
+ const void* nvSciBufObject;
575
+ } handle;
576
+ unsigned long long size;
577
+ unsigned int flags;
578
+ unsigned int reserved[16];
579
+ };
580
+
581
+ struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC {
582
+ unsigned long long offset;
583
+ unsigned long long size;
584
+ unsigned int flags;
585
+ unsigned int reserved[16];
586
+ };
587
+
588
+ struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC {
589
+ unsigned long long offset;
590
+ CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
591
+ unsigned int numLevels;
592
+ unsigned int reserved[16];
593
+ };
594
+
595
+ enum CUexternalSemaphoreHandleType {
596
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = 1,
597
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = 2,
598
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
599
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = 4,
600
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE = 5,
601
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC = 6,
602
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX = 7,
603
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT = 8,
604
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD = 9,
605
+ CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 = 10,
606
+ };
607
+
608
+ struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC {
609
+ CUexternalSemaphoreHandleType type;
610
+ union {
611
+ int fd;
612
+ struct {
613
+ void* handle;
614
+ const void* name;
615
+ } win32;
616
+ const void* nvSciSyncObj;
617
+ } handle;
618
+ unsigned int flags;
619
+ unsigned int reserved[16];
620
+ };
621
+
622
+ struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS {
623
+ struct {
624
+ struct {
625
+ unsigned long long value;
626
+ } fence;
627
+ union {
628
+ void* fence;
629
+ unsigned long long reserved;
630
+ } nvSciSync;
631
+ struct {
632
+ unsigned long long key;
633
+ } keyedMutex;
634
+ unsigned int reserved[12];
635
+ } params;
636
+ unsigned int flags;
637
+ unsigned int reserved[16];
638
+ };
639
+
640
+ struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS {
641
+ struct {
642
+ struct {
643
+ unsigned long long value;
644
+ } fence;
645
+ union {
646
+ void* fence;
647
+ unsigned long long reserved;
648
+ } nvSciSync;
649
+ struct {
650
+ unsigned long long key;
651
+ unsigned int timeoutMs;
652
+ } keyedMutex;
653
+ unsigned int reserved[10];
654
+ } params;
655
+ unsigned int flags;
656
+ unsigned int reserved[16];
657
+ };
658
+
659
+ enum CUmemLocationType {
660
+ CU_MEM_LOCATION_TYPE_INVALID = 0x0,
661
+ CU_MEM_LOCATION_TYPE_DEVICE = 0x1,
662
+ CU_MEM_LOCATION_TYPE_HOST = 0x2,
663
+ CU_MEM_LOCATION_TYPE_HOST_NUMA = 0x3,
664
+ CU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENT = 0x4,
665
+ CU_MEM_LOCATION_TYPE_MAX = 0x7FFFFFFF,
666
+ };
667
+
668
+ struct CUmemLocation {
669
+ CUmemLocationType type;
670
+ int id;
671
+ };
672
+
673
+ #define CUDA_ARRAY3D_LAYERED 0x01
674
+ #define CUDA_ARRAY3D_SURFACE_LDST 0x02
675
+ #define CUDA_ARRAY3D_CUBEMAP 0x04
676
+ #define CUDA_ARRAY3D_TEXTURE_GATHER 0x08
677
+ #define CUDA_ARRAY3D_DEPTH_TEXTURE 0x10
678
+ #define CUDA_ARRAY3D_COLOR_ATTACHMENT 0x20
679
+ #define CUDA_ARRAY3D_SPARSE 0x40
680
+ #define CUDA_ARRAY3D_DEFERRED_MAPPING 0x80
681
+
682
+ #define CU_DEVICE_CPU ((CUdevice)-1)
683
+ #define CU_DEVICE_INVALID ((CUdevice)-2)
684
+
685
+ #if !defined(SGL_CUDA_SYM)
686
+ #define SGL_CUDA_SYM(x) extern x;
687
+ #endif
688
+
689
+ // clang-format off
690
+ SGL_CUDA_SYM(CUresult (*cuGetErrorString)(CUresult, const char**));
691
+ SGL_CUDA_SYM(CUresult (*cuGetErrorName)(CUresult, const char**));
692
+ SGL_CUDA_SYM(CUresult (*cuInit)(unsigned int));
693
+ SGL_CUDA_SYM(CUresult (*cuDriverGetVersion)(int*));
694
+ SGL_CUDA_SYM(CUresult (*cuDeviceGet)(CUdevice*, int));
695
+ SGL_CUDA_SYM(CUresult (*cuDeviceGetCount)(int*));
696
+ SGL_CUDA_SYM(CUresult (*cuDeviceGetName)(char*, int, CUdevice));
697
+ SGL_CUDA_SYM(CUresult (*cuDeviceGetUuid)(CUuuid*, CUdevice));
698
+ SGL_CUDA_SYM(CUresult (*cuDeviceGetLuid)(char*, unsigned int*, CUdevice));
699
+ SGL_CUDA_SYM(CUresult (*cuDeviceTotalMem)(size_t*, CUdevice));
700
+ SGL_CUDA_SYM(CUresult (*cuDeviceGetAttribute)(int*, CUdevice_attribute, CUdevice));
701
+ SGL_CUDA_SYM(CUresult (*cuDevicePrimaryCtxRetain)(CUcontext*, CUdevice));
702
+ SGL_CUDA_SYM(CUresult (*cuDevicePrimaryCtxRelease)(CUdevice));
703
+ SGL_CUDA_SYM(CUresult (*cuDevicePrimaryCtxReset)(CUdevice));
704
+ SGL_CUDA_SYM(CUresult (*cuCtxPushCurrent)(CUcontext));
705
+ SGL_CUDA_SYM(CUresult (*cuCtxPopCurrent)(CUcontext*));
706
+ SGL_CUDA_SYM(CUresult (*cuCtxSetCurrent)(CUcontext));
707
+ SGL_CUDA_SYM(CUresult (*cuCtxGetCurrent)(CUcontext*));
708
+ SGL_CUDA_SYM(CUresult (*cuCtxGetDevice)(CUdevice*));
709
+ SGL_CUDA_SYM(CUresult (*cuCtxSynchronize)());
710
+ SGL_CUDA_SYM(CUresult (*cuMemGetInfo)(size_t*, size_t*));
711
+ SGL_CUDA_SYM(CUresult (*cuMemAlloc)(CUdeviceptr*, size_t));
712
+ SGL_CUDA_SYM(CUresult (*cuMemFree)(CUdeviceptr));
713
+ SGL_CUDA_SYM(CUresult (*cuMemAllocHost)(void**, size_t));
714
+ SGL_CUDA_SYM(CUresult (*cuMemFreeHost)(void*));
715
+ SGL_CUDA_SYM(CUresult (*cuMemcpy)(CUdeviceptr, CUdeviceptr, size_t));
716
+ SGL_CUDA_SYM(CUresult (*cuMemcpyHtoD)(CUdeviceptr, const void*, size_t));
717
+ SGL_CUDA_SYM(CUresult (*cuMemcpyDtoH)(void*, CUdeviceptr, size_t));
718
+ SGL_CUDA_SYM(CUresult (*cuMemcpyDtoD)(CUdeviceptr, CUdeviceptr, size_t));
719
+ SGL_CUDA_SYM(CUresult (*cuMemcpy2D)(const CUDA_MEMCPY2D*));
720
+ SGL_CUDA_SYM(CUresult (*cuMemcpy2DUnaligned)(const CUDA_MEMCPY2D*));
721
+ SGL_CUDA_SYM(CUresult (*cuMemcpy3D)(const CUDA_MEMCPY3D*));
722
+ SGL_CUDA_SYM(CUresult (*cuMemcpyAsync)(CUdeviceptr, CUdeviceptr, size_t, CUstream));
723
+ SGL_CUDA_SYM(CUresult (*cuMemcpyHtoDAsync)(CUdeviceptr, const void*, size_t, CUstream));
724
+ SGL_CUDA_SYM(CUresult (*cuMemcpyDtoHAsync)(void*, CUdeviceptr, size_t, CUstream));
725
+ SGL_CUDA_SYM(CUresult (*cuMemcpyDtoDAsync)(CUdeviceptr, CUdeviceptr, size_t, CUstream));
726
+ SGL_CUDA_SYM(CUresult (*cuMemcpy2DAsync)(const CUDA_MEMCPY2D*, CUstream));
727
+ SGL_CUDA_SYM(CUresult (*cuMemcpy3DAsync)(const CUDA_MEMCPY3D*, CUstream));
728
+ SGL_CUDA_SYM(CUresult (*cuMemsetD8)(CUdeviceptr, unsigned char, size_t));
729
+ SGL_CUDA_SYM(CUresult (*cuMemsetD16)(CUdeviceptr, unsigned short, size_t));
730
+ SGL_CUDA_SYM(CUresult (*cuMemsetD32)(CUdeviceptr, unsigned int, size_t));
731
+ SGL_CUDA_SYM(CUresult (*cuMemsetD2D8)(CUdeviceptr, size_t, unsigned char, size_t, size_t));
732
+ SGL_CUDA_SYM(CUresult (*cuMemsetD2D16)(CUdeviceptr, size_t, unsigned short, size_t, size_t));
733
+ SGL_CUDA_SYM(CUresult (*cuMemsetD2D32)(CUdeviceptr, size_t, unsigned int, size_t, size_t));
734
+ SGL_CUDA_SYM(CUresult (*cuMemsetD8Async)(CUdeviceptr, unsigned char, size_t, CUstream));
735
+ SGL_CUDA_SYM(CUresult (*cuMemsetD16Async)(CUdeviceptr, unsigned short, size_t, CUstream));
736
+ SGL_CUDA_SYM(CUresult (*cuMemsetD32Async)(CUdeviceptr, unsigned int, size_t, CUstream));
737
+ SGL_CUDA_SYM(CUresult (*cuMemsetD2D8Async)(CUdeviceptr, size_t, unsigned char, size_t, size_t, CUstream));
738
+ SGL_CUDA_SYM(CUresult (*cuMemsetD2D16Async)(CUdeviceptr, size_t, unsigned short, size_t, size_t, CUstream));
739
+ SGL_CUDA_SYM(CUresult (*cuMemsetD2D32Async)(CUdeviceptr, size_t, unsigned int, size_t, size_t, CUstream));
740
+ SGL_CUDA_SYM(CUresult (*cuMemAdvise)(CUdeviceptr, size_t, CUmem_advise, CUmemLocation));
741
+ SGL_CUDA_SYM(CUresult (*cuStreamCreate)(CUstream*, unsigned int));
742
+ SGL_CUDA_SYM(CUresult (*cuStreamCreateWithPriority)(CUstream*, unsigned int, int));
743
+ SGL_CUDA_SYM(CUresult (*cuStreamWaitEvent)(CUstream, CUevent, unsigned int));
744
+ SGL_CUDA_SYM(CUresult (*cuStreamSynchronize)(CUstream));
745
+ SGL_CUDA_SYM(CUresult (*cuStreamDestroy)(CUstream));
746
+ SGL_CUDA_SYM(CUresult (*cuEventCreate)(CUevent*, unsigned int));
747
+ SGL_CUDA_SYM(CUresult (*cuEventRecord)(CUevent, CUstream));
748
+ SGL_CUDA_SYM(CUresult (*cuEventQuery)(CUevent));
749
+ SGL_CUDA_SYM(CUresult (*cuEventSynchronize)(CUevent));
750
+ SGL_CUDA_SYM(CUresult (*cuEventDestroy)(CUevent));
751
+ SGL_CUDA_SYM(CUresult (*cuEventElapsedTime)(float*, CUevent, CUevent));
752
+ SGL_CUDA_SYM(CUresult (*cuImportExternalMemory)(CUexternalMemory*, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC*));
753
+ SGL_CUDA_SYM(CUresult (*cuExternalMemoryGetMappedBuffer)(CUdeviceptr*, CUexternalMemory, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC*));
754
+ SGL_CUDA_SYM(CUresult (*cuExternalMemoryGetMappedMipmappedArray)(CUmipmappedArray*, CUexternalMemory, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC*));
755
+ SGL_CUDA_SYM(CUresult (*cuDestroyExternalMemory)(CUexternalMemory));
756
+ SGL_CUDA_SYM(CUresult (*cuImportExternalSemaphore)(CUexternalSemaphore*, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC*));
757
+ SGL_CUDA_SYM(CUresult (*cuSignalExternalSemaphoresAsync)(const CUexternalSemaphore*, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS*, unsigned int, CUstream));
758
+ SGL_CUDA_SYM(CUresult (*cuWaitExternalSemaphoresAsync)(const CUexternalSemaphore*, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS*, unsigned int, CUstream));
759
+ SGL_CUDA_SYM(CUresult (*cuDestroyExternalSemaphore)(CUexternalSemaphore));
760
+ // clang-format on
761
+
762
+ #else // SGL_USE_DYNAMIC_CUDA
763
+
764
+ #include <cuda.h>
765
+
766
+ #endif // SGL_USE_DYNAMIC_CUDA