CUDA.Import.hpp 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. // CodeGear C++Builder
  2. // Copyright (c) 1995, 2024 by Embarcadero Technologies, Inc.
  3. // All rights reserved
  4. // (DO NOT EDIT: machine generated header) 'CUDA.Import.pas' rev: 36.00 (Windows)
  5. #ifndef CUDA_ImportHPP
  6. #define CUDA_ImportHPP
  7. #pragma delphiheader begin
  8. #pragma option push
  9. #if defined(__BORLANDC__) && !defined(__clang__)
  10. #pragma option -w- // All warnings off
  11. #pragma option -Vx // Zero-length empty class member
  12. #endif
  13. #pragma pack(push,8)
  14. #include <System.hpp>
  15. #include <SysInit.hpp>
  16. #include <Winapi.Windows.hpp>
  17. //-- user supplied -----------------------------------------------------------
  18. namespace Cuda
  19. {
  20. namespace Import
  21. {
  22. //-- forward type declarations -----------------------------------------------
  23. struct DECLSPEC_DRECORD TCUcontext
  24. {
  25. };
  26. struct DECLSPEC_DRECORD TCUmodule
  27. {
  28. };
  29. struct DECLSPEC_DRECORD TCUfunction
  30. {
  31. };
  32. struct DECLSPEC_DRECORD TCUarray
  33. {
  34. };
  35. struct DECLSPEC_DRECORD TCUtexref
  36. {
  37. };
  38. struct DECLSPEC_DRECORD TCUevent
  39. {
  40. };
  41. struct DECLSPEC_DRECORD TCUstream
  42. {
  43. };
  44. struct DECLSPEC_DRECORD TCUgraphicsResource
  45. {
  46. };
  47. struct TCUdevprop;
  48. struct TcudaFuncAttributes;
  49. struct TCUDA_MEMCPY2D;
  50. struct TCUDA_MEMCPY3D;
  51. struct TCUDA_ARRAY_DESCRIPTOR;
  52. struct TCUDA_ARRAY3D_DESCRIPTOR;
  53. //-- type declarations -------------------------------------------------------
  54. typedef void * TCUdeviceptr;
  55. typedef int TCUdevice;
  56. typedef TCUcontext *PCUcontext;
  57. typedef TCUmodule *PCUmodule;
  58. typedef TCUfunction *PCUfunction;
  59. typedef TCUarray *PCUarray;
  60. typedef TCUtexref *PCUtexref;
  61. typedef TCUevent *PCUevent;
  62. typedef TCUstream *PCUstream;
  63. typedef TCUgraphicsResource *PCUgraphicsResource;
  64. typedef PCUgraphicsResource *PPCUgraphicsResource;
  65. enum DECLSPEC_DENUM TCUctx_flags : unsigned char { CU_CTX_SCHED_AUTO, CU_CTX_SCHED_SPIN, CU_CTX_SCHED_YIELD, CU_CTX_SCHED_MASK, CU_CTX_BLOCKING_SYNC, CU_CTX_MAP_HOST = 8, CU_CTX_FLAGS_MASK = 15 };
  66. enum DECLSPEC_DENUM TCUevent_flags : unsigned char { CU_EVENT_DEFAULT, CU_EVENT_BLOCKING_SYNC };
  67. enum DECLSPEC_DENUM TCUarray_format : unsigned char { CU_AD_FORMAT_UNSIGNED_INT8 = 1, CU_AD_FORMAT_UNSIGNED_INT16, CU_AD_FORMAT_UNSIGNED_INT32, CU_AD_FORMAT_SIGNED_INT8 = 8, CU_AD_FORMAT_SIGNED_INT16, CU_AD_FORMAT_SIGNED_INT32, CU_AD_FORMAT_HALF = 16, CU_AD_FORMAT_FLOAT = 32 };
  68. enum DECLSPEC_DENUM TCUaddress_mode : unsigned char { CU_TR_ADDRESS_MODE_WRAP, CU_TR_ADDRESS_MODE_CLAMP, CU_TR_ADDRESS_MODE_MIRROR };
  69. enum DECLSPEC_DENUM TCUfilter_mode : unsigned char { CU_TR_FILTER_MODE_POINT, CU_TR_FILTER_MODE_LINEAR };
  70. enum DECLSPEC_DENUM TCUdevice_attribute : unsigned char { CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1, CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X, CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y, CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z, CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK, CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8, CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, CU_DEVICE_ATTRIBUTE_WARP_SIZE, CU_DEVICE_ATTRIBUTE_MAX_PITCH, CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK, CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT, CU_DEVICE_ATTRIBUTE_GPU_OVERLAP, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT,
  71. CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, CU_DEVICE_ATTRIBUTE_INTEGRATED, CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, CU_DEVICE_ATTRIBUTE_COMPUTE_MODE };
  72. enum DECLSPEC_DENUM TcudaLimit : unsigned char { cudaLimitStackSize, cudaLimitPrintfFifoSize };
  73. struct DECLSPEC_DRECORD TCUdevprop
  74. {
  75. public:
  76. int maxThreadsPerBlock;
  77. System::StaticArray<int, 3> maxThreadsDim;
  78. System::StaticArray<int, 3> maxGridSize;
  79. int sharedMemPerBlock;
  80. int totalConstantMemory;
  81. int SIMDWidth;
  82. int memPitch;
  83. int regsPerBlock;
  84. int clockRate;
  85. int textureAlign;
  86. };
  87. enum DECLSPEC_DENUM TCUfunction_attribute : unsigned char { CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES, CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES, CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES, CU_FUNC_ATTRIBUTE_NUM_REGS, CU_FUNC_ATTRIBUTE_MAX };
  88. enum DECLSPEC_DENUM TCUmemorytype : unsigned char { CU_MEMORYTYPE_HOST = 1, CU_MEMORYTYPE_DEVICE, CU_MEMORYTYPE_ARRAY };
  89. enum DECLSPEC_DENUM TCUcomputemode : unsigned char { CU_COMPUTEMODE_DEFAULT, CU_COMPUTEMODE_EXCLUSIVE, CU_COMPUTEMODE_PROHIBITED };
  90. enum DECLSPEC_DENUM TCUjit_option : unsigned char { CU_JIT_MAX_REGISTERS, CU_JIT_THREADS_PER_BLOCK, CU_JIT_WALL_TIME, CU_JIT_INFO_LOG_BUFFER, CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, CU_JIT_ERROR_LOG_BUFFER, CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, CU_JIT_OPTIMIZATION_LEVEL, CU_JIT_TARGET_FROM_CUCONTEXT, CU_JIT_TARGET, CU_JIT_FALLBACK_STRATEGY };
  91. enum DECLSPEC_DENUM TCUjit_target : unsigned char { CU_TARGET_COMPUTE_10, CU_TARGET_COMPUTE_11, CU_TARGET_COMPUTE_12, CU_TARGET_COMPUTE_13 };
  92. enum DECLSPEC_DENUM TCUjit_fallback : unsigned char { CU_PREFER_PTX, CU_PREFER_BINARY };
  93. enum DECLSPEC_DENUM TCUgraphicsRegisterFlags : unsigned char { CU_GRAPHICS_REGISTER_FLAGS_NONE };
  94. enum DECLSPEC_DENUM TCUgraphicsMapResourceFlags : unsigned char { CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE, CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY, CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD };
  95. enum DECLSPEC_DENUM TCUarray_cubemap_face : unsigned char { CU_CUBEMAP_FACE_POSITIVE_X, CU_CUBEMAP_FACE_NEGATIVE_X, CU_CUBEMAP_FACE_POSITIVE_Y, CU_CUBEMAP_FACE_NEGATIVE_Y, CU_CUBEMAP_FACE_POSITIVE_Z, CU_CUBEMAP_FACE_NEGATIVE_Z };
  96. struct DECLSPEC_DRECORD TcudaFuncAttributes
  97. {
  98. public:
  99. System::NativeUInt sharedSizeBytes;
  100. System::NativeUInt constSizeBytes;
  101. System::NativeUInt localSizeBytes;
  102. int maxThreadsPerBlock;
  103. int numRegs;
  104. int ptxVersion;
  105. int binaryVersion;
  106. System::StaticArray<int, 6> __cudaReserved;
  107. };
  108. enum DECLSPEC_DENUM TcudaFuncCache : unsigned char { cudaFuncCachePreferNone, cudaFuncCachePreferShared, cudaFuncCachePreferL1 };
  109. typedef unsigned TCUresult;
  110. typedef TCUDA_MEMCPY2D *PCUDA_MEMCPY2D;
  111. struct DECLSPEC_DRECORD TCUDA_MEMCPY2D
  112. {
  113. public:
  114. unsigned srcXInBytes;
  115. unsigned srcY;
  116. TCUmemorytype srcMemoryType;
  117. void *srcHost;
  118. TCUdeviceptr srcDevice;
  119. PCUarray srcArray;
  120. unsigned srcPitch;
  121. unsigned dstXInBytes;
  122. unsigned dstY;
  123. TCUmemorytype dstMemoryType;
  124. void *dstHost;
  125. TCUdeviceptr dstDevice;
  126. PCUarray dstArray;
  127. unsigned dstPitch;
  128. unsigned WidthInBytes;
  129. unsigned Height;
  130. };
  131. struct DECLSPEC_DRECORD TCUDA_MEMCPY3D
  132. {
  133. public:
  134. unsigned srcXInBytes;
  135. unsigned srcY;
  136. unsigned srcZ;
  137. unsigned srcLOD;
  138. TCUmemorytype srcMemoryType;
  139. void *srcHost;
  140. TCUdeviceptr srcDevice;
  141. PCUarray srcArray;
  142. void *reserved0;
  143. unsigned srcPitch;
  144. unsigned srcHeight;
  145. unsigned dstXInBytes;
  146. unsigned dstY;
  147. unsigned dstZ;
  148. unsigned dstLOD;
  149. TCUmemorytype dstMemoryType;
  150. void *dstHost;
  151. TCUdeviceptr dstDevice;
  152. PCUarray dstArray;
  153. void *reserved1;
  154. unsigned dstPitch;
  155. unsigned dstHeight;
  156. unsigned WidthInBytes;
  157. unsigned Height;
  158. unsigned Depth;
  159. };
  160. typedef TCUDA_ARRAY_DESCRIPTOR *PCUDA_ARRAY_DESCRIPTOR;
  161. struct DECLSPEC_DRECORD TCUDA_ARRAY_DESCRIPTOR
  162. {
  163. public:
  164. unsigned Width;
  165. unsigned Height;
  166. TCUarray_format Format;
  167. unsigned NumChannels;
  168. };
  169. struct DECLSPEC_DRECORD TCUDA_ARRAY3D_DESCRIPTOR
  170. {
  171. public:
  172. unsigned Width;
  173. unsigned Height;
  174. unsigned Depth;
  175. TCUarray_format Format;
  176. unsigned NumChannels;
  177. unsigned Flags;
  178. };
  179. enum DECLSPEC_DENUM TCUGLmap_flags : unsigned char { CU_GL_MAP_RESOURCE_FLAGS_NONE, CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY, CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD };
  180. typedef System::StaticArray<unsigned, 3> TDim3;
  181. typedef void * HGPUNV;
  182. typedef TCUresult __stdcall (*TcuInit)(unsigned Flags);
  183. typedef TCUresult __stdcall (*TcuDriverGetVersion)(/* out */ int &driverVersion);
  184. typedef TCUresult __stdcall (*TcuDeviceGet)(TCUdevice &device, int ordinal);
  185. typedef TCUresult __stdcall (*TcuDeviceGetCount)(int &count);
  186. typedef TCUresult __stdcall (*TcuDeviceGetName)(char * name, int len, TCUdevice dev);
  187. typedef TCUresult __stdcall (*TcuDeviceComputeCapability)(int &major, int &minor, TCUdevice dev);
  188. typedef TCUresult __stdcall (*TcuDeviceTotalMem)(PSIZE_T bytes, TCUdevice dev);
  189. typedef TCUresult __stdcall (*TcuDeviceGetProperties)(TCUdevprop &prop, TCUdevice dev);
  190. typedef TCUresult __stdcall (*TcuDeviceGetAttribute)(PSIZE_T pi, TCUdevice_attribute attrib, TCUdevice dev);
  191. typedef TCUresult __stdcall (*TcuCtxCreate)(PCUcontext &pctx, unsigned Flags, TCUdevice dev);
  192. typedef TCUresult __stdcall (*TcuCtxDestroy)(PCUcontext ctx);
  193. typedef TCUresult __stdcall (*TcuCtxAttach)(PCUcontext &pctx, unsigned Flags);
  194. typedef TCUresult __stdcall (*TcuCtxDetach)(PCUcontext ctx);
  195. typedef TCUresult __stdcall (*TcuCtxPushCurrent)(PCUcontext ctx);
  196. typedef TCUresult __stdcall (*TcuCtxPopCurrent)(PCUcontext &pctx);
  197. typedef TCUresult __stdcall (*TcuCtxGetDevice)(TCUdevice &device);
  198. typedef TCUresult __stdcall (*TcuCtxSynchronize)(void);
  199. typedef TCUresult __stdcall (*TcuModuleLoad)(PCUmodule &module, const char * fname);
  200. typedef TCUresult __stdcall (*TcuModuleLoadData)(PCUmodule &module, const char * image);
  201. typedef TCUresult __stdcall (*TcuModuleLoadDataEx)(PCUmodule &module, void *image, unsigned numOptions, TCUjit_option &options, void *optionValues);
  202. typedef TCUresult __stdcall (*TcuModuleLoadFatBinary)(PCUmodule &module, void *fatCubin);
  203. typedef TCUresult __stdcall (*TcuModuleUnload)(PCUmodule hmod);
  204. typedef TCUresult __stdcall (*TcuModuleGetFunction)(/* out */ PCUfunction &hfunc, PCUmodule hmod, const char * name);
  205. typedef TCUresult __stdcall (*TcuModuleGetGlobal)(/* out */ TCUdeviceptr &dptr, unsigned &bytes, PCUmodule hmod, const char * name);
  206. typedef TCUresult __stdcall (*TcuModuleGetTexRef)(/* out */ PCUtexref &pTexRef, PCUmodule hmod, const char * name);
  207. typedef TCUresult __stdcall (*TcuMemGetInfo)(unsigned &free, unsigned &total);
  208. typedef TCUresult __stdcall (*TcuMemAlloc)(TCUdeviceptr &dptr, unsigned bytesize);
  209. typedef TCUresult __stdcall (*TcuMemAllocPitch)(TCUdeviceptr &dptr, unsigned &pPitch, unsigned WidthInBytes, unsigned Height, unsigned ElementSizeBytes);
  210. typedef TCUresult __stdcall (*TcuMemFree)(TCUdeviceptr dptr);
  211. typedef TCUresult __stdcall (*TcuMemGetAddressRange)(TCUdeviceptr &pbase, unsigned &psize, TCUdeviceptr dptr);
  212. typedef TCUresult __stdcall (*TcuMemAllocHost)(void *pp, unsigned bytesize);
  213. typedef TCUresult __stdcall (*TcuMemFreeHost)(void * p);
  214. typedef TCUresult __stdcall (*TcuMemHostAlloc)(void * &pp, unsigned bytesize, unsigned Flags);
  215. typedef TCUresult __stdcall (*TcuMemHostGetDevicePointer)(TCUdeviceptr &pdptr, void * p, unsigned Flags);
  216. typedef TCUresult __stdcall (*TcuMemHostGetFlags)(unsigned &pFlags, void *p);
  217. typedef TCUresult __stdcall (*TcuMemcpyHtoD)(TCUdeviceptr dstDevice, const void * srcHost, unsigned ByteCount);
  218. typedef TCUresult __stdcall (*TcuMemcpyDtoH)(const void * dstHost, TCUdeviceptr srcDevice, unsigned ByteCount);
  219. typedef TCUresult __stdcall (*TcuMemcpyDtoD)(TCUdeviceptr dstDevice, TCUdeviceptr srcDevice, unsigned ByteCount);
  220. typedef TCUresult __stdcall (*TcuMemcpyDtoDAsync)(TCUdeviceptr dstDevice, TCUdeviceptr srcDevice, unsigned ByteCount, PCUstream hStream);
  221. typedef TCUresult __stdcall (*TcuMemcpyDtoA)(PCUarray dstArray, unsigned dstIndex, TCUdeviceptr srcDevice, unsigned ByteCount);
  222. typedef TCUresult __stdcall (*TcuMemcpyAtoD)(TCUdeviceptr dstDevice, PCUarray hSrc, unsigned SrcIndex, unsigned ByteCount);
  223. typedef TCUresult __stdcall (*TcuMemcpyHtoA)(PCUarray dstArray, unsigned dstIndex, void * pSrc, unsigned ByteCount);
  224. typedef TCUresult __stdcall (*TcuMemcpyAtoH)(void * dstHost, PCUarray srcArray, unsigned SrcIndex, unsigned ByteCount);
  225. typedef TCUresult __stdcall (*TcuMemcpyAtoA)(PCUarray dstArray, unsigned dstIndex, PCUarray srcArray, unsigned SrcIndex, unsigned ByteCount);
  226. typedef TCUresult __stdcall (*TcuMemcpy2D)(const PCUDA_MEMCPY2D pCopy);
  227. typedef TCUresult __stdcall (*TcuMemcpy2DUnaligned)(TCUDA_MEMCPY2D &pCopy);
  228. typedef TCUresult __stdcall (*TcuMemcpy3D)(TCUDA_MEMCPY3D &pCopy);
  229. typedef TCUresult __stdcall (*TcuMemcpyHtoDAsync)(TCUdeviceptr dstDevice, void *srcHost, unsigned ByteCount, PCUstream hStream);
  230. typedef TCUresult __stdcall (*TcuMemcpyDtoHAsync)(void *dstHost, TCUdeviceptr srcDevice, unsigned ByteCount, PCUstream hStream);
  231. typedef TCUresult __stdcall (*TcuMemcpyHtoAAsync)(PCUarray dstArray, unsigned dstIndex, void *pSrc, unsigned ByteCount, PCUstream hStream);
  232. typedef TCUresult __stdcall (*TcuMemcpyAtoHAsync)(void *dstHost, PCUstream srcArray, unsigned SrcIndex, unsigned ByteCount, PCUstream hStream);
  233. typedef TCUresult __stdcall (*TcuMemcpy2DAsync)(TCUDA_MEMCPY2D &pCopy, PCUstream hStream);
  234. typedef TCUresult __stdcall (*TcuMemcpy3DAsync)(TCUDA_MEMCPY3D &pCopy, PCUstream hStream);
  235. typedef TCUresult __stdcall (*TcuMemsetD8)(TCUdeviceptr dstDevice, System::Byte ub, unsigned N);
  236. typedef TCUresult __stdcall (*TcuMemsetD16)(TCUdeviceptr dstDevice, System::Word uw, unsigned N);
  237. typedef TCUresult __stdcall (*TcuMemsetD32)(TCUdeviceptr dstDevice, unsigned ui, unsigned N);
  238. typedef TCUresult __stdcall (*TcuMemsetD2D8)(TCUdeviceptr dstDevice, unsigned dstPitch, System::Byte ub, unsigned Width, unsigned Height);
  239. typedef TCUresult __stdcall (*TcuMemsetD2D16)(TCUdeviceptr dstDevice, unsigned dstPitch, System::Word uw, unsigned Width, unsigned Height);
  240. typedef TCUresult __stdcall (*TcuMemsetD2D32)(TCUdeviceptr dstDevice, unsigned dstPitch, unsigned ui, unsigned Width, unsigned Height);
  241. typedef TCUresult __stdcall (*TcuFuncSetBlockShape)(PCUfunction hfunc, int x, int y, int z);
  242. typedef TCUresult __stdcall (*TcuFuncSetSharedSize)(PCUfunction hfunc, unsigned bytes);
  243. typedef TCUresult __stdcall (*TcuFuncGetAttribute)(int &pi, TCUfunction_attribute attrib, PCUfunction hfunc);
  244. typedef TCUresult __stdcall (*TcuArrayCreate)(PCUarray &pHandle, TCUDA_ARRAY_DESCRIPTOR &pAllocateArray);
  245. typedef TCUresult __stdcall (*TcuArrayGetDescriptor)(TCUDA_ARRAY_DESCRIPTOR &pArrayDescriptor, PCUarray hArray);
  246. typedef TCUresult __stdcall (*TcuArrayDestroy)(PCUarray hArray);
  247. typedef TCUresult __stdcall (*TcuArray3DCreate)(PCUarray &pHandle, TCUDA_ARRAY3D_DESCRIPTOR &pAllocateArray);
  248. typedef TCUresult __stdcall (*TcuArray3DGetDescriptor)(TCUDA_ARRAY3D_DESCRIPTOR &pArrayDescriptor, PCUarray hArray);
  249. typedef TCUresult __stdcall (*TcuTexRefCreate)(PCUtexref &pTexRef);
  250. typedef TCUresult __stdcall (*TcuTexRefDestroy)(PCUtexref hTexRef);
  251. typedef TCUresult __stdcall (*TcuTexRefSetArray)(PCUtexref hTexRef, PCUarray hArray, unsigned Flags);
  252. typedef TCUresult __stdcall (*TcuTexRefSetAddress)(unsigned &ByteOffset, PCUtexref hTexRef, TCUdeviceptr dptr, unsigned bytes);
  253. typedef TCUresult __stdcall (*TcuTexRefSetAddress2D)(PCUtexref hTexRef, TCUDA_ARRAY_DESCRIPTOR &desc, TCUdeviceptr dptr, unsigned Pitch);
  254. typedef TCUresult __stdcall (*TcuTexRefSetFormat)(PCUtexref hTexRef, TCUarray_format fmt, int NumPackedComponents);
  255. typedef TCUresult __stdcall (*TcuTexRefSetAddressMode)(PCUtexref hTexRef, int dim, TCUaddress_mode am);
  256. typedef TCUresult __stdcall (*TcuTexRefSetFilterMode)(PCUtexref hTexRef, TCUfilter_mode fm);
  257. typedef TCUresult __stdcall (*TcuTexRefSetFlags)(PCUtexref hTexRef, unsigned Flags);
  258. typedef TCUresult __stdcall (*TcuTexRefGetAddress)(TCUdeviceptr &pdptr, PCUtexref hTexRef);
  259. typedef TCUresult __stdcall (*TcuTexRefGetArray)(PCUarray &phArray, PCUtexref hTexRef);
  260. typedef TCUresult __stdcall (*TcuTexRefGetAddressMode)(TCUaddress_mode &pam, PCUtexref hTexRef, int dim);
  261. typedef TCUresult __stdcall (*TcuTexRefGetFilterMode)(TCUfilter_mode &pfm, PCUtexref hTexRef);
  262. typedef TCUresult __stdcall (*TcuTexRefGetFormat)(TCUarray_format &pFormat, int &pNumChannels, PCUtexref hTexRef);
  263. typedef TCUresult __stdcall (*TcuTexRefGetFlags)(unsigned &pFlags, PCUtexref hTexRef);
  264. typedef TCUresult __stdcall (*TcuParamSetSize)(PCUfunction hfunc, unsigned numbytes);
  265. typedef TCUresult __stdcall (*TcuParamSeti)(PCUfunction hfunc, int offset, unsigned value);
  266. typedef TCUresult __stdcall (*TcuParamSetf)(PCUfunction hfunc, int offset, float value);
  267. typedef TCUresult __stdcall (*TcuParamSetv)(PCUfunction hfunc, int offset, void *ptr, unsigned numbytes);
  268. typedef TCUresult __stdcall (*TcuParamSetTexRef)(PCUfunction hfunc, int texunit, PCUtexref hTexRef);
  269. typedef TCUresult __stdcall (*TcuLaunch)(PCUfunction f);
  270. typedef TCUresult __stdcall (*TcuLaunchGrid)(PCUfunction f, int grid_width, int grid_height);
  271. typedef TCUresult __stdcall (*TcuLaunchGridAsync)(PCUfunction f, int grid_width, int grid_height, PCUstream hStream);
  272. typedef TCUresult __stdcall (*TcuEventCreate)(PCUevent &phEvent, unsigned Flags);
  273. typedef TCUresult __stdcall (*TcuEventRecord)(PCUevent hEvent, PCUstream hStream);
  274. typedef TCUresult __stdcall (*TcuEventQuery)(PCUevent hEvent);
  275. typedef TCUresult __stdcall (*TcuEventSynchronize)(PCUevent hEvent);
  276. typedef TCUresult __stdcall (*TcuEventDestroy)(PCUevent hEvent);
  277. typedef TCUresult __stdcall (*TcuEventElapsedTime)(float &pMilliseconds, PCUevent hStart, PCUevent hEnd);
  278. typedef TCUresult __stdcall (*TcuStreamCreate)(PCUstream &phStream, unsigned Flags);
  279. typedef TCUresult __stdcall (*TcuStreamQuery)(PCUstream hStream);
  280. typedef TCUresult __stdcall (*TcuStreamSynchronize)(PCUstream hStream);
  281. typedef TCUresult __stdcall (*TcuStreamDestroy)(PCUstream hStream);
  282. typedef TCUresult __stdcall (*TcuGLCtxCreate)(PCUcontext &pctx, unsigned Flags, TCUdevice device);
  283. typedef TCUresult __stdcall (*TcuGraphicsGLRegisterBuffer)(PCUgraphicsResource &pCudaResource, unsigned buffer, TCUgraphicsMapResourceFlags Flags);
  284. typedef TCUresult __stdcall (*TcuGraphicsGLRegisterImage)(PCUgraphicsResource &pCudaResource, unsigned image, unsigned target, TCUgraphicsMapResourceFlags Flags);
  285. typedef TCUresult __stdcall (*TcuWGLGetDevice)(TCUdevice &pDevice, HGPUNV hGpu);
  286. typedef TCUresult __stdcall (*TcuGraphicsUnregisterResource)(PCUgraphicsResource resource);
  287. typedef TCUresult __stdcall (*TcuGraphicsSubResourceGetMappedArray)(PCUarray &pArray, PCUgraphicsResource resource, unsigned arrayIndex, unsigned mipLevel);
  288. typedef TCUresult __stdcall (*TcuGraphicsResourceGetMappedPointer)(TCUdeviceptr &pDevPtr, /* out */ unsigned &psize, PCUgraphicsResource resource);
  289. typedef TCUresult __stdcall (*TcuGraphicsResourceSetMapFlags)(PCUgraphicsResource resource, unsigned Flags);
  290. typedef TCUresult __stdcall (*TcuGraphicsMapResources)(unsigned count, PPCUgraphicsResource resources, PCUstream hStream);
  291. typedef TCUresult __stdcall (*TcuGraphicsUnmapResources)(unsigned count, PPCUgraphicsResource resources, PCUstream hStream);
  292. typedef void __stdcall (*TcuGLInit)(void);
  293. typedef TCUresult __stdcall (*TcuGLRegisterBufferObject)(unsigned buffer);
  294. typedef TCUresult __stdcall (*TcuGLMapBufferObject)(TCUdeviceptr &dptr, unsigned &size, unsigned buffer);
  295. typedef TCUresult __stdcall (*TcuGLUnmapBufferObject)(unsigned buffer);
  296. typedef TCUresult __stdcall (*TcuGLUnregisterBufferObject)(unsigned buffer);
  297. typedef TCUresult __stdcall (*TcuGLSetBufferObjectMapFlags)(unsigned buffer, unsigned Flags);
  298. typedef TCUresult __stdcall (*TcuGLMapBufferObjectAsync)(TCUdeviceptr &dptr, unsigned &size, unsigned buffer, PCUstream hStream);
  299. typedef TCUresult __stdcall (*TcuGLUnmapBufferObjectAsync)(unsigned buffer, PCUstream hStream);
  300. //-- var, const, procedure ---------------------------------------------------
  301. #define CUDAAPIDLL L"nvcuda.dll"
  302. extern DELPHI_PACKAGE TCUresult CUDA_SUCCESS;
  303. static _DELPHI_CONST System::Int8 CUDA_ERROR_INVALID_VALUE = System::Int8(0x1);
  304. static _DELPHI_CONST System::Int8 CUDA_ERROR_OUT_OF_MEMORY = System::Int8(0x2);
  305. static _DELPHI_CONST System::Int8 CUDA_ERROR_NOT_INITIALIZED = System::Int8(0x3);
  306. static _DELPHI_CONST System::Int8 CUDA_ERROR_DEINITIALIZED = System::Int8(0x4);
  307. static _DELPHI_CONST System::Int8 CUDA_ERROR_NO_DEVICE = System::Int8(0x64);
  308. static _DELPHI_CONST System::Int8 CUDA_ERROR_INVALID_DEVICE = System::Int8(0x65);
  309. static _DELPHI_CONST System::Byte CUDA_ERROR_INVALID_IMAGE = System::Byte(0xc8);
  310. static _DELPHI_CONST System::Byte CUDA_ERROR_INVALID_CONTEXT = System::Byte(0xc9);
  311. static _DELPHI_CONST System::Byte CUDA_ERROR_CONTEXT_ALREADY_CURRENT = System::Byte(0xca);
  312. static _DELPHI_CONST System::Byte CUDA_ERROR_MAP_FAILED = System::Byte(0xcd);
  313. static _DELPHI_CONST System::Byte CUDA_ERROR_UNMAP_FAILED = System::Byte(0xce);
  314. static _DELPHI_CONST System::Byte CUDA_ERROR_ARRAY_IS_MAPPED = System::Byte(0xcf);
  315. static _DELPHI_CONST System::Byte CUDA_ERROR_ALREADY_MAPPED = System::Byte(0xd0);
  316. static _DELPHI_CONST System::Byte CUDA_ERROR_NO_BINARY_FOR_GPU = System::Byte(0xd1);
  317. static _DELPHI_CONST System::Byte CUDA_ERROR_ALREADY_ACQUIRED = System::Byte(0xd2);
  318. static _DELPHI_CONST System::Byte CUDA_ERROR_NOT_MAPPED = System::Byte(0xd3);
  319. static _DELPHI_CONST System::Byte CUDA_ERROR_NOT_MAPPED_AS_ARRAY = System::Byte(0xd4);
  320. static _DELPHI_CONST System::Byte CUDA_ERROR_NOT_MAPPED_AS_POINTER = System::Byte(0xd5);
  321. static _DELPHI_CONST System::Word CUDA_ERROR_INVALID_SOURCE = System::Word(0x12c);
  322. static _DELPHI_CONST System::Word CUDA_ERROR_FILE_NOT_FOUND = System::Word(0x12d);
  323. static _DELPHI_CONST System::Word CUDA_ERROR_INVALID_HANDLE = System::Word(0x190);
  324. static _DELPHI_CONST System::Word CUDA_ERROR_NOT_FOUND = System::Word(0x1f4);
  325. static _DELPHI_CONST System::Word CUDA_ERROR_NOT_READY = System::Word(0x258);
  326. static _DELPHI_CONST System::Word CUDA_ERROR_LAUNCH_FAILED = System::Word(0x2bc);
  327. static _DELPHI_CONST System::Word CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = System::Word(0x2bd);
  328. static _DELPHI_CONST System::Word CUDA_ERROR_LAUNCH_TIMEOUT = System::Word(0x2be);
  329. static _DELPHI_CONST System::Word CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = System::Word(0x2bf);
  330. static _DELPHI_CONST System::Word CUDA_ERROR_POINTER_IS_64BIT = System::Word(0x320);
  331. static _DELPHI_CONST System::Word CUDA_ERROR_SIZE_IS_64BIT = System::Word(0x321);
  332. static _DELPHI_CONST System::Word CUDA_ERROR_UNKNOWN = System::Word(0x3e7);
  333. static _DELPHI_CONST System::Int8 CU_MEMHOSTALLOC_PORTABLE = System::Int8(0x1);
  334. static _DELPHI_CONST System::Int8 CU_MEMHOSTALLOC_DEVICEMAP = System::Int8(0x2);
  335. static _DELPHI_CONST System::Int8 CU_MEMHOSTALLOC_WRITECOMBINED = System::Int8(0x4);
  336. static _DELPHI_CONST System::Int8 CU_TRSA_OVERRIDE_FORMAT = System::Int8(0x1);
  337. static _DELPHI_CONST System::Int8 CU_TRSF_READ_AS_INTEGER = System::Int8(0x1);
  338. static _DELPHI_CONST System::Int8 CU_TRSF_NORMALIZED_COORDINATES = System::Int8(0x2);
  339. static _DELPHI_CONST System::Int8 CU_PARAM_TR_DEFAULT = System::Int8(-1);
  340. extern DELPHI_PACKAGE TcuInit cuInit;
  341. extern DELPHI_PACKAGE TcuDriverGetVersion cuDriverGetVersion;
  342. extern DELPHI_PACKAGE TcuDeviceGet cuDeviceGet;
  343. extern DELPHI_PACKAGE TcuDeviceGetCount cuDeviceGetCount;
  344. extern DELPHI_PACKAGE TcuDeviceGetName cuDeviceGetName;
  345. extern DELPHI_PACKAGE TcuDeviceComputeCapability cuDeviceComputeCapability;
  346. extern DELPHI_PACKAGE TcuDeviceTotalMem cuDeviceTotalMem;
  347. extern DELPHI_PACKAGE TcuDeviceGetProperties cuDeviceGetProperties;
  348. extern DELPHI_PACKAGE TcuDeviceGetAttribute cuDeviceGetAttribute;
  349. extern DELPHI_PACKAGE TcuCtxCreate cuCtxCreate;
  350. extern DELPHI_PACKAGE TcuCtxDestroy cuCtxDestroy;
  351. extern DELPHI_PACKAGE TcuCtxAttach cuCtxAttach;
  352. extern DELPHI_PACKAGE TcuCtxDetach cuCtxDetach;
  353. extern DELPHI_PACKAGE TcuCtxPushCurrent cuCtxPushCurrent;
  354. extern DELPHI_PACKAGE TcuCtxPopCurrent cuCtxPopCurrent;
  355. extern DELPHI_PACKAGE TcuCtxGetDevice cuCtxGetDevice;
  356. extern DELPHI_PACKAGE TcuCtxSynchronize cuCtxSynchronize;
  357. extern DELPHI_PACKAGE TcuModuleLoad cuModuleLoad;
  358. extern DELPHI_PACKAGE TcuModuleLoadData cuModuleLoadData;
  359. extern DELPHI_PACKAGE TcuModuleLoadDataEx cuModuleLoadDataEx;
  360. extern DELPHI_PACKAGE TcuModuleLoadFatBinary cuModuleLoadFatBinary;
  361. extern DELPHI_PACKAGE TcuModuleUnload cuModuleUnload;
  362. extern DELPHI_PACKAGE TcuModuleGetFunction cuModuleGetFunction;
  363. extern DELPHI_PACKAGE TcuModuleGetGlobal cuModuleGetGlobal;
  364. extern DELPHI_PACKAGE TcuModuleGetTexRef cuModuleGetTexRef;
  365. extern DELPHI_PACKAGE TcuMemGetInfo cuMemGetInfo;
  366. extern DELPHI_PACKAGE TcuMemAlloc cuMemAlloc;
  367. extern DELPHI_PACKAGE TcuMemAllocPitch cuMemAllocPitch;
  368. extern DELPHI_PACKAGE TcuMemFree cuMemFree;
  369. extern DELPHI_PACKAGE TcuMemGetAddressRange cuMemGetAddressRange;
  370. extern DELPHI_PACKAGE TcuMemAllocHost cuMemAllocHost;
  371. extern DELPHI_PACKAGE TcuMemFreeHost cuMemFreeHost;
  372. extern DELPHI_PACKAGE TcuMemHostAlloc cuMemHostAlloc;
  373. extern DELPHI_PACKAGE TcuMemHostGetDevicePointer cuMemHostGetDevicePointer;
  374. extern DELPHI_PACKAGE TcuMemHostGetFlags cuMemHostGetFlags;
  375. extern DELPHI_PACKAGE TcuMemcpyHtoD cuMemcpyHtoD;
  376. extern DELPHI_PACKAGE TcuMemcpyDtoH cuMemcpyDtoH;
  377. extern DELPHI_PACKAGE TcuMemcpyDtoD cuMemcpyDtoD;
  378. extern DELPHI_PACKAGE TcuMemcpyDtoDAsync cuMemcpyDtoDAsync;
  379. extern DELPHI_PACKAGE TcuMemcpyDtoA cuMemcpyDtoA;
  380. extern DELPHI_PACKAGE TcuMemcpyAtoD cuMemcpyAtoD;
  381. extern DELPHI_PACKAGE TcuMemcpyHtoA cuMemcpyHtoA;
  382. extern DELPHI_PACKAGE TcuMemcpyAtoH cuMemcpyAtoH;
  383. extern DELPHI_PACKAGE TcuMemcpyAtoA cuMemcpyAtoA;
  384. extern DELPHI_PACKAGE TcuMemcpy2D cuMemcpy2D;
  385. extern DELPHI_PACKAGE TcuMemcpy2DUnaligned cuMemcpy2DUnaligned;
  386. extern DELPHI_PACKAGE TcuMemcpy3D cuMemcpy3D;
  387. extern DELPHI_PACKAGE TcuMemcpyHtoDAsync cuMemcpyHtoDAsync;
  388. extern DELPHI_PACKAGE TcuMemcpyDtoHAsync cuMemcpyDtoHAsync;
  389. extern DELPHI_PACKAGE TcuMemcpyHtoAAsync cuMemcpyHtoAAsync;
  390. extern DELPHI_PACKAGE TcuMemcpyAtoHAsync cuMemcpyAtoHAsync;
  391. extern DELPHI_PACKAGE TcuMemcpy2DAsync cuMemcpy2DAsync;
  392. extern DELPHI_PACKAGE TcuMemcpy3DAsync cuMemcpy3DAsync;
  393. extern DELPHI_PACKAGE TcuMemsetD8 cuMemsetD8;
  394. extern DELPHI_PACKAGE TcuMemsetD16 cuMemsetD16;
  395. extern DELPHI_PACKAGE TcuMemsetD32 cuMemsetD32;
  396. extern DELPHI_PACKAGE TcuMemsetD2D8 cuMemsetD2D8;
  397. extern DELPHI_PACKAGE TcuMemsetD2D16 cuMemsetD2D16;
  398. extern DELPHI_PACKAGE TcuMemsetD2D32 cuMemsetD2D32;
  399. extern DELPHI_PACKAGE TcuFuncSetBlockShape cuFuncSetBlockShape;
  400. extern DELPHI_PACKAGE TcuFuncSetSharedSize cuFuncSetSharedSize;
  401. extern DELPHI_PACKAGE TcuFuncGetAttribute cuFuncGetAttribute;
  402. extern DELPHI_PACKAGE TcuArrayCreate cuArrayCreate;
  403. extern DELPHI_PACKAGE TcuArrayGetDescriptor cuArrayGetDescriptor;
  404. extern DELPHI_PACKAGE TcuArrayDestroy cuArrayDestroy;
  405. extern DELPHI_PACKAGE TcuArray3DCreate cuArray3DCreate;
  406. extern DELPHI_PACKAGE TcuArray3DGetDescriptor cuArray3DGetDescriptor;
  407. extern DELPHI_PACKAGE TcuTexRefCreate cuTexRefCreate;
  408. extern DELPHI_PACKAGE TcuTexRefDestroy cuTexRefDestroy;
  409. extern DELPHI_PACKAGE TcuTexRefSetArray cuTexRefSetArray;
  410. extern DELPHI_PACKAGE TcuTexRefSetAddress cuTexRefSetAddress;
  411. extern DELPHI_PACKAGE TcuTexRefSetAddress2D cuTexRefSetAddress2D;
  412. extern DELPHI_PACKAGE TcuTexRefSetFormat cuTexRefSetFormat;
  413. extern DELPHI_PACKAGE TcuTexRefSetAddressMode cuTexRefSetAddressMode;
  414. extern DELPHI_PACKAGE TcuTexRefSetFilterMode cuTexRefSetFilterMode;
  415. extern DELPHI_PACKAGE TcuTexRefSetFlags cuTexRefSetFlags;
  416. extern DELPHI_PACKAGE TcuTexRefGetAddress cuTexRefGetAddress;
  417. extern DELPHI_PACKAGE TcuTexRefGetArray cuTexRefGetArray;
  418. extern DELPHI_PACKAGE TcuTexRefGetAddressMode cuTexRefGetAddressMode;
  419. extern DELPHI_PACKAGE TcuTexRefGetFilterMode cuTexRefGetFilterMode;
  420. extern DELPHI_PACKAGE TcuTexRefGetFormat cuTexRefGetFormat;
  421. extern DELPHI_PACKAGE TcuTexRefGetFlags cuTexRefGetFlags;
  422. extern DELPHI_PACKAGE TcuParamSetSize cuParamSetSize;
  423. extern DELPHI_PACKAGE TcuParamSeti cuParamSeti;
  424. extern DELPHI_PACKAGE TcuParamSetf cuParamSetf;
  425. extern DELPHI_PACKAGE TcuParamSetv cuParamSetv;
  426. extern DELPHI_PACKAGE TcuParamSetTexRef cuParamSetTexRef;
  427. extern DELPHI_PACKAGE TcuLaunch cuLaunch;
  428. extern DELPHI_PACKAGE TcuLaunchGrid cuLaunchGrid;
  429. extern DELPHI_PACKAGE TcuLaunchGridAsync cuLaunchGridAsync;
  430. extern DELPHI_PACKAGE TcuEventCreate cuEventCreate;
  431. extern DELPHI_PACKAGE TcuEventRecord cuEventRecord;
  432. extern DELPHI_PACKAGE TcuEventQuery cuEventQuery;
  433. extern DELPHI_PACKAGE TcuEventSynchronize cuEventSynchronize;
  434. extern DELPHI_PACKAGE TcuEventDestroy cuEventDestroy;
  435. extern DELPHI_PACKAGE TcuEventElapsedTime cuEventElapsedTime;
  436. extern DELPHI_PACKAGE TcuStreamCreate cuStreamCreate;
  437. extern DELPHI_PACKAGE TcuStreamQuery cuStreamQuery;
  438. extern DELPHI_PACKAGE TcuStreamSynchronize cuStreamSynchronize;
  439. extern DELPHI_PACKAGE TcuStreamDestroy cuStreamDestroy;
  440. extern DELPHI_PACKAGE TcuGLInit cuGLInit;
  441. extern DELPHI_PACKAGE TcuGLCtxCreate cuGLCtxCreate;
  442. extern DELPHI_PACKAGE TcuGraphicsGLRegisterBuffer cuGraphicsGLRegisterBuffer;
  443. extern DELPHI_PACKAGE TcuGraphicsGLRegisterImage cuGraphicsGLRegisterImage;
  444. extern DELPHI_PACKAGE TcuWGLGetDevice cuWGLGetDevice;
  445. extern DELPHI_PACKAGE TcuGraphicsUnregisterResource cuGraphicsUnregisterResource;
  446. extern DELPHI_PACKAGE TcuGraphicsSubResourceGetMappedArray cuGraphicsSubResourceGetMappedArray;
  447. extern DELPHI_PACKAGE TcuGraphicsResourceGetMappedPointer cuGraphicsResourceGetMappedPointer;
  448. extern DELPHI_PACKAGE TcuGraphicsResourceSetMapFlags cuGraphicsResourceSetMapFlags;
  449. extern DELPHI_PACKAGE TcuGraphicsMapResources cuGraphicsMapResources;
  450. extern DELPHI_PACKAGE TcuGraphicsUnmapResources cuGraphicsUnmapResources;
  451. extern DELPHI_PACKAGE TcuGLRegisterBufferObject cuGLRegisterBufferObject;
  452. extern DELPHI_PACKAGE TcuGLMapBufferObject cuGLMapBufferObject;
  453. extern DELPHI_PACKAGE TcuGLUnmapBufferObject cuGLUnmapBufferObject;
  454. extern DELPHI_PACKAGE TcuGLUnregisterBufferObject cuGLUnregisterBufferObject;
  455. extern DELPHI_PACKAGE TcuGLSetBufferObjectMapFlags cuGLSetBufferObjectMapFlags;
  456. extern DELPHI_PACKAGE TcuGLMapBufferObjectAsync cuGLMapBufferObjectAsync;
  457. extern DELPHI_PACKAGE TcuGLUnmapBufferObjectAsync cuGLUnmapBufferObjectAsync;
  458. extern DELPHI_PACKAGE bool __fastcall InitCUDA(void);
  459. extern DELPHI_PACKAGE void __fastcall CloseCUDA(void);
  460. extern DELPHI_PACKAGE bool __fastcall InitCUDAFromLibrary(const System::WideString LibName);
  461. extern DELPHI_PACKAGE bool __fastcall IsCUDAInitialized(void);
  462. extern DELPHI_PACKAGE System::UnicodeString __fastcall Get_CUDA_API_Error_String(TCUresult AError);
  463. } /* namespace Import */
  464. } /* namespace Cuda */
  465. #if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_CUDA_IMPORT)
  466. using namespace Cuda::Import;
  467. #endif
  468. #if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_CUDA)
  469. using namespace Cuda;
  470. #endif
  471. #pragma pack(pop)
  472. #pragma option pop
  473. #pragma delphiheader end.
  474. //-- end unit ----------------------------------------------------------------
  475. #endif // CUDA_ImportHPP