From patchwork Mon Sep 12 08:19:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1781545wrt; Mon, 12 Sep 2022 01:31:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR5glfRstqkuGHiGwunxUAaO9UACtHLrcieHAZgXgAat6wuZhaYKy68EbmYSPrgjZ52f0Fig X-Received: by 2002:a17:906:ee8e:b0:730:4a24:f311 with SMTP id wt14-20020a170906ee8e00b007304a24f311mr18072283ejb.420.1662971473549; Mon, 12 Sep 2022 01:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662971473; cv=none; d=google.com; s=arc-20160816; b=pv3+TDnj70tz8XPTb5Jmama952rJDJ4izGkb8njsi80ZrUUS9My4YD03KJFcJmMI6i ihBCMCzYxGjx3pNmrAVvFDe1O0Yzp51LMW5N/7DJcxXB2T7JX079yAeEcPdk4ru02sYT CzkrknB+mDwkwOxAkguaN3dTOLv2e7m4ev/wtOXlDLcjWXApu7MPo9sVBpyvGAkmWB96 CoZnl44idF2ryvqGKVXuBmmMGetJMIQikQxv9SKnEj4gYy12T7nfXdsn0ttNYKMCU3t6 TAqhS/nXy1EoSkWtYsnxmlPI8Jo3vRkq8L1Tkwg6R0zvsw+c2fyN8gUDeU4f9fOBjKqM OdQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=ExNfc8crnPWDcab3UrcNXBjtTXp/lkueN7ze1I47ssA=; b=nqW+dPRssQL2LjS1bS5Dw3+Qy5vsGt0gGKwUKwAsCQb+AcLtHFpxNlvG3oK5XUhodh hJdV6tNzZ2OmzKwKz1Ncky7YhMWfgpnMupSZ7NKasu0ZxPrqn9RfmoPSa5P+szE34sqJ +7321rZNfK8Zfdw4EY13QF9+IgKveBlP01uQkgJQK2d4Fx3l3YkRrMMQm2PCAQbvWNRG n6zl47Mp4uS5huTjYoSVME8Q+bEMWDgatof7T/6e7KuG3usKAiLZ6W34yxCN1w0d8Ljw vLzplZ5VkHN61fHE2l8nvN1bueLXvCoA9Yfi9IbPj9+YCknX/5iVV2XtAZfA8c0+8E98 jEfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ICOfJ90n; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ne38-20020a1709077ba600b00722ebccb11asi2476ejc.101.2022.09.12.01.31.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:31:13 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ICOfJ90n; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B61083839DF4 for ; Mon, 12 Sep 2022 08:24:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B61083839DF4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662971082; bh=ExNfc8crnPWDcab3UrcNXBjtTXp/lkueN7ze1I47ssA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ICOfJ90n773Tk9H0TdNc1vnS94zHdiqc+GT0kCfAmtftgm+d+xKT0d7lQbaKFYRYN /xQt6mfNMBOzOU5qFH3E7YHJhOlfiDGDlfFBgEQDLdk82UE2A//Hmagdvp3DR+09zt hvZMmBFm0scxjhyNFFE+asHJjjIa271HkJhl5+VU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 152B538515FF for ; Mon, 12 Sep 2022 08:19:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 152B538515FF Received: by mail-wr1-x433.google.com with SMTP id k9so14123855wri.0 for ; Mon, 12 Sep 2022 01:19:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=ExNfc8crnPWDcab3UrcNXBjtTXp/lkueN7ze1I47ssA=; b=19kdOHdPVYpahAkKOdkjayUlKzbnDh6PJH+zszo9TYuoLplrYOfAlbUPvLW4i/Anne hEPJMtj+pQTJeOaFTzOd7aKJDJXYAYhBgq3bUac/udX330SEwh5BtLika3Ci6+u/hciG YiG0oICRHKsO2u9iQkyQeZmfA5w3LI7rIniiBGi7NJYqBOJAAS6MrQgQLtgKuYICNiCh m2TDIFtqUmyQ0iPB5S89JtnFCkJpYI0SzXDrtX/4KZwRit1SE5glmq1f5pIurn6DMeDl kpN3aMKIKhFnBy4suWVY2utUTpjYIhPA49gxlb2duzGiEpD3YvL7zaHAuISI9ZHZn+CF XOdg== X-Gm-Message-State: ACgBeo1oMGlTSF2keeJpl9PQ6IKWjnJzSR/m1B/dzRf5woAhHXhNa0pV MITuDaqs2nxcfCilYkiHl+LRoBF1J3ic5w== X-Received: by 2002:adf:d22f:0:b0:228:75b0:90c9 with SMTP id k15-20020adfd22f000000b0022875b090c9mr14140662wrh.490.1662970785001; Mon, 12 Sep 2022 01:19:45 -0700 (PDT) Received: from poulhies-Precision-5550 (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id o22-20020a05600c511600b003a5b6086381sm9138924wms.48.2022.09.12.01.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:19:44 -0700 (PDT) Date: Mon, 12 Sep 2022 10:19:43 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Improve CUDA host-side and device-side binder support Message-ID: <20220912081943.GA1513147@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= Cc: Steve Baird Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743751975971209597?= X-GMAIL-MSGID: =?utf-8?q?1743751975971209597?= 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. 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);