From patchwork Tue Nov 12 13:29:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 1193538 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513112-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="h7VJxJqn"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47C7sT4YVXz9sPJ for ; Wed, 13 Nov 2019 00:30:20 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=t2n BhNuilXcpjvPe/6qnEp84AlMQO7phiR6ft58kOFSuyodiM7PS6z046VSFj0Ymz8i tPxg1tv8h2cdMmFrE3CJ8MNWmDa+hf+dYUXpM/hP6pNYrD0KXto0Z2+fcSMIWY4S C8XR0dayJVDujDp0DMCv2VsbJksOobrIPaMuA158= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=default; bh=Lfdg+uFPI b21G0ugImrp8fMO9qA=; b=h7VJxJqnHxWK1/Z7Ku9er8qTbGvQraDXoy1V69o9k sH7gAdkUNdW3xyR6X60OwbynctDfQtffLspReiDjhbdeZ7ueq6c+LdhBcc04q3jB uuxr4WRQ7xJoNcCRd4t1sdjAkKH6tJrHrh7FUvvEEDaViFu6F+SrBTxlMalTtU68 so= Received: (qmail 118983 invoked by alias); 12 Nov 2019 13:29:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 118944 invoked by uid 89); 12 Nov 2019 13:29:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=device, HContent-Transfer-Encoding:8bit X-HELO: esa1.mentor.iphmx.com Received: from esa1.mentor.iphmx.com (HELO esa1.mentor.iphmx.com) (68.232.129.153) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Nov 2019 13:29:39 +0000 IronPort-SDR: gPanZH1XyvUThOsmPVtxOz1NDbKezmZO7aTHTuqYKl52yS8FOaJTmddGYBMPhERHNhZ022mrwi mQOSXAjAUT+XVQSVaWDDKm+d9T4r9n9sBJntellJHax83t9v7xYBdkxtKZZ4dky3R4VboYfTC8 wSsAW0Ay12lTlDrED3+arGd+D1i6rzC7jdPzNKOYR9XFSk2Dlkq7Bdqfem8cPWtrel6NTklnuC PrdHG+Fa14yF/U8RODTA/JdSnz1g268IXBKeDMa/Loy924qqwNw0EJZmdlayb2H+GDFCIM6OEx iFE= Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 12 Nov 2019 05:29:38 -0800 IronPort-SDR: CCO9k9NftS/cFey26EbIxKN1PLlRBhUXjH1tJIhXqWui1ESnJ1etnyKrsJPg/wlzr6uiDvOI+U DXX1tw3CkLqE79XRVix7U0vIKECWodwB11LjCWemgUtDqExaeaSQamKcca8rOgnXkkDXCR/CPN VLxIdWl1hoaBqt9I/ddR+dDWorojnzSQpUTohyxG8pBTQjw71QcHslOiamVtorROOvLdD81cBX lS+6HMP0JCNW2yFwAit6Fxcn3Ei/zYGg6Fqk2XIl4qbDnCDXYrcaL5xyrg9iYfr6aq7+1bdKHD h1A= From: Andrew Stubbs To: Subject: [PATCH 3/7 libgomp, nvptx] Add device number to GOMP_OFFLOAD_openacc_async_construct Date: Tue, 12 Nov 2019 13:29:12 +0000 Message-ID: <10223858482c0dbcfa974b49678648d18a2dafea.1573560401.git.ams@codesourcery.com> In-Reply-To: References: MIME-Version: 1.0 This patch is preparatory for the amdgcn plugin. The current implementation was written for CUDA in which the device associated with the queue is inferred by some hidden magic (which seems questionable to me but then I don't fully understand it). The GCN plugin needs to know for which device the queue is intended, so this simply provides that information to the queue constructor. OK to commit? Thanks Andrew 2019-11-12 Andrew Stubbs libgomp/ * libgomp-plugin.h (GOMP_OFFLOAD_openacc_async_construct): Add int parameter. * oacc-async.c (lookup_goacc_asyncqueue): Pass device number to the queue constructor. * oacc-host.c (host_openacc_async_construct): Add device parameter. * plugin/plugin-nvptx.c (GOMP_OFFLOAD_openacc_async_construct): Add device parameter. --- libgomp/libgomp-plugin.h | 2 +- libgomp/oacc-async.c | 3 ++- libgomp/oacc-host.c | 2 +- libgomp/plugin/plugin-nvptx.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libgomp/libgomp-plugin.h b/libgomp/libgomp-plugin.h index 01483f27f4c..de969e1ba45 100644 --- a/libgomp/libgomp-plugin.h +++ b/libgomp/libgomp-plugin.h @@ -112,7 +112,7 @@ extern void GOMP_OFFLOAD_openacc_exec (void (*) (void *), size_t, void **, void **, unsigned *, void *); extern void *GOMP_OFFLOAD_openacc_create_thread_data (int); extern void GOMP_OFFLOAD_openacc_destroy_thread_data (void *); -extern struct goacc_asyncqueue *GOMP_OFFLOAD_openacc_async_construct (void); +extern struct goacc_asyncqueue *GOMP_OFFLOAD_openacc_async_construct (int); extern bool GOMP_OFFLOAD_openacc_async_destruct (struct goacc_asyncqueue *); extern int GOMP_OFFLOAD_openacc_async_test (struct goacc_asyncqueue *); extern bool GOMP_OFFLOAD_openacc_async_synchronize (struct goacc_asyncqueue *); diff --git a/libgomp/oacc-async.c b/libgomp/oacc-async.c index 1760e8c90c6..2b24ae7adc2 100644 --- a/libgomp/oacc-async.c +++ b/libgomp/oacc-async.c @@ -100,7 +100,8 @@ lookup_goacc_asyncqueue (struct goacc_thread *thr, bool create, int async) if (!dev->openacc.async.asyncqueue[async]) { - dev->openacc.async.asyncqueue[async] = dev->openacc.async.construct_func (); + dev->openacc.async.asyncqueue[async] + = dev->openacc.async.construct_func (dev->target_id); if (!dev->openacc.async.asyncqueue[async]) { diff --git a/libgomp/oacc-host.c b/libgomp/oacc-host.c index 12299aee65d..cbcac9bf7b3 100644 --- a/libgomp/oacc-host.c +++ b/libgomp/oacc-host.c @@ -211,7 +211,7 @@ host_openacc_async_queue_callback (struct goacc_asyncqueue *aq } static struct goacc_asyncqueue * -host_openacc_async_construct (void) +host_openacc_async_construct (int device __attribute__((unused))) { /* Non-NULL 0xffff... value as opaque dummy. */ return (struct goacc_asyncqueue *) -1; diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index 9e088612b44..911d0f66a6e 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -1575,7 +1575,7 @@ GOMP_OFFLOAD_openacc_cuda_set_stream (struct goacc_asyncqueue *aq, void *stream) } struct goacc_asyncqueue * -GOMP_OFFLOAD_openacc_async_construct (void) +GOMP_OFFLOAD_openacc_async_construct (int device __attribute__((unused))) { CUstream stream = NULL; CUDA_CALL_ERET (NULL, cuStreamCreate, &stream, CU_STREAM_DEFAULT);