From patchwork Fri Jun 26 12:39:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 488802 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 EAC8C1402AE for ; Fri, 26 Jun 2015 22:40:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=kXZMp+Wn; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=K54t676sTow2d7vOYEu2L7AkQqQQ46YpxSi9WvxtZf24Wh I3yhT7s6djJs7rStBctJN70vtdO8jCgeH4vZcigdhvTiwghf4tsvsUFPn8wq/JPG XNgnlP5qOd8ANW6rncuCAvWrHdFiXOaglB5NcrDro9OqZJgfwn/1YFKeXGBxU= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=ani5HBDggSrzB+fDOHM+hp9Q7ks=; b=kXZMp+Wnq6c1G2ZTYwl2 YyHFuQ3n1AOwJxMuA8oEuA3XoYGcTR0ZXHWSGydvPivQXAERDxvExyLWU70jrShU BODDBYvYZS0HIRNkGPfYoDUSS1ivFwWlKeDM2Obyb1RuuWg3twc/lhkABaO5f9HY G4y+XEv/YxlRpzWpikInFO4= Received: (qmail 58142 invoked by alias); 26 Jun 2015 12:39:49 -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 58104 invoked by uid 89); 26 Jun 2015 12:39:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-qk0-f172.google.com Received: from mail-qk0-f172.google.com (HELO mail-qk0-f172.google.com) (209.85.220.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 26 Jun 2015 12:39:45 +0000 Received: by qkeo142 with SMTP id o142so54282970qke.1 for ; Fri, 26 Jun 2015 05:39:43 -0700 (PDT) X-Received: by 10.140.239.136 with SMTP id k130mr1923016qhc.90.1435322383235; Fri, 26 Jun 2015 05:39:43 -0700 (PDT) Received: from ?IPv6:2601:19b:400:a983:a2a8:cdff:fe3e:b48? ([2601:19b:400:a983:a2a8:cdff:fe3e:b48]) by mx.google.com with ESMTPSA id q22sm6742138qkq.4.2015.06.26.05.39.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 05:39:42 -0700 (PDT) Message-ID: <558D480D.9050602@acm.org> Date: Fri, 26 Jun 2015 08:39:41 -0400 From: Nathan Sidwell User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: GCC Patches Subject: [gomp4] openacc id builtin I discovered a latent bug in the openacc thread id builtin and associated unspec. They should not be treated as constant functions, because that causes the compiler to consider them constant across threads. Which of course they are not. Applied to gomp4 branch nathan 2015-06-26 Nathan Sidwell * config/nvptx/nvptx.md (UNSPEC_ID): Rename to ... (UNSPECV_ID): ... here. (oacc_id): Make volatile. * omp-builtins.def (BUILT_IN_GOACC_ID): Not a constant function. @@ -2802,3 +2809,8 @@ Copyright (C) 2013-2015 Free Software Fo Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. + +Local Variables: +mode: change-log +change-log-default-name: "ChangeLog.gomp" +End: Index: config/nvptx/nvptx.md =================================================================== --- config/nvptx/nvptx.md (revision 224987) +++ config/nvptx/nvptx.md (working copy) @@ -50,7 +50,6 @@ UNSPEC_ALLOCA UNSPEC_NID - UNSPEC_ID UNSPEC_SHARED_DATA ]) @@ -61,6 +60,7 @@ UNSPECV_XCHG UNSPECV_WARP_BCAST UNSPECV_BARSYNC + UNSPECV_ID ]) (define_attr "subregs_ok" "false,true" @@ -1313,7 +1313,8 @@ (define_insn "oacc_id" [(set (match_operand:SI 0 "nvptx_register_operand" "") - (unspec:SI [(match_operand:SI 1 "const_int_operand" "")] UNSPEC_ID))] + (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "")] + UNSPECV_ID))] "" { static const char *const asms[] = Index: omp-builtins.def =================================================================== --- omp-builtins.def (revision 224987) +++ omp-builtins.def (working copy) @@ -62,7 +62,7 @@ DEF_GOACC_BUILTIN (BUILT_IN_GOACC_WAIT, BT_FN_VOID_INT_INT_VAR, ATTR_NOTHROW_LIST) DEF_GOACC_BUILTIN (BUILT_IN_GOACC_ID, "GOACC_id", - BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST) + BT_FN_UINT_UINT, ATTR_NOTHROW_LEAF_LIST) DEF_GOACC_BUILTIN (BUILT_IN_GOACC_NID, "GOACC_nid", BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_GOACC_BUILTIN (BUILT_IN_GOACC_GET_GANGLOCAL_PTR, "GOACC_get_ganglocal_ptr",