public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Cesar Philippidis <cesar_philippidis@mentor.com>
To: Jakub Jelinek <jakub@redhat.com>,
	Thomas Schwinge	<thomas@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: Re: OpenACC middle end changes
Date: Thu, 13 Nov 2014 19:09:00 -0000	[thread overview]
Message-ID: <54650093.1070109@mentor.com> (raw)
In-Reply-To: <20141113180949.GX5026@tucnak.redhat.com>

I'll try to respond to the reduction stuff. It's been a while since I
started working on it, so I may have lost some state.

On 11/13/2014 10:09 AM, Jakub Jelinek wrote:

>> @@ -233,6 +242,90 @@ static tree scan_omp_1_op (tree *, int *, void *);
>>        *handled_ops_p = false; \
>>        break;
>>  
>> +/* Helper function to get the reduction array name */
>> +static const char *
>> +omp_get_id (tree node)
> 
> Be more specific in the function name what it is for?

It's the name of the array containing the partial reductions for
original reduction variable.

>> +{
>> +  const char *id = IDENTIFIER_POINTER (DECL_NAME (node));
>> +  int len = strlen ("omp$") + strlen (id);
>> +  char *temp_name = (char *)alloca (len+1);
>> +  snprintf (temp_name, len+1, "gfc$%s", id);
> 
> gfc$ ?

It's just a semi-random prefix I used to make the partial reduction
array identifier unique to aid with debugging. I was working on the
fortran front end at the time. Maybe s/gfc/oacc/?

> Use
>   char *temp_name = XALLOCAVEC (char, len + 1);
> instead?
> 
>> +  return IDENTIFIER_POINTER(get_identifier (temp_name));
> 
> Formatting (missing space before ( ).
> 
>> @@ -868,6 +981,25 @@ maybe_lookup_field (tree var, omp_context *ctx)
>>    return n ? (tree) n->value : NULL_TREE;
>>  }
>>  
>> +static inline tree
>> +lookup_reduction (const char *id, omp_context *ctx)
> 
> Can't you use oacc_ in the name of OpenACC specific functions?

Sure.

[snip]

>> @@ -8834,6 +9492,397 @@ make_pass_expand_omp (gcc::context *ctxt)
>>
>>  /* Routines to lower OpenMP directives into OMP-GIMPLE.  */
>>  
>> +/* Helper function to preform, potentially COMPLEX_TYPE, operation and
>> +   convert it to gimple.  */
>> +static void
>> +omp_gimple_assign_with_ops (tree_code op, tree dest, tree src, gimple_seq *seq)
> 
> Makes me wonder why don't you put the reduction code earlier into reduction
> clause GENERIC and then lower into clauses' GIMPLE seq.
> If there is some reason, please name it oacc at least.

I probably was trying to reuse as much of the existing code as possible.
I've swapped out too much state on this. This can be renamed too.

>> +static void
>> +initialize_reduction_data (tree clauses, tree nthreads, gimple_seq *stmt_seqp,
>> +			   omp_context *ctx)
> 
> Likewise.
> 
>> +/* Helper function to process the array of partial reductions.  Nthreads
>> +   indicates the number of threads.  Unfortunately, GOACC_GET_NUM_THREADS
>> +   cannot be used here, because nthreads on the host may be different than
>> +   on the accelerator. */
>> +
>> +static void
>> +finalize_reduction_data (tree clauses, tree nthreads, gimple_seq *stmt_seqp,
>> +			 omp_context *ctx)
> 
> Likewise.
> 
>> +/* Scan through all of the gimple stmts searching for an OMP_FOR_EXPR, and
>> +   scan that for reductions.  */
>> +
>> +static void
>> +process_reduction_data (gimple_seq *body, gimple_seq *in_stmt_seqp,
>> +			gimple_seq *out_stmt_seqp, omp_context *ctx)
> 
> Likewise.

Thomas, would you like me to handle the renaming, or will you? I could
make those changes to gomp-4_0-branch if you like.

Cesar

  reply	other threads:[~2014-11-13 19:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-13 17:04 Thomas Schwinge
2014-11-13 18:31 ` Jakub Jelinek
2014-11-13 19:09   ` Cesar Philippidis [this message]
2014-11-13 19:16     ` Jakub Jelinek
2014-11-14  1:27       ` Cesar Philippidis
2014-12-18 11:07   ` Thomas Schwinge
2014-12-18 11:39     ` Jakub Jelinek
2014-12-18 13:17       ` Thomas Schwinge
2014-12-18 11:17   ` Thomas Schwinge
2014-12-18 11:39     ` Jakub Jelinek
2014-12-18 12:11       ` Jakub Jelinek
2014-12-18 12:24         ` Jakub Jelinek
2014-12-18 12:31           ` Thomas Schwinge
2014-12-18 12:36             ` Jakub Jelinek
2014-12-18 13:12               ` Jakub Jelinek
2014-12-18 13:24                 ` Thomas Schwinge
2015-02-13 16:23                   ` Thomas Schwinge
2014-12-18 14:29     ` Jakub Jelinek
2014-12-18 15:10       ` libgomp offloading testing (was: OpenACC middle end changes) Thomas Schwinge
2014-12-18 16:31   ` OpenACC middle end changes Thomas Schwinge
2015-07-09 15:52   ` Merge DEF_GOACC_BUILTIN into DEF_GOMP_BUILTIN? (was: OpenACC middle end changes) Thomas Schwinge
2015-07-09 15:58     ` Jakub Jelinek
2014-11-13 22:15 ` OpenACC middle end changes Joseph Myers
2014-11-14 10:35 ` Richard Biener
2014-11-14 10:37   ` Jakub Jelinek
2014-11-16  1:46 ` Gerald Pfeifer
2014-11-19  3:02 ` Bernd Schmidt
2014-11-19 19:32   ` Bernd Schmidt
2014-11-19 20:07   ` Bernd Schmidt
2014-11-19 22:20     ` Jakub Jelinek
2015-02-20  9:48     ` Jakub Jelinek
2015-02-20 11:49       ` nvptx offloading: Tag entrypoint functions with a special attribute (was: OpenACC middle end changes) Thomas Schwinge
2014-11-20  3:25   ` OpenACC middle end changes Bernd Schmidt
2014-11-20  8:07     ` Jakub Jelinek
2014-11-20 13:15       ` Bernd Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54650093.1070109@mentor.com \
    --to=cesar_philippidis@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).