Re: New post-LTO OpenACC pass

2015-09-28 Thread Nathan Sidwell
On 09/25/15 09:19, Bernd Schmidt wrote: On 09/25/2015 03:03 PM, Bernd Schmidt wrote: 182 else if (acc_device_type (acc_dev->type) == acc_device_host) (gdb) p acc_dev->type $1 = OFFLOAD_TARGET_TYPE_HOST (gdb) next 184 fn (hostaddrs); It's not running the offloaded version, so the

Re: New post-LTO OpenACC pass

2015-09-25 Thread Nathan Sidwell
On 09/25/15 06:28, Bernd Schmidt wrote: This is the c-c++-common/goacc/acc_on_device-2.c testcase. Is that expected to be handled? If I change it to use __builtin_acc_on_device, I can step right into Breakpoint 8, fold_call_stmt (stmt=0x70736e10, ignore=false) at

Re: New post-LTO OpenACC pass

2015-09-25 Thread Bernd Schmidt
On 09/25/2015 12:56 PM, Nathan Sidwell wrote: On 09/25/15 06:28, Bernd Schmidt wrote: Can you send me the patch you tried (and possibly a testcase you expect to be handled), I'll see if I can find out what's going on. Thanks! When things didn't work, I tried getting it workong on the gomp4

Re: New post-LTO OpenACC pass

2015-09-25 Thread Bernd Schmidt
On 09/25/2015 02:30 PM, Bernd Schmidt wrote: (gdb) p result $1 = (gdb) pge warning: Expression is not an assignment (and might have no effect) 2 == 4 || 2 == 5 I'm not really sure about the logic, but are the results maybe switched (returning false on the device and true on the host)? Eh,

Re: New post-LTO OpenACC pass

2015-09-25 Thread Bernd Schmidt
On 09/25/2015 03:03 PM, Bernd Schmidt wrote: 182 else if (acc_device_type (acc_dev->type) == acc_device_host) (gdb) p acc_dev->type $1 = OFFLOAD_TARGET_TYPE_HOST (gdb) next 184 fn (hostaddrs); It's not running the offloaded version, so the testcase I think should fail. ... and

Re: New post-LTO OpenACC pass

2015-09-25 Thread Bernd Schmidt
On 09/25/2015 12:38 AM, Nathan Sidwell wrote: On 09/23/15 14:58, Nathan Sidwell wrote: On 09/23/15 14:51, Bernd Schmidt wrote: On 09/23/2015 08:42 PM, Nathan Sidwell wrote: We have to defer folding until we know whether we're doing host or device compilation. Doesn't something like

Re: New post-LTO OpenACC pass

2015-09-24 Thread Nathan Sidwell
On 09/23/15 14:58, Nathan Sidwell wrote: On 09/23/15 14:51, Bernd Schmidt wrote: On 09/23/2015 08:42 PM, Nathan Sidwell wrote: As I feared, builtin folding occurs in several places. In particular its first call is very early on in the host compiler, which is far too soon. We have to defer

Re: New post-LTO OpenACC pass

2015-09-23 Thread Bernd Schmidt
On 09/22/2015 05:16 PM, Nathan Sidwell wrote: + if (gimple_call_builtin_p (call, BUILT_IN_ACC_ON_DEVICE)) + /* acc_on_device must be evaluated at compile time for +constant arguments. */ + { + oacc_xform_on_device (call); + rescan = true; +

Re: New post-LTO OpenACC pass

2015-09-23 Thread Nathan Sidwell
On 09/23/15 06:59, Bernd Schmidt wrote: On 09/22/2015 05:16 PM, Nathan Sidwell wrote: +if (gimple_call_builtin_p (call, BUILT_IN_ACC_ON_DEVICE)) + /* acc_on_device must be evaluated at compile time for + constant arguments. */ + { +oacc_xform_on_device (call); +

Re: New post-LTO OpenACC pass

2015-09-23 Thread Bernd Schmidt
On 09/23/2015 02:14 PM, Nathan Sidwell wrote: On 09/23/15 06:59, Bernd Schmidt wrote: On 09/22/2015 05:16 PM, Nathan Sidwell wrote: +if (gimple_call_builtin_p (call, BUILT_IN_ACC_ON_DEVICE)) + /* acc_on_device must be evaluated at compile time for + constant arguments. */ +

Re: New post-LTO OpenACC pass

2015-09-23 Thread Nathan Sidwell
On 09/23/15 08:58, Bernd Schmidt wrote: On 09/23/2015 02:14 PM, Nathan Sidwell wrote: On 09/23/15 06:59, Bernd Schmidt wrote: On 09/22/2015 05:16 PM, Nathan Sidwell wrote: +if (gimple_call_builtin_p (call, BUILT_IN_ACC_ON_DEVICE)) + /* acc_on_device must be evaluated at compile time

Re: New post-LTO OpenACC pass

2015-09-23 Thread Bernd Schmidt
On 09/23/2015 08:42 PM, Nathan Sidwell wrote: As I feared, builtin folding occurs in several places. In particular its first call is very early on in the host compiler, which is far too soon. We have to defer folding until we know whether we're doing host or device compilation. Doesn't

Re: New post-LTO OpenACC pass

2015-09-23 Thread Nathan Sidwell
On 09/23/15 14:51, Bernd Schmidt wrote: On 09/23/2015 08:42 PM, Nathan Sidwell wrote: As I feared, builtin folding occurs in several places. In particular its first call is very early on in the host compiler, which is far too soon. We have to defer folding until we know whether we're doing

Re: New post-LTO OpenACC pass

2015-09-22 Thread Nathan Sidwell
On 09/21/15 16:39, Nathan Sidwell wrote: On 09/21/15 16:30, Cesar Philippidis wrote: On 09/21/2015 09:30 AM, Nathan Sidwell wrote: +const pass_data pass_data_oacc_transform = +{ + GIMPLE_PASS, /* type */ + "fold_oacc_transform", /* name */ Want to rename the tree dump file to oacc_xforms

New post-LTO OpenACC pass

2015-09-21 Thread Nathan Sidwell
Jakub, this patch adds a new transforming pass, which executes after the LTO readback pass, and hence knows whether it is targeting the host or (a) device. The contents of the pass will be built out -- it does much more on the gomp4 pass. This instance simply scans and replaces the

Re: New post-LTO OpenACC pass

2015-09-21 Thread Cesar Philippidis
On 09/21/2015 09:30 AM, Nathan Sidwell wrote: > +const pass_data pass_data_oacc_transform = > +{ > + GIMPLE_PASS, /* type */ > + "fold_oacc_transform", /* name */ Want to rename the tree dump file to oacc_xforms like I'm did in the attached patch? Regardless, I think we need to document this

Re: New post-LTO OpenACC pass

2015-09-21 Thread Nathan Sidwell
On 09/21/15 16:30, Cesar Philippidis wrote: On 09/21/2015 09:30 AM, Nathan Sidwell wrote: +const pass_data pass_data_oacc_transform = +{ + GIMPLE_PASS, /* type */ + "fold_oacc_transform", /* name */ Want to rename the tree dump file to oacc_xforms like I'm did in the attached patch?