From patchwork Fri Feb 26 15:57:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 589155 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 361CF1402D6 for ; Sat, 27 Feb 2016 02:57:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=kIYmuJRL; 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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=MIW/c6F0SmiLjDRSHpgvgbIar5+Wam0gvdkODFmDUYGSl4TXsRUS9 5PI0QvLzHmXkLzBZz9ZBR4FsUjBb6QquzKzyhgLuWPXb1nC0drCMhDr6+Itj7Y6D OPg9wlMWuIbCWFtRpu8tdBWGNx5qudXohDC/b7zJKPvvfJ0HYlBwe0= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=3NtyuwYXJvoT8SbGGwksl2WVpHg=; b=kIYmuJRLHBpJ4lk1Co3x sDNKpF0hSiwUqSIT4Fdg1aG3FcxBwVwnM/PCrAE9Qak9Zw3h1L4vUMpCJJSgDrGj WvmtkCAGhdHp7sPQucNNJXFXwdL33dDQq3NyrSb+SPC35O9A5xM57CD5drXIZxGF dvEtnR5ETTBSDYLCmBYy6O8= Received: (qmail 115128 invoked by alias); 26 Feb 2016 15:57: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 115004 invoked by uid 89); 26 Feb 2016 15:57:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=gimple_location, Fail X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 26 Feb 2016 15:57:36 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2FC4EAD10 for ; Fri, 26 Feb 2016 15:57:33 +0000 (UTC) Date: Fri, 26 Feb 2016 16:57:33 +0100 From: Martin Jambor To: GCC Patches Subject: [hsa] Fail in presence of atomic operations in private segment Message-ID: <20160226155733.GC3094@virgil.suse.cz> Mail-Followup-To: GCC Patches MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi, the HSA does not allow atomic instructions operating on the private segment because they are quite pointless. In the long term, we should put addressable local variables in the global memory somewhere (I'm going to look at the nvidia stack effort soon). But for now we need to fail in the compiler, because otherwise there is testcase in the libgomp testsuite that complains about the finalizer errors in the output of the execute test. Bootstrapped and tested, I'll commit it to trunk shortly. Thanks, Martin 2016-02-17 Martin Jambor * hsa-gen.c (gen_hsa_ternary_atomic_for_builtin): Fail in presence of atomic operations in private segment. --- gcc/hsa-gen.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index 28e8b6f..717e755 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -4557,8 +4557,13 @@ gen_hsa_ternary_atomic_for_builtin (bool ret_orig, hsa_op_address *addr; addr = get_address_from_value (gimple_call_arg (stmt, 0), hbb); - /* TODO: Warn if addr has private segment, because the finalizer will not - accept that (and it does not make much sense). */ + if (addr->m_symbol && addr->m_symbol->m_segment == BRIG_SEGMENT_PRIVATE) + { + HSA_SORRY_AT (gimple_location (stmt), + "HSA does not implement atomic operations in private " + "segment"); + return; + } hsa_op_base *op = hsa_reg_or_immed_for_gimple_op (gimple_call_arg (stmt, 1), hbb);