This PR changes how signatures of kernel and host functions are defined:
The Truffle's NFI syntax pointer, pointer, sint32' is replaced with the new syntax 'my_kernel(in_arr: in pointer sint32, out_arr: out pointer foat, num_elements: sint32). This syntax is called NIDL and stands for Native Interface Definitional Language. The two key features of this new syntax are typed pointers, e.g., pointer sint32' rather than justpointer', and directional pointers. The directional attributes in, out, and inout specify whether a device array passed via pointer argument is read, written, or both by the function. This makes optimization of memory management and the concurrent execution possible in the future.
A new grCUDA function bindall() allows binding of multiple kernel or host functions from PTX/cubin files or shared libraries at once using a NIDL specification stored in a .nidl file. The functions are registered into the grCUDA namespace.
Support for C++ kernel and host functions with name mangling. NIDL specification can refer to C++ functions (kernel and free host functions). grCUDA performs the C++ mangling of names to symbols. For example, instead of specifying the symbol as _ZN2aa2bb2cc3fooEPKiPfi (NFI), the NIDL specification is aa::bb::cc::foo(in_arr: in pointer sint32, out_arr: out pointer float, num_elements: sint32). grCUDA also supports C++ namespaces.
Additional feature:
Added free() method to DeviceArray and MultiDimDeviceArray, which allows explicitly freeing the off-heap, CUDA-managed memory that underlies the device arrays. Once the memory is freed, the device array objects enters a defunct state in which each element access throws an exception. This PR implements proposed solution suggested in issue #33.
This PR also cleans up the Markdown documentation.
This PR changes how signatures of kernel and host functions are defined:
The Truffle's NFI syntax
pointer, pointer, sint32' is replaced with the new syntax 'my_kernel(in_arr: in pointer sint32, out_arr: out pointer foat, num_elements: sint32)
. This syntax is called NIDL and stands for Native Interface Definitional Language. The two key features of this new syntax are typed pointers, e.g.,pointer sint32' rather than just
pointer', and directional pointers. The directional attributesin
,out
, andinout
specify whether a device array passed via pointer argument is read, written, or both by the function. This makes optimization of memory management and the concurrent execution possible in the future.A new grCUDA function
bindall()
allows binding of multiple kernel or host functions from PTX/cubin files or shared libraries at once using a NIDL specification stored in a.nidl
file. The functions are registered into the grCUDA namespace.Support for C++ kernel and host functions with name mangling. NIDL specification can refer to C++ functions (kernel and free host functions). grCUDA performs the C++ mangling of names to symbols. For example, instead of specifying the symbol as
_ZN2aa2bb2cc3fooEPKiPfi
(NFI), the NIDL specification isaa::bb::cc::foo(in_arr: in pointer sint32, out_arr: out pointer float, num_elements: sint32)
. grCUDA also supports C++ namespaces.Additional feature:
free()
method toDeviceArray
andMultiDimDeviceArray
, which allows explicitly freeing the off-heap, CUDA-managed memory that underlies the device arrays. Once the memory is freed, the device array objects enters a defunct state in which each element access throws an exception. This PR implements proposed solution suggested in issue #33.This PR also cleans up the Markdown documentation.