From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3170 invoked by alias); 20 Oct 2015 20:45:58 -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 1970 invoked by uid 89); 20 Oct 2015 20:45:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 20 Oct 2015 20:45:57 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id D77013B3C2; Tue, 20 Oct 2015 20:45:55 +0000 (UTC) Received: from localhost.localdomain (vpn1-4-114.ams2.redhat.com [10.36.4.114]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9KKjs6N018787; Tue, 20 Oct 2015 16:45:54 -0400 Subject: Re: [gomp4 11/14] libgomp: avoid variable-length stack allocation in team.c To: Alexander Monakov , gcc-patches@gcc.gnu.org References: <1445366076-16082-1-git-send-email-amonakov@ispras.ru> <1445366076-16082-12-git-send-email-amonakov@ispras.ru> Cc: Jakub Jelinek , Dmitry Melnik From: Bernd Schmidt Message-ID: <5626A801.3040101@redhat.com> Date: Tue, 20 Oct 2015 20:48:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1445366076-16082-12-git-send-email-amonakov@ispras.ru> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg01962.txt.bz2 On 10/20/2015 08:34 PM, Alexander Monakov wrote: > NVPTX does not support alloca or variable-length stack allocations, thus > heap allocation needs to be used instead. I've opted to make this a generic > change instead of guarding it with an #ifdef: libgomp usually leaves thread > stack size up to libc, so avoiding unbounded stack allocation makes sense. > > * task.c (GOMP_task): Use a fixed-size on-stack buffer or a heap > allocation instead of a variable-size on-stack allocation. > + char buf_fixed[2048], *buf = buf_fixed; This might also not be the best of ideas on a GPU - the stack size isn't all that unlimited, what with there being lots of threads. If I do size_t stack, heap; cuCtxGetLimit (&stack, CU_LIMIT_STACK_SIZE); in the nvptx-run program we've used for testing, it shows a default stack size of just 1kB. Bernd