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

release
Joe Groff 2010-04-15 14:46:13 -07:00
parent c588d28acb
commit 8f56108702
1 changed files with 24 additions and 2 deletions

View File

@ -1,6 +1,6 @@
! (c)2010 Joe Groff bsd license
USING: alien alien.c-types alien.libraries alien.syntax
classes.struct combinators system ;
USING: accessors alien alien.c-types alien.libraries alien.syntax
classes.struct combinators kernel system ;
IN: cuda.ffi
<<
@ -24,6 +24,28 @@ TYPEDEF: void* CUevent
TYPEDEF: void* CUstream
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
{ bytes char[16] } ;