 
 MACRO: cuda-arguments ( c-types -- quot: ( args... function -- ) )
     [ 0 ] dip [ cuda-argument-setter ] map reverse
-    swap '[ _ param-size* ] suffix
+    swap '[ _ param-size ] suffix
     '[ _ cleave ] ;
 
-: get-function-ptr* ( module string -- function )
+: get-function-ptr ( module string -- function )
     [ CUfunction <c-object> ] 2dip
     [ cuModuleGetFunction cuda-error ] 3keep 2drop c:*void* ;
-
-: get-function-ptr ( string -- function )
-    [ cuda-module get ] dip get-function-ptr* ;
 
 : cached-module ( module-name -- alien )
     lookup-cuda-library

: unload-cuda-library ( name -- )
    remove-cuda-library handle>> unload-module ;

: launch-function* ( function -- ) cuLaunch cuda-error ; inline

: launch-function ( -- ) cuda-function get cuLaunch cuda-error ; inline

: run-grid ( grid function -- )
    swap
    {
        [ dim-block>> block-dim function-block-shape* ]
        [ shared-size>> function-shared-size* ]
        [
            dim-grid>>
            [ grid-dim launch-function-grid* ]
            [ launch-function* ] if*
        ]
    } 2cleave ;



: c-type>cuda-setter ( c-type -- n cuda-type )
    {
        { [ dup c:int = ] [ drop 4 [ cuda-int ] ] }
        { [ dup c:uint = ] [ drop 4 [ cuda-int ] ] }
        { [ dup c:float = ] [ drop 4 [ cuda-float ] ] }
        { [ dup c:pointer? ] [ drop 4 [ cuda-int ] ] }
        { [ dup c:void* = ] [ drop 4 [ cuda-int ] ] }
    } cond ;

<PRIVATE
