ada: Generate host-side CUDA_Register_Function calls for device's adainit/adafinal
authorSteve Baird <baird@adacore.com>
Tue, 4 Oct 2022 21:42:56 +0000 (14:42 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 4 Nov 2022 13:47:22 +0000 (14:47 +0100)
commit8080a1b64ae6030bb85ce88486dc2447d3063b09
treede7e873f6142c7f7409a71a45eee21f87592d41d
parent164cc7a501cfc3239f2146443c1ba486e773349c
ada: Generate host-side CUDA_Register_Function calls for device's adainit/adafinal

To invoke a device-side subprogram from the host (via a CUDA_execute pragma),
the subprogram also has to be registered by calling CUDA_Register_Function.
The host-side adainit and adafinal procedures need to invoke the corresponding
device-side procedures, so corresponding CUDA_Register_Function calls need
to be generated.

gcc/ada/

* bindgen.adb
(Gen_CUDA_Init): Move existing loop body into a new local
procedure, Gen_CUDA_Register_Function_Call, and replace that loop
body with a call to this procedure. This first part is just
semantics-preserving refactoring. The second part is to add
Gen_CUDA_Register_Function_Call calls after the loop for the
device-side adainit and adafinal procedures.
gcc/ada/bindgen.adb