]> gitweb.factorcode.org Git - factor.git/commitdiff
cuda: fix ffi, it's size_t (32bit on win32, 64bit on win64)
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 7 Apr 2023 18:43:19 +0000 (13:43 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 7 Apr 2023 18:43:19 +0000 (13:43 -0500)
cuDeviceTotalMem_v2 can't get vram sizes above 4GB
probably need to use directx apis to get real vram on win32

extra/cuda/devices/devices.factor
extra/cuda/ffi/ffi.factor

index 4993cee2ef511c6c3786febbec96602d2d649051..9a2212aaea0c940616a758baf1bb4f9784d3258f 100644 (file)
@@ -35,9 +35,8 @@ IN: cuda.devices
     '[ _ cuDeviceComputeCapability cuda-error ] with-out-parameters
     2array ;
 
-: cuda-device-memory ( n -- bytes )
-    [ { ulonglong } ] dip
-    '[ _ cuDeviceTotalMem_v2 cuda-error ] with-out-parameters ;
+: cuda-device-memory ( n -- memory )
+    [ 0 size_t <ref> ] dip [ cuDeviceTotalMem_v2 cuda-error ] keepd size_t deref ;
 
 : cuda-device-attribute ( attribute n -- n )
     [ { int } ] 2dip
index fe074daf4ba047378c9e21fb4fb46659631a83a3..d9e4d92cc2c8149da05d5482927bdd0e16bddcc8 100644 (file)
@@ -309,7 +309,7 @@ FUNCTION: CUresult cuDeviceGetCount ( int* count )
 FUNCTION: CUresult cuDeviceGetName ( char* name, int len, CUdevice dev )
 FUNCTION: CUresult cuDeviceComputeCapability ( int* major, int* minor, CUdevice dev )
 FUNCTION: CUresult cuDeviceTotalMem ( uint* bytes, CUdevice dev )
-FUNCTION: CUresult cuDeviceTotalMem_v2 ( ulonglong* bytes, CUdevice dev )
+FUNCTION: CUresult cuDeviceTotalMem_v2 ( size_t* bytes, CUdevice dev )
 FUNCTION: CUresult cuDeviceGetProperties ( CUdevprop* prop, CUdevice dev )
 FUNCTION: CUresult cuDeviceGetAttribute ( int* pi, CUdevice_attribute attrib, CUdevice dev )
 
@@ -331,7 +331,7 @@ FUNCTION: CUresult cuModuleGetFunction ( CUfunction* hfunc, CUmodule hmod, c-str
 FUNCTION: CUresult cuModuleGetGlobal ( CUdeviceptr* dptr, uint* bytes, CUmodule hmod, char* name )
 FUNCTION: CUresult cuModuleGetTexRef ( CUtexref* pTexRef, CUmodule hmod, char* name )
 
-FUNCTION: CUresult cuMemGetInfo ( uint* free, uint* total )
+FUNCTION: CUresult cuMemGetInfo ( size_t* free, size_t* total )
 
 FUNCTION: CUresult cuMemAlloc ( CUdeviceptr* dptr, uint bytesize )
 FUNCTION: CUresult cuMemAllocPitch ( CUdeviceptr* dptr,