From patchwork Mon Nov 25 21:48:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 294108 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E6A952C00B9 for ; Tue, 26 Nov 2013 08:49:33 +1100 (EST) 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:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=cyO7kzssD7CIKBZbVgYHXS7PvWnWHMCu/2X5MjvOd0BfzdS1hJxlh lmfataPkCTG/5aeAXuS3gIQj+EJD7lvjdTDdKcQ0B+ML76wjz9lMjVeTyAdWMs/S orKCWldMG6CexIXOBy4yh7YSqkCMTwG4MZQwOrmBqvqqwA2epzgZNo= 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:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; s=default; bh=iieUx2kh6Plq+K1kQIS9p4YN/Lo=; b=KdIIPCxJ8i7mDIjqIopgot6q+ORv 3wHe3Aq2HZEJBCilE3MR/6ZMTYMtYz3CHWGBFl7h8n1ZjPi12IeZXz93qKbs3hj8 spWVyuWFPIy4yKnv0JQcqhh4R6QITkepGwOy9j6RC4xJkDz0Eimg+aMY1MOFDrLd +dUVdSFNM1JAxKw= Received: (qmail 17673 invoked by alias); 25 Nov 2013 21:49:21 -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 17654 invoked by uid 89); 25 Nov 2013 21:49:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=AWL, BAYES_50, RDNS_NONE autolearn=no version=3.3.2 X-HELO: mx01.qsc.de Received: from Unknown (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 25 Nov 2013 21:48:24 +0000 Received: from archimedes.net-b.de (port-92-194-51-180.dynamic.qsc.de [92.194.51.180]) by mx01.qsc.de (Postfix) with ESMTP id CCCC1D1F; Mon, 25 Nov 2013 22:48:14 +0100 (CET) Message-ID: <5293C59E.8000302@net-b.de> Date: Mon, 25 Nov 2013 22:48:14 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Sergey Ostanevich CC: Jakub Jelinek , Richard Biener , Richard Henderson , Yuri Rumyantsev , gcc-patches , Igor Zamyatin , Areg Melik-Adamyan Subject: Re: [gomp4 simd, RFC] Simple fix to override vectorization cost estimation. References: <20131119141127.GT892@tucnak.redhat.com> <20131119144220.GU892@tucnak.redhat.com> <528BC6A1.2040206@net-b.de> <20131120141428.GI892@tucnak.redhat.com> <528D0D79.506@net-b.de> In-Reply-To: Sergey, Thanks for the modifications and the patch. I tried your patch using gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c with the following change: The result is with and without "pragma omp simd" in effect is the following for gcc -fdump-tree-vect-details -fopt-info-vec-optimized -c -O2 -ftree-vectorize -fvect-cost-model=dynamic costmodel-vect-31.c and gcc -fdump-tree-vect-details -fopt-info-vec-optimized -c -O2 -ftree-vectorize -fvect-cost-model=dynamic -fsimd-cost-model=default -Wopenmp-simd -fopenmp-simd costmodel-vect-31.c costmodel-vect-31.c:68:3: note: loop vectorized costmodel-vect-31.c:68:3: note: loop peeled for vectorization to enhance alignment costmodel-vect-31.c:55:3: note: loop vectorized costmodel-vect-31.c:42:3: note: loop vectorized Namely, the loop in line 29-32 is not vectorized. But also: -Wopenmp-simd doesn't warn! If one now enables -fsimd-cost-model=unlimited, one gets the loop vectorized: costmodel-vect-31.c:68:3: note: loop vectorized costmodel-vect-31.c:68:3: note: loop peeled for vectorization to enhance alignment costmodel-vect-31.c:55:3: note: loop vectorized costmodel-vect-31.c:42:3: note: loop vectorized costmodel-vect-31.c:31:16: note: loop vectorized costmodel-vect-31.c:31:16: note: loop peeled for vectorization to enhance alignment Thus, can you check why the warning doesn't work? Additionally, I'd find is useful to have a test case for both -Wopenmp-simd and for -fsimd-cost-model=unlimited. Below, a few minor remarks to your patch. [If possibly, try to attach the patch in text format (e.g. Content-Type: text/plain) instead of binary (Content-Type: application/octet-stream) that makes reviewing the patch in the email program a bit easier.] Sergey Ostanevich wrote: > 2013-11-25 sergey.y.ostanevich > > * gcc/c-family/c.opt: Introduced a new openmp-simd warning. > * gcc/fortran/lang.opt: Ditto. > * gcc/common.opt: Introduced a new option -fsimd-cost-model. > * gcc/doc/invoke.texi: Introduced a new openmp-simd warning and > a new -fsimd-cost-model option. > * gcc/tree-vectorizer.h (unlimited_cost_model): Interface updated > to rely on the particular loop info. > * gcc/tree-vect-data-refs.c (vect_peeling_hash_insert): Ditto. > (vect_peeling_hash_choose_best_peeling): Ditto. > (vect_enhance_data_refs_alignment): Ditto. > * gcc/tree-vect-slp.c (vect_slp_analyze_bb_1): Ditto. > * gcc/tree-vect-loop.c (vect_estimate_min_profitable_iters): Ditto > plus added openmp-simd warining. s/warining/warning/ Additionally, recall that gcc/, gcc/c-family and gcc/fortran have their own ChangeLog. Thus, at the end, the path names in those files should be relative to the relevant ChangeLog file ("c.opt", "lang.opt", "common.opt", "doc/invoke.texi" etc.) > +@item -fsimd-cost-model=@var{model} > ... The > +@code{default} model means to reuse model defined by @option{fvect-cost-model}. > +All other values of @var{model} have the same meaning as described in > +@option{fvect-cost-model}. I think it should be "to reuse the model" (with "the") and (twice) "-fvect..." instead of "fvect..." (i.e. with hyphen). > @@ -2936,6 +2936,10 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, > /* vector version will never be profitable. */ > else > { > + if (warn_openmp_simd && LOOP_VINFO_LOOP (loop_vinfo)->force_vect) > + warning_at (vect_location, OPT_Wopenmp_simd, "vectorization " > + "did not happen for a simd loop"); As the example shows, this code is seemingly not reached. Otherwise, the code looks fine to me (although, I cannot approve anything but GCC's Fortran part). Tobias --- a/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c @@ -27,2 +27,3 @@ int main1 () /* unaligned */ +#pragma omp simd for (i = 0; i < N/2; i++)