cuda.memory, cuda.syntax: inline some more words, add cuda-malloc-type word that allocates n*heap-size bytes of memory

db4
Joe Groff 2010-05-04 19:46:53 -07:00
parent 0778923d98
commit 76512260b0
2 changed files with 8 additions and 5 deletions

View File

@ -9,10 +9,13 @@ IN: cuda.memory
: cuda-malloc ( n -- ptr )
[ CUdeviceptr <c-object> ] dip
'[ _ cuMemAlloc cuda-error ] keep
c:*int ;
c:*int ; inline
: cuda-malloc-type ( n type -- ptr )
heap-size * cuda-malloc ; inline
: cuda-free ( ptr -- )
cuMemFree cuda-error ;
cuMemFree cuda-error ; inline
DESTRUCTOR: cuda-free

View File

@ -14,10 +14,10 @@ SYNTAX: CUDA-FUNCTION:
";" scan-c-args drop define-cuda-word ;
: 2<<< ( dim-block dim-grid -- function-launcher )
0 f function-launcher boa ;
0 f function-launcher boa ; inline
: 3<<< ( dim-block dim-grid shared-size -- function-launcher )
f function-launcher boa ;
f function-launcher boa ; inline
: 4<<< ( dim-block dim-grid shared-size stream -- function-launcher )
function-launcher boa ;
function-launcher boa ; inline