From patchwork Fri Jan 16 20:34:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 430003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 6D2CF14008F for ; Sat, 17 Jan 2015 07:34:40 +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:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=FbVcHuH0XeEZyhjO ltofN9fp/k5OHDmo9MBsYDQimuZuRJfsxE6b3iXRjqHCdFLDJg/Kb1tAOx42YT0C zio10kYyVRmIw779o7Pe42oDKsusHEokvJF+xIAoy39m9pRlz/Lew620spKLP2+v 49t85tj3kkfl9fuf8swLy4IliVY= 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:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=UrdPeKxQRZFcfPNGCn2Gck hrEGI=; b=g0fPr5Vsx7JTFR2iEHhZxvehTQpEo97cAC7ib2ivyknY/OavnA7Z3Z oKkdIWZnkpxzAEFuXmEvDNoYoHj0dvGxX+k5iingZbPugPahPdLCGAtY8R4iq1es CXVQA0Llc5X1IAPCtC9o57Js5clQqYQAAUSdGa0kYz4S3/QPWHVuI= Received: (qmail 19069 invoked by alias); 16 Jan 2015 20:34:32 -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 19038 invoked by uid 89); 16 Jan 2015 20:34:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 4 recipients X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Jan 2015 20:34:27 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YCDb4-0000Hq-2A from Thomas_Schwinge@mentor.com ; Fri, 16 Jan 2015 12:34:22 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Fri, 16 Jan 2015 20:34:20 +0000 From: Thomas Schwinge To: , CC: , , , , , Subject: [PR libgomp/64625] Remove __OFFLOAD_TABLE__ variable/formal parameter (was: Merge current set of OpenACC changes from gomp-4_0-branch) In-Reply-To: <87egqvu77s.fsf@schwinge.name> References: <87egqvu77s.fsf@schwinge.name> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Fri, 16 Jan 2015 21:34:15 +0100 Message-ID: <87r3uuzcqg.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Thu, 15 Jan 2015 21:20:07 +0100, I wrote: > In r219682, I have committed to trunk our current set of OpenACC changes, Here is a patch to remove the __OFFLOAD_SYMBOL__ variable/formal parameter, as discussed in . But -- I now wonder whether that's actually the issue that has been reported in the PR; doesn't that more look like a problem with the __OFFLOAD_TABLE__ symbol defined in libgcc/offloadstuff.c, and used in the mkoffload tools (such as gcc/config/i386/intelmic-mkoffload.c)? Can anyone guess what's going on? Anyway, as discussed in , I'd like to commit this patch either way, OK? commit 4409d0129118479c1cd1adbcfa96316ac4e734b0 Author: Thomas Schwinge Date: Fri Jan 16 20:12:12 2015 +0100 [PR libgomp/64625] Remove __OFFLOAD_TABLE__ variable/formal parameter. gcc/ * omp-low.c (offload_symbol_decl): Remove variable. (get_offload_symbol_decl): Remove function. (expand_omp_target): For BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA, BUILT_IN_GOMP_TARGET_UPDATE pass NULL instead of &__OFFLOAD_TABLE__, for BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL, BUILT_IN_GOACC_UPDATE don't pass it at all. libgomp/ * libgomp_g.h (GOACC_data_start, GOACC_enter_exit_data) (GOACC_parallel, GOACC_update): Remove const_void *offload_table formal parameter. Update all users. * target.c (GOMP_target, GOMP_target_data, GOMP_target_update): Document unused formal parameter. --- gcc/omp-low.c | 45 ++++++++++++++++++--------------------------- libgomp/libgomp_g.h | 10 +++++----- libgomp/oacc-parallel.c | 8 ++++---- libgomp/target.c | 11 +++++------ 4 files changed, 32 insertions(+), 42 deletions(-) Grüße, Thomas diff --git gcc/omp-low.c gcc/omp-low.c index b7bf338..1589310 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -340,30 +340,6 @@ oacc_max_threads (omp_context *ctx) /* Holds offload tables with decls. */ vec *offload_funcs, *offload_vars; -/* Holds a decl for __OFFLOAD_TABLE__. */ -static GTY(()) tree offload_symbol_decl; - -/* Get the __OFFLOAD_TABLE__ symbol. */ -static tree -get_offload_symbol_decl (void) -{ - if (!offload_symbol_decl) - { - tree decl = build_decl (UNKNOWN_LOCATION, VAR_DECL, - get_identifier ("__OFFLOAD_TABLE__"), - ptr_type_node); - TREE_ADDRESSABLE (decl) = 1; - TREE_PUBLIC (decl) = 1; - DECL_EXTERNAL (decl) = 1; - DECL_WEAK (decl) = 1; - DECL_ATTRIBUTES (decl) - = tree_cons (get_identifier ("weak"), - NULL_TREE, DECL_ATTRIBUTES (decl)); - offload_symbol_decl = decl; - } - return offload_symbol_decl; -} - /* Convenience function for calling scan_omp_1_op on tree operands. */ static inline tree @@ -9119,16 +9095,31 @@ expand_omp_target (struct omp_region *region) } gimple g; - tree offload_table = get_offload_symbol_decl (); vec *args; /* The maximum number used by any start_ix, without varargs. */ - unsigned int argcnt = 12; + unsigned int argcnt = 11; vec_alloc (args, argcnt); args->quick_push (device); if (offloaded) args->quick_push (build_fold_addr_expr (child_fn)); - args->quick_push (build_fold_addr_expr (offload_table)); + switch (start_ix) + { + case BUILT_IN_GOMP_TARGET: + case BUILT_IN_GOMP_TARGET_DATA: + case BUILT_IN_GOMP_TARGET_UPDATE: + /* This const void * is part of the current ABI, but we're not actually + using it. */ + args->quick_push (build_zero_cst (ptr_type_node)); + break; + case BUILT_IN_GOACC_DATA_START: + case BUILT_IN_GOACC_ENTER_EXIT_DATA: + case BUILT_IN_GOACC_PARALLEL: + case BUILT_IN_GOACC_UPDATE: + break; + default: + gcc_unreachable (); + } args->quick_push (t1); args->quick_push (t2); args->quick_push (t3); diff --git libgomp/libgomp_g.h libgomp/libgomp_g.h index c1e4e63..5e88d45 100644 --- libgomp/libgomp_g.h +++ libgomp/libgomp_g.h @@ -217,15 +217,15 @@ extern void GOMP_teams (unsigned int, unsigned int); /* oacc-parallel.c */ -extern void GOACC_data_start (int, const void *, - size_t, void **, size_t *, unsigned short *); +extern void GOACC_data_start (int, size_t, void **, size_t *, + unsigned short *); extern void GOACC_data_end (void); -extern void GOACC_enter_exit_data (int, const void *, size_t, void **, +extern void GOACC_enter_exit_data (int, size_t, void **, size_t *, unsigned short *, int, int, ...); -extern void GOACC_parallel (int, void (*) (void *), const void *, size_t, +extern void GOACC_parallel (int, void (*) (void *), size_t, void **, size_t *, unsigned short *, int, int, int, int, int, ...); -extern void GOACC_update (int, const void *, size_t, void **, size_t *, +extern void GOACC_update (int, size_t, void **, size_t *, unsigned short *, int, int, ...); extern void GOACC_wait (int, int, ...); extern int GOACC_get_num_threads (void); diff --git libgomp/oacc-parallel.c libgomp/oacc-parallel.c index b5e8060..a300742 100644 --- libgomp/oacc-parallel.c +++ libgomp/oacc-parallel.c @@ -75,7 +75,7 @@ select_acc_device (int device_type) static void goacc_wait (int async, int num_waits, va_list ap); void -GOACC_parallel (int device, void (*fn) (void *), const void *offload_table, +GOACC_parallel (int device, void (*fn) (void *), size_t mapnum, void **hostaddrs, size_t *sizes, unsigned short *kinds, int num_gangs, int num_workers, int vector_length, @@ -172,7 +172,7 @@ GOACC_parallel (int device, void (*fn) (void *), const void *offload_table, } void -GOACC_data_start (int device, const void *offload_table, size_t mapnum, +GOACC_data_start (int device, size_t mapnum, void **hostaddrs, size_t *sizes, unsigned short *kinds) { bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK; @@ -218,7 +218,7 @@ GOACC_data_end (void) } void -GOACC_enter_exit_data (int device, const void *offload_table, size_t mapnum, +GOACC_enter_exit_data (int device, size_t mapnum, void **hostaddrs, size_t *sizes, unsigned short *kinds, int async, int num_waits, ...) { @@ -408,7 +408,7 @@ goacc_wait (int async, int num_waits, va_list ap) } void -GOACC_update (int device, const void *offload_table, size_t mapnum, +GOACC_update (int device, size_t mapnum, void **hostaddrs, size_t *sizes, unsigned short *kinds, int async, int num_waits, ...) { diff --git libgomp/target.c libgomp/target.c index 72d64fc..ebff55e 100644 --- libgomp/target.c +++ libgomp/target.c @@ -738,15 +738,14 @@ gomp_fini_device (struct gomp_device_descr *devicep) is GOMP_DEVICE_ICV, it means use device-var ICV. If it is GOMP_DEVICE_HOST_FALLBACK (or any value larger than last available hw device), use host fallback. - FN is address of host code, OFFLOAD_TABLE contains value of the - __OFFLOAD_TABLE__ symbol in the shared library or binary that invokes - GOMP_target. HOSTADDRS, SIZES and KINDS are arrays + FN is address of host code, UNUSED is part of the current ABI, but + we're not actually using it. HOSTADDRS, SIZES and KINDS are arrays with MAPNUM entries, with addresses of the host objects, sizes of the host objects (resp. for pointer kind pointer bias and assumed sizeof (void *) size) and kinds. */ void -GOMP_target (int device, void (*fn) (void *), const void *offload_table, +GOMP_target (int device, void (*fn) (void *), const void *unused, size_t mapnum, void **hostaddrs, size_t *sizes, unsigned char *kinds) { @@ -817,7 +816,7 @@ GOMP_target (int device, void (*fn) (void *), const void *offload_table, } void -GOMP_target_data (int device, const void *offload_table, size_t mapnum, +GOMP_target_data (int device, const void *unused, size_t mapnum, void **hostaddrs, size_t *sizes, unsigned char *kinds) { struct gomp_device_descr *devicep = resolve_device (device); @@ -873,7 +872,7 @@ GOMP_target_end_data (void) } void -GOMP_target_update (int device, const void *offload_table, size_t mapnum, +GOMP_target_update (int device, const void *unused, size_t mapnum, void **hostaddrs, size_t *sizes, unsigned char *kinds) { struct gomp_device_descr *devicep = resolve_device (device);