[Ada] Improve CUDA host-side and device-side binder support

Message ID 20220912081943.GA1513147@poulhies-Precision-5550
State New, archived
Headers
Series [Ada] Improve CUDA host-side and device-side binder support |

Commit Message

Marc Poulhiès Sept. 12, 2022, 8:19 a.m. UTC
  On the host-side, the binder now generates CUDA_Execute pragmas to
invoke initialization and finalization on the device-side. The
front end's expansion of these pragmas includes references to
entities declared in package CUDA.Internal. Generate a with-clause so
that unit will be available.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* bindgen.adb: When the binder is invoked for the host, generate a
	"with CUDA.Internal;" with clause.
  

Patch

diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -2552,6 +2552,9 @@  package body Bindgen is
       if Enable_CUDA_Expansion then
          WBI ("with Interfaces.C;");
          WBI ("with Interfaces.C.Strings;");
+
+         --  with of CUDA.Internal needed for CUDA_Execute pragma expansion
+         WBI ("with CUDA.Internal;");
       end if;
 
       Resolve_Binder_Options (Elab_Order);