Re: [OpenACC 2/11] PTX backend changes

2015-10-22 Thread Nathan Sidwell
On 10/22/15 05:55, Bernd Schmidt wrote: On 10/22/2015 10:12 AM, Jakub Jelinek wrote: So, is the worker broadcast buffer effectively a file scope .shared variable? My worry is that as .shared is quite limited resource, if you compile many TUs and each allocates its own broadcast buffer you run

Re: [OpenACC 7/11] execution model

2015-10-22 Thread Nathan Sidwell
On 10/22/15 08:59, Jakub Jelinek wrote: On Thu, Oct 22, 2015 at 08:50:23AM -0400, Nathan Sidwell wrote: + expr = build2 (TRUNC_MOD_EXPR, ivar_type, ivar, +fold_convert (ivar_type, collapse->iters)); + expr = build2 (MULT_EXPR, diff_type, fold_convert (diff_t

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-22 Thread Nathan Sidwell
On 10/22/15 07:10, Julian Brown wrote: On Thu, 22 Oct 2015 10:05:30 +0200 Richard Biener wrote: So you'd need to be more precise as to what properties you are trying to preserve by placing a single stmt somewhere. FWIW an earlier, abandoned attempt at solving the same problem was discussed

Re: [OpenACC 3/11] new target hook

2015-10-22 Thread Nathan Sidwell
On 10/22/15 04:15, Jakub Jelinek wrote: On Wed, Oct 21, 2015 at 03:13:26PM -0400, Nathan Sidwell wrote: +/* Determine whether fork & joins are needed. */ + +static bool +nvptx_xform_fork_join (gcall *call, const int dims[], + bool ARG_UNUSED (is_fork)) Why is this

Re: [OpenACC 2/11] PTX backend changes

2015-10-22 Thread Nathan Sidwell
On 10/22/15 09:01, Nathan Sidwell wrote: On 10/22/15 05:55, Bernd Schmidt wrote: On 10/22/2015 10:12 AM, Jakub Jelinek wrote: So, is the worker broadcast buffer effectively a file scope .shared variable? My worry is that as .shared is quite limited resource, if you compile many TUs and each

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-22 Thread Nathan Sidwell
On 10/22/15 09:17, Jakub Jelinek wrote: On Thu, Oct 22, 2015 at 09:08:30AM -0400, Nathan Sidwell wrote: I agree with Richard that it would be better to write more about what kind of IL changes are acceptable with IFN_UNIQUE in the IL and what are not. E.g. is inlining ok (I'd hope yes)

Re: [OpenACC 11/11] execution tests

2015-10-22 Thread Nathan Sidwell
On 10/22/15 05:37, Jakub Jelinek wrote: And, I must say I'm at least missing testcases that check parsing but also runtime behavior of the vector or worker clause arguments (there is one gang (static:1) clause, but not the other clauses nor other styles of gang arguments. the static clause is

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-22 Thread Nathan Sidwell
On 10/22/15 04:07, Richard Biener wrote: Yeah, please make them either end or start a BB so we have to check at most a single stmt. ECF_RETURNS_TWICE should achieve that, it also makes it a code motion barrier. Just so I'm clear, you're not saying that RETURNS_TWICE will stop the call being

Re: [OpenACC 11/11] execution tests

2015-10-22 Thread Nathan Sidwell
On 10/22/15 10:05, Jakub Jelinek wrote: On Thu, Oct 22, 2015 at 09:53:46AM -0400, Nathan Sidwell wrote: On 10/22/15 05:37, Jakub Jelinek wrote: And, I must say I'm at least missing testcases that check parsing but also runtime behavior of the vector or worker clause arguments (there i

Re: [OpenACC 2/11] PTX backend changes

2015-10-22 Thread Nathan Sidwell
On 10/22/15 10:04, Bernd Schmidt wrote: + if (par->mask & GOMP_DIM_MASK (GOMP_DIM_MAX)) +{ /* No propagation needed for a call. */ } + else if (par->mask & GOMP_DIM_MASK (GOMP_DIM_WORKER)) Ok that looks weird with the open brace on the line before the else. I think the standard practice

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-22 Thread Nathan Sidwell
On 10/22/15 10:26, Richard Biener wrote: On Thu, Oct 22, 2015 at 4:01 PM, Nathan Sidwell wrote: RETURNS_TWICE will make the invariant motion stop at UNIQUE (HEAD), but it would have done that anyway. It will also be a CSE barrier, thus tem = global; UNIQUE(HEAD) tem2 = global; will not

Re: [OpenACC 2/11] PTX backend changes

2015-10-22 Thread Nathan Sidwell
On 10/22/15 10:28, Bernd Schmidt wrote: On 10/22/2015 04:24 PM, Nathan Sidwell wrote: + else +{ /* Parent will skip this parallel itself. */ } Here too - actually no need to have an empty else at all. I wanted somewhere clear for the comment to go. (Actually, I think this is the

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-22 Thread Nathan Sidwell
On 10/22/15 10:30, Richard Biener wrote: On Thu, Oct 22, 2015 at 3:24 PM, Nathan Sidwell wrote: Essentially, yes. a set of IFN_UNIQUE form a group which must not be separated from each other. The set is discovered implicitly by following the CFG (though I suppose we could add an

Re: [OpenACC 2/11] PTX backend changes

2015-10-22 Thread Nathan Sidwell
On 10/22/15 10:32, Jakub Jelinek wrote: There is a warning for if (cond); but not for if (cond) ; or if (cond) /* comment */ ; which is the style used in various places throughout the compiler. Sadly, that's not quite accurate. The warning occurs for all the empty if's you

Re: [OpenACC 11/11] execution tests

2015-10-22 Thread Nathan Sidwell
On 10/22/15 10:47, Cesar Philippidis wrote: Interesting question. The spec is unclear. It defines gang, worker and vector as follows in section 2.7 in the OpenACC 2.0a spec: gang [( gang-arg-list )] worker [( [num:] int-expr )] vector [( [length:] int-expr )] where gang-arg is one of:

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-22 Thread Nathan Sidwell
On 10/22/15 04:07, Richard Biener wrote: Yeah, please make them either end or start a BB so we have to check at most a single stmt. ECF_RETURNS_TWICE should achieve that, it also makes it a code motion barrier. I'm having a hard time making UNIQUE the end of a BB. I'm emitting code to a gim

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-22 Thread Nathan Sidwell
On 10/22/15 10:26, Richard Biener wrote: On Thu, Oct 22, 2015 at 4:01 PM, Nathan Sidwell wrote: On 10/22/15 04:07, Richard Biener wrote: Yeah, please make them either end or start a BB so we have to check at most a single stmt. ECF_RETURNS_TWICE should achieve that, it also makes it a code

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-22 Thread Nathan Sidwell
On 10/22/15 04:04, Jakub Jelinek wrote: + /* Ignore blocks containing non-clonable function calls. */ + for (gsi = gsi_start_bb (CONST_CAST_BB (bb)); + !gsi_end_p (gsi); gsi_next (&gsi)) +{ + g = gsi_stmt (gsi); + + if (is_gimple_call (g) && gimple_call_internal_p (g) +

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-23 Thread Nathan Sidwell
On 10/23/15 04:25, Jakub Jelinek wrote: On Thu, Oct 22, 2015 at 02:06:54PM -0400, Nathan Sidwell wrote: On 10/22/15 10:26, Richard Biener wrote: On Thu, Oct 22, 2015 at 4:01 PM, Nathan Sidwell wrote: On 10/22/15 04:07, Richard Biener wrote: Yeah, please make them either end or start a BB

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-23 Thread Nathan Sidwell
On 10/23/15 09:03, Richard Biener wrote: It's a hack. I don't like hacks. One person's hack can be another person's pragmatism :) I think the requirement "don't duplicate me" but inlining is ok is somewhat broken. The requirement is that the SESE region formed by the markers remains as a

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-23 Thread Nathan Sidwell
On 10/23/15 09:03, Jakub Jelinek wrote: On Fri, Oct 23, 2015 at 08:57:17AM -0400, Nathan Sidwell wrote: If this is during the omplower pass, then it is before cfg pass and therefore all you need is tweak the gimple_call_initialize_ctrl_altering function and the cfg pass will DTRT. ok

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-23 Thread Nathan Sidwell
On 10/23/15 09:16, Jakub Jelinek wrote: On Fri, Oct 23, 2015 at 09:13:43AM -0400, Nathan Sidwell wrote: You're correct that the SESE region could be split across a function boundary in the manner you describe, but the complexity of dealing with that in the backend's partitioning cod

Re: [OpenACC 4/11] C FE changes

2015-10-23 Thread Nathan Sidwell
On 10/23/15 16:17, Cesar Philippidis wrote: Nathan, can you try out this patch with your updated patch set? I saw some test cases getting stuck when expanding expand_GOACC_DIM_SIZE in on the host compiler, which is wrong. I don't see that happening in gomp-4_0-branch with this patch. Also, can y

[gomp4] Adjust UNQUE ifn

2015-10-25 Thread Nathan Sidwell
3) IFN_UNIQUE is no longer ECF_LEAF 4) Inserted a data dependency chain to the had & tail call sequence. The 2nd param is the result of the previous call in the chain. Preparing updated trunk patches now ... nathan 2015-10-25 Nathan Sidwell * internal-fn.def (IFN_UNIQUE): N

Re: [OpenACC 4/11] C FE changes

2015-10-25 Thread Nathan Sidwell
On 10/23/15 17:25, Nathan Sidwell wrote: On 10/23/15 16:17, Cesar Philippidis wrote: Nathan, can you try out this patch with your updated patch set? I saw some test cases getting stuck when expanding expand_GOACC_DIM_SIZE in on the host compiler, which is wrong. I don't see that happeni

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-25 Thread Nathan Sidwell
h shortly. comments? nathan 2015-10-25 Nathan Sidwell * internal-fn.c (expand_UNIQUE): New. * internal-fn.h (enum ifn_unique_kind): New. * internal-fn.def (IFN_UNIQUE): New. * gimple.h (gimple_call_internal_unique_p): New. * gimple.c (gimple_call_same_target_p): Check internal fn uni

Re: [OpenACC 7/11] execution model

2015-10-25 Thread Nathan Sidwell
mply does a src->dst move, which will eventually be deleted as unnecessary. comments? nathan 2015-10-25 Nathan Sidwell * internal-fn.def (IFN_GOACC_LOOP): New. * internal-fn.h (enum ifn_unique_kind): Add IFN_UNIQUE_OACC_FORK, IFN_UNIQUE_OACC_JOIN, IFN_UNIQUE_OACC_HEAD_MARK, IFN_UNIQUE

Re: [gomp4] Adjust UNQUE ifn

2015-10-26 Thread Nathan Sidwell
riable 'axis' [-Werror=unused-variable] rtx axis = expand_normal (gimple_call_arg (stmt, 2)); Fixed thusly. nathan 2015-10-26 Nathan Sidwell * internal-fn.c (expand_UNIQUE): Protect fork & join inside co

Re: [gomp4] Adjust UNQUE ifn

2015-10-26 Thread Nathan Sidwell
On 10/26/15 07:36, Richard Biener wrote: + { #ifdef HAVE_oacc_fork (etc.) can you use target-insn.def and targetm.have_oacc_fork () instead? I can try ... nathan

Re: [OpenACC 8/11] device-specific lowering

2015-10-26 Thread Nathan Sidwell
On 10/26/15 08:13, Jakub Jelinek wrote: It won't convert them into such representations. Can you fix that incrementally? I'd expect that code marked with acc loop vector can't have loop carried backward lexical dependencies, at least not within the adjacent number of iterations specified in

Re: [OpenACC 8/11] device-specific lowering

2015-10-26 Thread Nathan Sidwell
On 10/26/15 09:51, Jakub Jelinek wrote: If not, I think the only thing remaining is the IFN_UNIQUE patch, which (At least) needs an update to use targetm.have... conversion. Ok, will wait till you make those changes then? Hope to have that later today. nathan

Re: [gomp4] Adjust UNQUE ifn

2015-10-26 Thread Nathan Sidwell
On 10/26/15 07:36, Richard Biener wrote: Looks better now. + { #ifdef HAVE_oacc_fork (etc.) can you use target-insn.def and targetm.have_oacc_fork () instead? I've committed this to gomp4. Will port and update the patches for trunk. nathan 2015-10-26 Nathan Si

[gomp4] reorganize reduction target lowering

2015-10-26 Thread Nathan Sidwell
se a difficulty with inlining, we simply identify them with an offset determined when generating the lowering. This offset is useful in our case for worker level reductions, but could be used for other purposes by different backends. nathan 2015-10-26 Nathan Sidwell * doc/tm.texi: Re

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-26 Thread Nathan Sidwell
parate function. That's fine -- it'll copy the whole CFG of interest. ok? nathan 2015-10-26 Nathan Sidwell * internal-fn.c (expand_UNIQUE): New. * internal-fn.h (enum ifn_unique_kind): New. * internal-fn.def (IFN_UNIQUE): New. * target-insns.def (unique): Define. * gimple.h (gimp

Re: [OpenACC 7/11] execution model

2015-10-26 Thread Nathan Sidwell
e PTX case simply does a src->dst move, which will eventually be deleted as unnecessary. ok? nathan 2015-10-26 Nathan Sidwell * internal-fn.def (IFN_GOACC_LOOP): New. * internal-fn.h (enum ifn_unique_kind): Add IFN_UNIQUE_OACC_FORK, IFN_UNIQUE_OACC_JOIN, IFN_UNIQUE_O

Re: [OpenACC 7/11] execution model

2015-10-27 Thread Nathan Sidwell
On 10/27/15 01:18, Jakub Jelinek wrote: LGTM, though could I ask you to try to try to move the struct oacc_collapse expand_oacc_collapse_init expand_oacc_collapse_vars expand_oacc_for additions somewhere else (e.g. in between expand_omp_taskreg and expand_omp_for_init_counts), ok, I wasn't su

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-27 Thread Nathan Sidwell
On 10/27/15 06:45, Richard Biener wrote: On Tue, Oct 27, 2015 at 9:03 AM, Jakub Jelinek wrote: Ok for me, but please wait for Richi's ack too. + /* An IFN_UNIQUE call must be duplicated as part of its group, +or not at all. */ + if (is_gimple_call (g) && gimple_call_inter

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-27 Thread Nathan Sidwell
On 10/27/15 01:03, Jakub Jelinek wrote: On Mon, Oct 26, 2015 at 03:32:45PM -0700, Nathan Sidwell wrote: to break out the else part into a separate function. That's fine -- it'll copy the whole CFG of interest. The question is if some UNIQUE call could be ever considered as p

Re: [OpenACC 1/11] UNIQUE internal function

2015-10-27 Thread Nathan Sidwell
This is the patch that was committed. nathan 2015-10-27 Nathan Sidwell * internal-fn.c (expand_UNIQUE): New. * internal-fn.h (enum ifn_unique_kind): New. * internal-fn.def (IFN_UNIQUE): New. * target-insns.def (unique): Define. * gimple.h (gimple_call_internal_unique_p): New

Re: [OpenACC 5/11] C++ FE changes

2015-10-27 Thread Nathan Sidwell
pidis Thomas Schwinge James Norris Joseph Myers Julian Brown Nathan Sidwell Bernd Schmidt gcc/cp/ * parser.c (cp_parser_omp_clause_name): Add auto, gang, seq, vector, worker. (cp_parser_oacc_simple_clause): New. (cp_parser_oacc_shape_clause)

Re: [OpenACC 4/11] C FE changes

2015-10-27 Thread Nathan Sidwell
athan 2015-10-27 Cesar Philippidis Thomas Schwinge James Norris Joseph Myers Julian Brown Nathan Sidwell Bernd Schmidt gcc/cp/ * parser.c (cp_parser_omp_clause_name): Add auto, gang, seq, vector, worker. (cp_parser_oacc_simple_cl

Re: [OpenACC 9/11] oacc_device_lower pass gate

2015-10-27 Thread Nathan Sidwell
On 10/22/15 02:32, Jakub Jelinek wrote: On Wed, Oct 21, 2015 at 03:50:31PM -0400, Nathan Sidwell wrote: This patch is obvious, but included for completeness. We always want to run the device lowering pass (when openacc is enabled), in order to delete the marker and loop functions that should

Re: [OpenACC 3/11] new target hook

2015-10-27 Thread Nathan Sidwell
On 10/22/15 01:15, Jakub Jelinek wrote: On Wed, Oct 21, 2015 at 03:13:26PM -0400, Nathan Sidwell wrote: 2015-10-20 Nathan Sidwell * target.def (fork_join): New GOACC hook. * targhooks.h (default_goacc_fork_join): Declare. * omp-low.c (default_goacc_forkjoin): New

Re: [OpenACC 6/11] Reduction initialization

2015-10-27 Thread Nathan Sidwell
On 10/22/15 01:58, Jakub Jelinek wrote: On Wed, Oct 21, 2015 at 03:24:13PM -0400, Nathan Sidwell wrote: 2015-10-20 Nathan Sidwell * omp-low.c (oacc_init_rediction_array): New. (oacc_initialize_reduction_data): Initialize array. Ok. Committed.

Re: [OpenACC 8/11] device-specific lowering

2015-10-27 Thread Nathan Sidwell
On 10/26/15 08:13, Jakub Jelinek wrote: On Wed, Oct 21, 2015 at 03:49:08PM -0400, Nathan Sidwell wrote: This patch is the device-specific half of the previous patch. It processes the partition head & tail markers and loop abstraction functions inserted during omp lowering. This is

Re: [OpenACC 7/11] execution model

2015-10-27 Thread Nathan Sidwell
On 10/27/15 07:02, Nathan Sidwell wrote: yeah, I noticed diff got confused. (I'm not sure the above suggestion will resolve it, but we can give it a go. This is what I've committed. This breaks the libgomp reduction tests on nvidia, because there's now a discrepancy between

Re: [OpenACC 2/11] PTX backend changes

2015-10-28 Thread Nathan Sidwell
This is the patch I've just committed. It includes the new target hook overriding, which was originally in patch 3. nathan 2015-10-28 Nathan Sidwell * config/nvptx/nvptx.h (struct machine_function): Add axis_predicate. * config/nvptx/nvptx-protos.h (nvptx_expand_oacc

Re: [OpenACC 11/11] execution tests

2015-10-28 Thread Nathan Sidwell
On 10/21/15 13:16, Nathan Sidwell wrote: On 10/21/15 16:14, Ilya Verbin wrote: <11-trunk-tests.patch> Does the testcase with offload IR appear here accidentally? D'oh! yup, fixed. Now all applied, Thanks for everybody's help. nathan

[nvptx] some cleanups

2015-10-28 Thread Nathan Sidwell
I've committed this to trunk, cleaning up a few bits and bobs I noticed comparing with the gomp4 branch. nathan 2015-10-28 Nathan Sidwell * config/nvptx/nvptx.c (nvptx_print_operand): Remove 'd' case. (struct parallel): Update comment. (nvptx_reorg): Likewise. (nvptx_n

omp-low cleanup

2015-10-28 Thread Nathan Sidwell
I've committed this as obvious. There were a couple of bits of now-redundant code I'd missed in my recent merge to trunk. nathan 2015-10-28 Nathan Sidwell * omp-low.c (MASK_GANG, MASK_WORKER, MASK_VECTOR): Delete. (extract_omp_for_data): Remove OpenACC special handling of

[OpenACC] internal fn folding

2015-10-28 Thread Nathan Sidwell
e POS must be zero. ok? nathan 2015-10-28 Nathan Sidwell * gimple-fold.c: Include omp-low.h. (fold_internal_goacc_dim): New. (gimple_fold_call): Call it. Index: gcc/gimple-fold.c === --- gcc/gimple-fold.c (revision 229488) ++

[gomp4] backport changes

2015-10-28 Thread Nathan Sidwell
I've committed this to gomp4 branch. It reduces the delta from trunk by removing unneeded code and porting some changes that occurred on the route to my recent merge of code to trunk. nathan 2015-10-28 Nathan Sidwell * target.def (goacc.fork_join): Invert sense of result. * doc/tm

omp cleanup

2015-10-28 Thread Nathan Sidwell
: if (offloaded || data_region) { A; B; } If that's incorrect, is the first '|| data_region' wrong? nathan 2015-10-28 Nathan Sidwell * omp-low.c (lower_omp_target): Remove unreachable code & merge ifs

[gomp4] acc_on_device

2015-10-29 Thread Nathan Sidwell
g part of openacc.h in the test directory, and this had diverged from the openacc.h we actually have. I deleted those tests and inserted one in the libgomp testsuite, which correctly picks up the openacc.h of the tool under test, (rather than one in system includes). nathan 2015-10-29 Nathan

[gomp4] openacc reduction simplification

2015-10-29 Thread Nathan Sidwell
I've committed this to gomp4. It removes a no-longer needed field from omp_context & simplifies the dummy head/tail generation needed for reductions at the outermost level. Also incorporates the simplification I committed to trunk earlier today. nathan 2015-10-29 Natha

[openacc] on_device fix

2015-10-29 Thread Nathan Sidwell
lementation anyway. I added enumeration values to acc_device_t to enforce that, just in case someone tries to compile their openacc code with -fshort-enums. Committed to trunk. nathan 2015-10-29 Nathan Sidwell gcc/ * openacc.h (enum acc_device_t): Reformat. Ensure layout compatibili

[libgomp] remove some unneeded args

2015-10-29 Thread Nathan Sidwell
t have to deal with version skew between libgomp and its plugins, this doesn't require versioning changes etc. Jakub, not sure if this patch falls under your review or not. Given ptx is the only current plugin, and this doesn't break backwards compatibility I figure it ok. nat

cgraph offloading error?

2015-10-30 Thread Nathan Sidwell
This bit of trunk code in cgraph_node::create at around line 500 of cgraph.c looks wrong. Specifically the contents of the #ifdef -- it's uncompilable as there's no 'g'. if ((flag_openacc || flag_openmp) && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl))) { no

Re: cgraph offloading error?

2015-10-30 Thread Nathan Sidwell
On 10/30/15 13:54, Jeff Law wrote: On 10/30/2015 02:52 PM, Nathan Sidwell wrote: This bit of trunk code in cgraph_node::create at around line 500 of cgraph.c looks wrong. Specifically the contents of the #ifdef -- it's uncompilable as there's no 'g'. if ((flag_op

Re: cgraph offloading error?

2015-10-30 Thread Nathan Sidwell
. nathan 2015-10-30 Jeff Law Nathan Sidwell * config/nvptx/nvptx.h (HARD_REGNO_NREGS): Avoid warning on unused args. (MOVE_MAX): Set to 8. Index: config/nvptx/nvptx.h === --- config/nvptx/nvptx.h (revision 229595) +++

Re: cgraph offloading error?

2015-10-30 Thread Nathan Sidwell
On 10/30/15 15:16, Nathan Sidwell wrote: Testing attached ... ... with parens on void cast args ... nathan

Re: cgraph offloading error?

2015-10-30 Thread Nathan Sidwell
On 10/30/15 15:30, Jeff Law wrote: On 10/30/2015 04:16 PM, Nathan Sidwell wrote: Cool. I'll go ahead and add nvptx-elf to the list shortly on the assumption this stuff will get fixed on way or another. I've just committed nvptx-none Index:

Re: [OpenACC] internal fn folding

2015-11-02 Thread Nathan Sidwell
On 10/28/15 14:40, Nathan Sidwell wrote: Richard, this patch adds folding for the new GOACC_DIM_POS and GOACC_DIM_SIZE internal functions. IIUC gimple_fold_call is the right place to add this. The size of a compute dimension is very often a compile-time constant. On the host, in particular

[0/3] OpenACC reductions

2015-11-02 Thread Nathan Sidwell
Jakub, the following patch series implements the reduction handling for OpenACC: 01-trunk-reductions-core-1102.patch Core execution changes 02-trunk-reductions-ptx-1102.patch PTX backend bits 03-trunk-reductions-tests-1102.patch Testcases The reduction mechanism relies on a new internal bui

Re: [1/3] OpenACC reductions

2015-11-02 Thread Nathan Sidwell
tion we can do there following the openmp merge. This only affected one testcase (which was (a) broken anyway and (b) working by accident). nathan 2015-11-02 Nathan Sidwell Cesar Philippidis * internal-fn.def (GOACC_REDUCTION): New. * internal-fn.h (enum ifn_goacc_reduction_kind): N

Re: [2/3] OpenACC reductions

2015-11-02 Thread Nathan Sidwell
to 32 in this manner, which is what other compilers appear to do anyway. Bernd, I think the builtin fn bits you originally wrote got completely rewritten by me several times. nathan 2015-11-02 Nathan Sidwell Cesar Philippidis * config/nvptx/nvptx.c: Include gimple headers.

Re: [3/3] OpenACC reductions

2015-11-02 Thread Nathan Sidwell
reference variable. Reference handling will be a later patch. nathan 2015-11-02 Nathan Sidwell libgomp/ * libgomp.oacc-c-c++-common/loop-red-g-1.c: New. * libgomp.oacc-c-c++-common/loop-red-gwv-1.c: New. * libgomp.oacc-c-c++-common/loop-red-v-1.c: New. * libgomp.oacc-c-c++-common/loop-red-v-2

[0/2] OpenACC routine support

2015-11-02 Thread Nathan Sidwell
The following pair of patches add support for routines. 01-trunk-routine-code-1102.patch: Compiler changes 02-trunk-routine-tests-1102.patch: Tests The changes are pretty straight forwards, as the execution model patch set laid the groundwork. Routines are decorated with the 'oacc routine' pr

Re: [1/2] OpenACC routine support

2015-11-02 Thread Nathan Sidwell
sets TREE_PURPOSE of such dimensions to zero. while those dimensions over which it must not partition a loop have TREE_PURPOSE set to non-zero. the handling for validating this in the lower_oacc_device pass, and in the PTX backend is already there. ok? nathan 2015-11-02 Nat

Re: [2/2] OpenACC routine support

2015-11-02 Thread Nathan Sidwell
ests. ok? nathan 2015-11-02 Nathan Sidwell gcc/testsuite/ * c-c++-common/goacc/routine-1.c: New. * c-c++-common/goacc/routine-2.c: New. * c-c++-common/goacc/routine-3.c: New. * c-c++-common/goacc/routine-4.c: New. libgomp/ * testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: New. * tests

Re: [2/2] OpenACC routine support

2015-11-02 Thread Nathan Sidwell
On 11/02/15 14:41, Jakub Jelinek wrote: Does this work even with -O0? I mean, the assembler is invalid for any target other than PTX, so you are relying on aggressively folding this away. Correct. As thread identification is inherently target-specific, I don't see how to do otherwise. We

Re: [1/2] OpenACC routine support

2015-11-03 Thread Nathan Sidwell
On 11/03/15 10:35, Jakub Jelinek wrote: On Mon, Nov 02, 2015 at 02:21:43PM -0500, Nathan Sidwell wrote: --- gcc/c/c-parser.c(revision 229667) +++ gcc/c/c-parser.c(working copy) @@ -1160,7 +1160,8 @@ enum c_parser_prec { static void c_parser_external_declaration (c_parser *); static

Re: [1/3] OpenACC reductions

2015-11-03 Thread Nathan Sidwell
On 11/03/15 10:46, Jakub Jelinek wrote: On Mon, Nov 02, 2015 at 11:18:37AM -0500, Nathan Sidwell wrote: This is the core execution bits of OpenACC reductions. We have a new internal fn 'IFN_GOACC_REDUCTION' and a new target hook goacc.reduction, to lower it on the target compiler.

Re: [2/2] OpenACC routine support

2015-11-03 Thread Nathan Sidwell
On 11/03/15 10:38, Jakub Jelinek wrote: On Mon, Nov 02, 2015 at 02:23:19PM -0500, Nathan Sidwell wrote: Here are the tests for the routine support. The compiler tests check invalid combinations of gang, worker, vector & seq. The libgomp execution tests check the expected partioning oc

OpenACC dimension range propagation optimization

2015-11-03 Thread Nathan Sidwell
an 2015-11-03 Nathan Sidwell * target.def (goacc.dim_limit): New hook. * targhooks.h (default_goacc_dim_limit): Declare. * doc/tm.texi.in (TARGET_GOACC_DIM_LIMIT): Add. * doc/tm.texi: Rebuilt. * omp-low.c (default_goacc_dim_limit): New. * config/nvptx/nvptx.c (PTX_VECTOR_LENGTH, PTX_WOR

Re: OpenACC dimension range propagation optimization

2015-11-04 Thread Nathan Sidwell
On 11/04/15 05:26, Richard Biener wrote: On Tue, Nov 3, 2015 at 7:11 PM, Nathan Sidwell wrote: Richard, this patch implements VRP for the 2 openacc axis internal fns I've added. We know the position within a dimension cannot exceed that dimensions extend. Further, if the extend is dy

Re: [2/3] OpenACC reductions

2015-11-04 Thread Nathan Sidwell
On 11/04/15 05:01, Jakub Jelinek wrote: On Mon, Nov 02, 2015 at 11:35:34AM -0500, Nathan Sidwell wrote: 2015-11-02 Nathan Sidwell Cesar Philippidis * config/nvptx/nvptx.c: Include gimple headers. (worker_red_size, worker_red_align, worker_red_name, ... I

Re: [1/3] OpenACC reductions

2015-11-04 Thread Nathan Sidwell
On 11/04/15 05:31, Jakub Jelinek wrote: On Tue, Nov 03, 2015 at 11:01:57AM -0500, Nathan Sidwell wrote: On 11/03/15 10:46, Jakub Jelinek wrote: On Mon, Nov 02, 2015 at 11:18:37AM -0500, Nathan Sidwell wrote: This is the core execution bits of OpenACC reductions. We have a new internal fn

Re: [2/3] OpenACC reductions

2015-11-04 Thread Nathan Sidwell
On 11/04/15 08:27, Bernd Schmidt wrote: On 11/02/2015 05:35 PM, Nathan Sidwell wrote: There are two such switch statements, and it's possible to write this more compactly: if (!INTEGRAL_MODE_P (...)) code = VIEW_CONVERT_EXPR; if (GET_MODE_SIZE (...) == 8) fn = CMP_S

Re: [2/3] OpenACC reductions

2015-11-04 Thread Nathan Sidwell
On 11/04/15 08:27, Bernd Schmidt wrote: Adjust and applied, thanks! nathan 2015-11-04 Nathan Sidwell Cesar Philippidis * config/nvptx/nvptx.c: Include gimple headers. (worker_red_size, worker_red_align, worker_red_name, worker_red_sym): New. (nvptx_option_override): Initialize

Re: OpenACC dimension range propagation optimization

2015-11-04 Thread Nathan Sidwell
On 11/04/15 05:26, Richard Biener wrote: On Tue, Nov 3, 2015 at 7:11 PM, Nathan Sidwell wrote: Richard, this all seems a little bit fragile and relying on implementation details? Is the attribute always present? Is the call argument always a constant that fits in a HOST_WIDE_INT (or even

OpenaCC dimension checking

2015-11-04 Thread Nathan Sidwell
). Also a new testcase to exercise the error handling. Committed to trunk. nathan 2015-11-04 Nathan Sidwell gcc/ * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Add checking. libgomp/ * testsuite/libgomp.oacc-fortran/reduction-1.f90: Fix dimensions and reduction copy. * testsui

Remove obsolete openacc reduction code

2015-11-04 Thread Nathan Sidwell
I've committed this patch to trunk as obvious. I'd missed some code obsoleted by the new reduction implementation. This code was simply creating a splay tree, not adding anything to it and then processing the splay tree. Nuked from orbit. nathan 2015-11-04 Nathan Sidwell *

Re: [PATCH] Merge from gomp-4_5-branch to trunk

2015-11-05 Thread Nathan Sidwell
On 11/05/15 10:29, Jakub Jelinek wrote: Hi! I've merged the current state of gomp-4_5-branch into trunk, after bootstrapping/regtesting it on x86_64-linux and i686-linux. There are +FAIL: gfortran.dg/goacc/private-3.f95 -O (test for excess errors) +FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-

Re: [OpenACC] internal fn folding

2015-11-05 Thread Nathan Sidwell
On 11/04/15 05:02, Bernd Schmidt wrote: On 11/02/2015 02:56 PM, Nathan Sidwell wrote: On 10/28/15 14:40, Nathan Sidwell wrote: Richard, this patch adds folding for the new GOACC_DIM_POS and GOACC_DIM_SIZE internal functions. IIUC gimple_fold_call is the right place to add this. The size of a

Re: [openacc] tile, independent, default, private and firstprivate support in c/++

2015-11-05 Thread Nathan Sidwell
e allowed to be specified with the kernels construct for what it's worth, but that doesn't mean we couldn't use it internally, of course, if so required.) I think interpretation #2 or #3 make sense, and I suspect result in the same emitted code. nathan -- Nathan Sidwell

Re: [openacc] tile, independent, default, private and firstprivate support in c/++

2015-11-06 Thread Nathan Sidwell
#2 (a smaller patch) may not make it today, as I have to rebase it on the reworking of #1 I did to remove the two enums I disucssed with Jakub. nathan -- Nathan Sidwell

Re: [openacc] tile, independent, default, private and firstprivate support in c/++

2015-11-06 Thread Nathan Sidwell
n removed yesterday, feel free to re-add it, but of course never set it for OpenMP, just OpenACC constructs (so for OpenMP keep the gimplifier assertion, for OpenACC set it). FWIW not noticed a problem with my firstprivate reworking, rebased ontop yesterday's openmp merge nathan -- Nathan Sidwell

OpenACC Firstprivate

2015-11-07 Thread Nathan Sidwell
s fixes a few xfails. I'll post the default handling patch, which is much more localized. nathan 2015-11-06 Nathan Sidwell Cesar Philippidis gcc/ * gcc/gimplify.c (enum omp_region_type): Add ORT_ACC, ORT_ACC_DATA, ORT_ACC_PARALLEL, ORT_ACC_KERNELS. Adjust ORT_NONE. (new_omp_

Re: OpenACC Firstprivate

2015-11-09 Thread Nathan Sidwell
On 11/09/15 08:46, Jakub Jelinek wrote: On Sat, Nov 07, 2015 at 08:50:28AM -0500, Nathan Sidwell wrote: Index: gcc/gimplify.c === If you want to switch to hexadecimal, you should change all values in the enum to hexadecimal for

Re: OpenACC Firstprivate

2015-11-09 Thread Nathan Sidwell
On 11/09/15 08:59, Nathan Sidwell wrote: On 11/09/15 08:46, Jakub Jelinek wrote: On Sat, Nov 07, 2015 at 08:50:28AM -0500, Nathan Sidwell wrote: Say int arr[64]; // initialize arr #pragma acc data copyin (arr) { // modify arr on the host # pragma acc parallel firstprivate (arr

Re: OpenACC Firstprivate

2015-11-09 Thread Nathan Sidwell
On 11/09/15 09:10, Jakub Jelinek wrote: On Mon, Nov 09, 2015 at 08:59:15AM -0500, Nathan Sidwell wrote: This I'm afraid performs often two copies rather than just one (one to copy the host value to the present_copyin mapped value, another one in the region), I don't think that can

[gomp4] remove IFN_GOACC_DIM handling from device_lower

2015-11-09 Thread Nathan Sidwell
I've committed this to gomp4, the relevant handling is in gimple-fold now. nathan 2015-11-09 Nathan Sidwell * omp-low.c (oacc_xform_dim): Delete. (execute_oacc_device_lower): Remove IFN_GOACC_DIM_POS, IFN_GOACC_DIM_SIZE handling. Index: omp-

Remove unused openacc call

2015-11-09 Thread Nathan Sidwell
I've committed this to trunk. It nuke the now unused GOACC_GET_NUM_THREADS and GOACC_GET_THREAD_NUM calls. Also fixed up some comment typos I noticed nathan 2015-11-09 Nathan Sidwell * omp-low.c: Fix some OpenACC comment typos. (lower_reduction_clauses): R

Re: [1/2] OpenACC routine support

2015-11-09 Thread Nathan Sidwell
On 11/03/15 10:35, Jakub Jelinek wrote: On Mon, Nov 02, 2015 at 02:21:43PM -0500, Nathan Sidwell wrote: --- gcc/c/c-parser.c(revision 229667) +++ gcc/c/c-parser.c(working copy) @@ -1160,7 +1160,8 @@ enum c_parser_prec { static void c_parser_external_declaration (c_parser *); static

Re: [1/2] OpenACC routine support

2015-11-09 Thread Nathan Sidwell
And these are the new tests. Cesar, c-c++-common/goacc/routine-5.c will need adjusting with your C++ parser patch. You'll see the two cases I've #if'd out. nathan 2015-11-09 Nathan Sidwell gcc/testsuite/ * c-c++-common/goacc/routine-1.c: New. * c-c++-common/goacc/routine

remove inadvertent testcase commit

2015-11-10 Thread Nathan Sidwell
I've removed a testcase I inadvertently committed along with the routine testcases: 2015-11-09 Nathan Sidwell * testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Remove inadvertent commit. nathan

Re: OpenACC Firstprivate

2015-11-10 Thread Nathan Sidwell
On 11/09/15 09:46, Nathan Sidwell wrote: I'm going to try and get clarification, but I think the intent is to initialize with the value seen on the device. Consider: My thinking is that the intent of the firstprivate is to initialize with the value known on the device (and behave

[gomp4] Random omp-low.c backporting

2015-11-10 Thread Nathan Sidwell
I've committed this to backport a bunch of random bits from trunk to gomp4, and thereby reduce divergence. nathan 2015-11-10 Nathan Sidwell * omp-low.c: Backport whitespace & formatting changes from trunk. (is_atomic_compatible_p): Delete. (lower_reduction_clauses): Don&

[gomp4] Fix some broken tests

2015-11-10 Thread Nathan Sidwell
I've committed this to gomp4. In preparing the reworked firstprivate patch changes for gomp4's gimplify.c I discovered these testcases were passing by accident, and lacked a data clause. nathan 2015-11-10 Nathan Sidwell * testsuite/libgomp.oacc-fortran/parallel-reduction.f90

<    1   2   3   4   5   6   7   8   9   10   >