[Ada] Fix new CUDA kernel registration scheme
authorGhjuvan Lacambre <lacambre@adacore.com>
Tue, 19 Apr 2022 08:01:49 +0000 (10:01 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 30 May 2022 08:29:00 +0000 (08:29 +0000)
commit96b2e170668673d417e9fabac041027614507eaa
treecaaa249e9c627dc6e6410f2b8250c95a94dc699f
parentb4e04a78bbdd39021c1d643af309a24e48623796
[Ada] Fix new CUDA kernel registration scheme

Removal of the previous kernel registration scheme unearthed mistakes in
the new one, which were:
- The new kernel registration code relied on the binder expansion phase,
  which didn't happen because the registration code was already
  generated by the binder.
- The kernel handle passed to CUDA_Register_Function was the first eight
  bytes of the code of the host-side procedure representing the kernel
  rather than its address.

gcc/ada/

* bindgen.adb (Gen_CUDA_Init): Remove code generating CUDA
definitions.
(Gen_CUDA_Defs): New function, generating definitions
initialized by Gen_CUDA_Init.
(Gen_Output_File_Ada): Call Gen_CUDA_Defs instead of
Gen_CUDA_Init.
(Gen_Adainit): Call Gen_CUDA_Init.
gcc/ada/bindgen.adb