From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118016 invoked by alias); 21 Oct 2015 14:40:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 117995 invoked by uid 89); 21 Oct 2015 14:40:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: smtp.ispras.ru Received: from smtp.ispras.ru (HELO smtp.ispras.ru) (83.149.199.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Oct 2015 14:40:27 +0000 Received: from [10.10.3.121] (unknown [83.149.199.91]) by smtp.ispras.ru (Postfix) with ESMTP id 263FB20503; Wed, 21 Oct 2015 17:40:24 +0300 (MSK) Date: Wed, 21 Oct 2015 14:41:00 -0000 From: Alexander Monakov To: Jakub Jelinek cc: gcc-patches@gcc.gnu.org, Dmitry Melnik Subject: Re: [gomp4 10/14] libgomp: arrange a team of pre-started threads via gomp_nvptx_main In-Reply-To: <20151021094314.GQ478@tucnak.redhat.com> Message-ID: References: <1445366076-16082-1-git-send-email-amonakov@ispras.ru> <1445366076-16082-11-git-send-email-amonakov@ispras.ru> <20151021094314.GQ478@tucnak.redhat.com> User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2015-10/txt/msg02085.txt.bz2 On Wed, 21 Oct 2015, Jakub Jelinek wrote: > > -#if defined HAVE_TLS || defined USE_EMUTLS > > +#if defined __nvptx__ > > +extern struct gomp_thread *nvptx_thrs; > > What kind of address space is this variable? It should be > a per-CTA var, so that different teams have different, and > simultaneous target regions have different too. As written it's in global accelerator memory. Indeed it's broken with simultaneous target regions, and to unbreak that I'd like to place it in shared memory (but that would require expanding address-space support a bit more, exposing shared-memory space to C source code). > I'm surprised that for team.c you chose to adjust the shared source, > rather than copy and remove all the cruft you don't need/want. > > That includes the LIBGOMP_USE_PTHREADS guarded parts, all the thread binding > stuff etc. I'd like to see at least for comparison how much actually > remained in there. Diffstat for the copy/remove patch is 66+/474-, almost all of removed 470 lines are in gomp_team_start, which counts only ~150 lines after removals. > > @@ -88,7 +138,8 @@ gomp_thread_start (void *xdata) > > thr->task = data->task; > > thr->place = data->place; > > > > - thr->ts.team->ordered_release[thr->ts.team_id] = &thr->release; > > + if (thr->ts.team) > > + thr->ts.team->ordered_release[thr->ts.team_id] = &thr->release; > > Why this? Lots of gomp_thread_start other places assume thr->ts.team is > non-NULL. And, this isn't even guarded with __nvptx__, we don't want > to slow down host thread start. thr->ts.team is NULL when entering from gomp_nvptx_main, and should be setup by master thread from gomp_team_start while we are waiting on first threads_dock barrier in gomp_thread_start (currently I don't expect data->nested to be true on nvptx). Should I drop the "if" and instead simply guard the statement with #ifndef __nvptx__? Thanks. Alexander