aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/opt.ads
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2022-09-02 11:31:26 -0700
committerMarc Poulhiès <poulhies@adacore.com>2022-09-12 10:16:52 +0200
commitca90143868968cc364ba9d1aeff851ca4429b58a (patch)
tree9f7b727500af257bd76a36c68b816db6fa69a375 /gcc/ada/opt.ads
parentca4b9801e2b83cf22ba87ba2b30e450cbb0b6150 (diff)
downloadgcc-ca90143868968cc364ba9d1aeff851ca4429b58a.zip
gcc-ca90143868968cc364ba9d1aeff851ca4429b58a.tar.gz
gcc-ca90143868968cc364ba9d1aeff851ca4429b58a.tar.bz2
[Ada] Improve CUDA host-side and device-side binder support
Use switches (one already existing, one newly added here) to indicate to the binder that CUDA support code is to be generated for either the host side or for the device side. Add an invocation of Adainit on the device side from Adainit on the host side; similarly for Adafinal. gcc/ada/ * bindgen.adb: When the binder is invoked for the host, it declares imported subprograms corresponding to the Adainit and Adafinal routines on the device. Declare string constants and expression functions for the Ada source names and the link names of these routines. Generate these subprogram declarations (and accompanying Import pragmas) in Gen_CUDA_Defs. Generate CUDA_Execute pragmas to call these subprograms from the host in Gen_Adafinal and Gen_CUDA_Init. When the binder is invoked for the device, include a CUDA_Global aspect declaration in the declarations of Adainit and Adafinal and use the aforementioned link names in the Export pragmas generated for those two routines. * debug.adb: Update comments about "d_c" and "d_d" switches. * opt.ads: Declare new Boolean variable, Enable_CUDA_Device_Expansion. This complements the existing Enable_CUDA_Expansion variable, which is used to enable host-side CUDA expansion. The new variable enables device-side CUDA expansion. It is currently never set during compilation; it is only set via a binder switch. * switch-b.adb (scan_debug_switches): Add new use of the "-d_d" binder switch. The new switch and the variable Opt.Enabled_CUDA_Device_Expansion follow the existing pattern of the "-d_c" switch and the variable Opt.Enabled_CUDA_Expansion. Flag error if both "-d_c" and "-d_d" are specified.
Diffstat (limited to 'gcc/ada/opt.ads')
-rw-r--r--gcc/ada/opt.ads7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 19a8b41..8f903ca 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -544,6 +544,13 @@ package Opt is
-- Set to True to enable CUDA host expansion:
-- - Removal of CUDA_Global and CUDA_Device symbols
-- - Generation of kernel registration code in packages
+ -- - Binder invokes device elaboration/finalization code
+
+ Enable_CUDA_Device_Expansion : Boolean := False;
+ -- GNATBIND
+ -- Set to True to enable CUDA device (as opposed to host) expansion:
+ -- - Binder generates elaboration/finalization code that can be
+ -- invoked from corresponding binder-generated host-side code.
Error_Msg_Line_Length : Nat := 0;
-- GNAT