cuda.memory, cuda.syntax: inline some more words, add cuda-malloc-type word that allocates n*heap-size bytes of memory
parent
0778923d98
commit
76512260b0
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue