cuda.ffi: add CUDA versions of double, longlong, ulonglong that always 8-byte align, and a >cuda-param-type function we can use to make structs that match kernel param space layout
parent
c588d28acb
commit
8f56108702
|
@ -1,6 +1,6 @@
|
||||||
! (c)2010 Joe Groff bsd license
|
! (c)2010 Joe Groff bsd license
|
||||||
USING: alien alien.c-types alien.libraries alien.syntax
|
USING: accessors alien alien.c-types alien.libraries alien.syntax
|
||||||
classes.struct combinators system ;
|
classes.struct combinators kernel system ;
|
||||||
IN: cuda.ffi
|
IN: cuda.ffi
|
||||||
|
|
||||||
<<
|
<<
|
||||||
|
@ -24,6 +24,28 @@ TYPEDEF: void* CUevent
|
||||||
TYPEDEF: void* CUstream
|
TYPEDEF: void* CUstream
|
||||||
TYPEDEF: void* CUgraphicsResource
|
TYPEDEF: void* CUgraphicsResource
|
||||||
|
|
||||||
|
! versions of double and longlong that always 8-byte align
|
||||||
|
|
||||||
|
SYMBOLS: CUdouble CUlonglong CUulonglong ;
|
||||||
|
|
||||||
|
: >cuda-param-type ( c-type -- c-type' )
|
||||||
|
{
|
||||||
|
{ CUdeviceptr [ void* ] }
|
||||||
|
{ double [ CUdouble ] }
|
||||||
|
{ longlong [ CUlonglong ] }
|
||||||
|
{ ulonglong [ CUulonglong ] }
|
||||||
|
[ ]
|
||||||
|
} case ;
|
||||||
|
|
||||||
|
<<
|
||||||
|
: always-8-byte-align ( c-type -- c-type )
|
||||||
|
8 >>align 8 >>align-first ;
|
||||||
|
|
||||||
|
longlong c-type clone always-8-byte-align \ CUlonglong typedef
|
||||||
|
ulonglong c-type clone always-8-byte-align \ CUulonglong typedef
|
||||||
|
double c-type clone always-8-byte-align \ CUdouble typedef
|
||||||
|
>>
|
||||||
|
|
||||||
STRUCT: CUuuid
|
STRUCT: CUuuid
|
||||||
{ bytes char[16] } ;
|
{ bytes char[16] } ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue