From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110311 invoked by alias); 9 Jun 2016 10:36:24 -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 110302 invoked by uid 89); 9 Jun 2016 10:36:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=200,6, Joined X-HELO: mail-vk0-f67.google.com Received: from mail-vk0-f67.google.com (HELO mail-vk0-f67.google.com) (209.85.213.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 09 Jun 2016 10:36:13 +0000 Received: by mail-vk0-f67.google.com with SMTP id z65so5598436vka.0 for ; Thu, 09 Jun 2016 03:36:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=K9w9E1XQChH65nr/xkN9Ezj+vItj4CL3mOZa+XNwSVE=; b=SDRESP3IlFA+dvGFTWSH/snSTwuhVwUW2ZzU0lU9YtQ4z4/jXEqeXBvfwzO3WufZ44 MEh1rldk+790lpkE9mDuvPXUwPIxz3DiKcBj9gnzhSMMP6FPji0Q5rQN4ldeXW92EwmF iJfy6plFj3A0oyrYfMCrcW7F4EaGR1pPFGoGK4Kr1VUF6DKsZKRltF1rViRU3NaBOy6N FM6kRk6a22waQJKkMz3WQcsiwi3qbhpZjqfeSSKBZVeZtjG5s8T9NH6Bl+KZ0ZwdkXWw zaWK37d8jopK7YvI47DzNPmlgbKLhtXWuSObYDpD8gew6H1k0vgjL7sX4l10NP17EiTU A70Q== X-Gm-Message-State: ALyK8tIaKYO6FippteA6J12XTeie7aMHm595Lpof1Ot0gNdQ1L1bML/JrMc4O9NAd8Tt1uQ+GRq/UEHEvnt5qg== X-Received: by 10.31.85.3 with SMTP id j3mr4405777vkb.156.1465468571009; Thu, 09 Jun 2016 03:36:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.5.201 with HTTP; Thu, 9 Jun 2016 03:36:10 -0700 (PDT) In-Reply-To: References: <20160519193619.GB40563@msticlxl57.ims.intel.com> From: Ilya Enkovich Date: Thu, 09 Jun 2016 10:36:00 -0000 Message-ID: Subject: Re: [PATCH, vec-tails 01/10] New compiler options To: Richard Biener Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00657.txt.bz2 Hi Richard, Do you have some comments on other parts of this series? Thanks, Ilya 2016-05-20 14:40 GMT+03:00 Ilya Enkovich : > 2016-05-20 14:17 GMT+03:00 Richard Biener : >> On Fri, May 20, 2016 at 11:50 AM, Ilya Enkovich wrote: >>> 2016-05-20 12:26 GMT+03:00 Richard Biener : >>>> On Thu, May 19, 2016 at 9:36 PM, Ilya Enkovich wrote: >>>>> Hi, >>>>> >>>>> This patch introduces new options used for loop epilogues vectorization. >>>> >>>> Why's that? This is a bit too much for the casual user and if it is >>>> really necessary >>>> to control this via options then it is not fine-grained enough. >>>> >>>> Why doesn't the vectorizer/backend have enough info to decide this itself? >>> >>> I don't expect casual user to decide which modes to choose. These controls are >>> added for debugging and performance measurement purposes. I see now I miss >>> -ftree-vectorize-epilogues aliased to -ftree-vectorize-epilogues=all. Surely >>> I expect epilogues and short loops vectorization be enabled by default on -O3 >>> or by -ftree-vectorize-loops. >> >> Can you make all these --params then? I think to be useful to users we'd want >> them to be loop pragmas rather than options. > > OK, I'll change it to params. I didn't think about control via > pragmas but will do now. > > Thanks, > Ilya > >> >> Richard. >> >>> Thanks, >>> Ilya >>> >>>> >>>> Richard. >>>> >>>>> Thanks, >>>>> Ilya >>>>> -- >>>>> gcc/ >>>>> >>>>> 2016-05-19 Ilya Enkovich >>>>> >>>>> * common.opt (flag_tree_vectorize_epilogues): New. >>>>> (ftree-vectorize-short-loops): New. >>>>> (ftree-vectorize-epilogues=): New. >>>>> (fno-tree-vectorize-epilogues): New. >>>>> (fvect-epilogue-cost-model=): New. >>>>> * flag-types.h (enum vect_epilogue_mode): New. >>>>> * opts.c (parse_vectorizer_options): New. >>>>> (common_handle_option): Support -ftree-vectorize-epilogues= >>>>> and -fno-tree-vectorize-epilogues options. >>>>> >>>>> >>>>> diff --git a/gcc/common.opt b/gcc/common.opt >>>>> index 682cb41..6b83b79 100644 >>>>> --- a/gcc/common.opt >>>>> +++ b/gcc/common.opt >>>>> @@ -243,6 +243,10 @@ bool dump_base_name_prefixed = false >>>>> Variable >>>>> bool flag_disable_hsa = false >>>>> >>>>> +; Flag holding modes for loop epilogue vectorization >>>>> +Variable >>>>> +unsigned int flag_tree_vectorize_epilogues >>>>> + >>>>> ### >>>>> Driver >>>>> >>>>> @@ -2557,6 +2561,19 @@ ftree-vectorize >>>>> Common Report Var(flag_tree_vectorize) Optimization >>>>> Enable vectorization on trees. >>>>> >>>>> +ftree-vectorize-short-loops >>>>> +Common Report Var(flag_tree_vectorize_short_loops) Optimization >>>>> +Enable vectorization of loops with low trip count using masking. >>>>> + >>>>> +ftree-vectorize-epilogues= >>>>> +Common Report Joined Optimization >>>>> +Comma separated list of loop epilogue vectorization modes. >>>>> +Available modes: combine, mask, nomask. >>>>> + >>>>> +fno-tree-vectorize-epilogues >>>>> +Common RejectNegative Optimization >>>>> +Disable epilogues vectorization. >>>>> + >>>>> ftree-vectorizer-verbose= >>>>> Common Joined RejectNegative Ignore >>>>> Does nothing. Preserved for backward compatibility. >>>>> @@ -2577,6 +2594,10 @@ fsimd-cost-model= >>>>> Common Joined RejectNegative Enum(vect_cost_model) Var(flag_simd_cost_model) Init(VECT_COST_MODEL_UNLIMITED) Optimization >>>>> Specifies the vectorization cost model for code marked with a simd directive. >>>>> >>>>> +fvect-epilogue-cost-model= >>>>> +Common Joined RejectNegative Enum(vect_cost_model) Var(flag_vect_epilogue_cost_model) Init(VECT_COST_MODEL_DEFAULT) Optimization >>>>> +Specifies the cost model for epilogue vectorization. >>>>> + >>>>> Enum >>>>> Name(vect_cost_model) Type(enum vect_cost_model) UnknownError(unknown vectorizer cost model %qs) >>>>> >>>>> diff --git a/gcc/flag-types.h b/gcc/flag-types.h >>>>> index dd57e16..24081b1 100644 >>>>> --- a/gcc/flag-types.h >>>>> +++ b/gcc/flag-types.h >>>>> @@ -200,6 +200,15 @@ enum vect_cost_model { >>>>> VECT_COST_MODEL_DEFAULT = 3 >>>>> }; >>>>> >>>>> +/* Epilogue vectorization modes. */ >>>>> +enum vect_epilogue_mode { >>>>> + VECT_EPILOGUE_COMBINE = 1 << 0, >>>>> + VECT_EPILOGUE_MASK = 1 << 1, >>>>> + VECT_EPILOGUE_NOMASK = 1 << 2, >>>>> + VECT_EPILOGUE_ALL = VECT_EPILOGUE_COMBINE | VECT_EPILOGUE_MASK >>>>> + | VECT_EPILOGUE_NOMASK >>>>> +}; >>>>> + >>>>> /* Different instrumentation modes. */ >>>>> enum sanitize_code { >>>>> /* AddressSanitizer. */ >>>>> diff --git a/gcc/opts.c b/gcc/opts.c >>>>> index 0f9431a..a0c0987 100644 >>>>> --- a/gcc/opts.c >>>>> +++ b/gcc/opts.c >>>>> @@ -1531,6 +1531,63 @@ parse_sanitizer_options (const char *p, location_t loc, int scode, >>>>> return flags; >>>>> } >>>>> >>>>> +/* Parse comma separated vectorizer suboptions from P for option SCODE, >>>>> + adjust previous FLAGS and return new ones. If COMPLAIN is false, >>>>> + don't issue diagnostics. */ >>>>> + >>>>> +unsigned int >>>>> +parse_vectorizer_options (const char *p, location_t loc, int scode, >>>>> + unsigned int flags, int value, bool complain) >>>>> +{ >>>>> + if (scode != OPT_ftree_vectorize_epilogues_) >>>>> + return flags; >>>>> + >>>>> + if (!p) >>>>> + return value; >>>>> + >>>>> + while (*p != 0) >>>>> + { >>>>> + size_t len; >>>>> + const char *comma = strchr (p, ','); >>>>> + unsigned int flag = 0; >>>>> + >>>>> + if (comma == NULL) >>>>> + len = strlen (p); >>>>> + else >>>>> + len = comma - p; >>>>> + if (len == 0) >>>>> + { >>>>> + p = comma + 1; >>>>> + continue; >>>>> + } >>>>> + >>>>> + /* Check to see if the string matches an option class name. */ >>>>> + if (len == strlen ("combine") >>>>> + && memcmp (p, "combine", len) == 0) >>>>> + flag = VECT_EPILOGUE_COMBINE; >>>>> + else if (len == strlen ("mask") >>>>> + && memcmp (p, "mask", len) == 0) >>>>> + flag = VECT_EPILOGUE_MASK; >>>>> + else if (len == strlen ("nomask") >>>>> + && memcmp (p, "nomask", len) == 0) >>>>> + flag = VECT_EPILOGUE_NOMASK; >>>>> + else if (complain) >>>>> + error_at (loc, "unrecognized argument to -ftree-vectorize-epilogues= " >>>>> + "option: %q.*s", (int) len, p); >>>>> + >>>>> + if (value) >>>>> + flags |= flag; >>>>> + else >>>>> + flags &= ~flag; >>>>> + >>>>> + if (comma == NULL) >>>>> + break; >>>>> + p = comma + 1; >>>>> + } >>>>> + >>>>> + return flags; >>>>> +} >>>>> + >>>>> /* Handle target- and language-independent options. Return zero to >>>>> generate an "unknown option" message. Only options that need >>>>> extra handling need to be listed here; if you simply want >>>>> @@ -2018,6 +2075,18 @@ common_handle_option (struct gcc_options *opts, >>>>> if (!opts_set->x_flag_tree_slp_vectorize) >>>>> opts->x_flag_tree_slp_vectorize = value; >>>>> break; >>>>> + >>>>> + case OPT_ftree_vectorize_epilogues_: >>>>> + opts->x_flag_tree_vectorize_epilogues >>>>> + = parse_vectorizer_options (arg, loc, code, >>>>> + opts->x_flag_tree_vectorize_epilogues, >>>>> + value, true); >>>>> + break; >>>>> + >>>>> + case OPT_fno_tree_vectorize_epilogues: >>>>> + opts->x_flag_tree_vectorize_epilogues = 0; >>>>> + break; >>>>> + >>>>> case OPT_fshow_column: >>>>> dc->show_column = value; >>>>> break;