public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Steve Baird <baird@adacore.com>
Subject: [COMMITED] ada: Improve CUDA host-side and device-side binder support
Date: Mon, 26 Sep 2022 11:15:22 +0200	[thread overview]
Message-ID: <20220926091522.273508-1-poulhies@adacore.com> (raw)

From: Steve Baird <baird@adacore.com>

Binder-generated code is not allowed to use Ada2012 syntax. In order to
specify an aspect, a pragma must be used.

gcc/ada/

	* bindgen.adb: When the binder is invoked for the device, specify
	the CUDA_Global aspect for the adainit and adafinal procedures via
	a pragma instead of via an aspect_specification.
---
 gcc/ada/bindgen.adb | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index b2fa44d2dff..f2aaa2dea92 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -134,9 +134,6 @@ package body Bindgen is
    --  Text for aspect specifications (if any) given as part of the
    --  Adainit and Adafinal spec declarations.
 
-   function Aspect_Text return String is
-     (if Enable_CUDA_Device_Expansion then " with CUDA_Global" else "");
-
    ----------------------------------
    -- Interface_State Pragma Table --
    ----------------------------------
@@ -2644,10 +2641,11 @@ package body Bindgen is
       end if;
 
       WBI ("");
-      WBI ("   procedure " & Ada_Init_Name.all & Aspect_Text & ";");
+      WBI ("   procedure " & Ada_Init_Name.all & ";");
       if Enable_CUDA_Device_Expansion then
          WBI ("   pragma Export (C, " & Ada_Init_Name.all &
                 ", Link_Name => """ & Device_Ada_Init_Link_Name & """);");
+         WBI ("   pragma CUDA_Global (" & Ada_Init_Name.all & ");");
       else
          WBI ("   pragma Export (C, " & Ada_Init_Name.all & ", """ &
               Ada_Init_Name.all & """);");
@@ -2662,11 +2660,12 @@ package body Bindgen is
 
       if not Cumulative_Restrictions.Set (No_Finalization) then
          WBI ("");
-         WBI ("   procedure " & Ada_Final_Name.all & Aspect_Text & ";");
+         WBI ("   procedure " & Ada_Final_Name.all & ";");
 
          if Enable_CUDA_Device_Expansion then
             WBI ("   pragma Export (C, " & Ada_Final_Name.all &
                    ", Link_Name => """ & Device_Ada_Final_Link_Name & """);");
+            WBI ("   pragma CUDA_Global (" & Ada_Final_Name.all & ");");
          else
             WBI ("   pragma Export (C, " & Ada_Final_Name.all & ", """ &
                  Ada_Final_Name.all & """);");
-- 
2.25.1


                 reply	other threads:[~2022-09-26  9:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220926091522.273508-1-poulhies@adacore.com \
    --to=poulhies@adacore.com \
    --cc=baird@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).