From: "Andrew Burgess" <aburgess@broadcom.com>
To: "Ulrich Weigand" <uweigand@de.ibm.com>
Cc: tromey@redhat.com, gdb-patches@sourceware.org, ken@linux.vnet.ibm.com
Subject: Re: [PATCH] Vector to scalar casting and widening
Date: Fri, 04 Jan 2013 14:45:00 -0000 [thread overview]
Message-ID: <50E6EB05.8010600@broadcom.com> (raw)
In-Reply-To: <201211291749.qATHnbBM030788@d06av02.portsmouth.uk.ibm.com>
On 29/11/2012 5:49 PM, Ulrich Weigand wrote:
> Andrew Burgess wrote:
>> On 26/11/2012 2:18 PM, Ulrich Weigand wrote:
>>> Thus, I'd prefer a patch that:
>>> - changes the default behaviour of value_cast etc. to the GCC behaviour, and
>>> - adds handling of UNOP_CAST etc. to evaluate_subexp_opencl to implement the
>>> OpenCL semantics.
>>
>> The latest patch below is is closer to the initial patch I posted, the
>> behaviour of value_cast now follows GCC, and the UNOP_CAST case is handled
>> in evaluate_subexp_opencl. I wasn't sure what the "etc" in the above point
>> referred to, I believe UNOP_CAST is all I need to catch, let me know if I've
>> missed anything.
>
> Well, there's the whole "vector <binop> scalar" issue; with your patch, this
> is now only supported if the scalar type is widened, and rejected if it is
> truncated. This does not correspond to OpenCL semantics, where truncation
> is explicitly supported.
>
> Another problem: in several places in opencl-lang.c, the code calls
> value_cast with the explicit assumption that this will splat a scalar
> across all vector components. Those uses would now have to be changed
> to a value_cast/value_vector_widen pair, I guess.
I finally found time to revisit this issue.
I'm having issues with the approach you suggested, that is adding
handling for UNOP_CAST into evaludate_subexp_opencl, and would welcome
further advice on how I might move this issue forward.
In addressing the two problems you pointed out above, I first created a
new function opencl_value_cast, which I use throughout opencl-lang.c,
however, a quick grep of the codebase shows other places that call
value_cast, for example, within the varobj.c code. I suspect that
creating an opencl_value_cast function will mean that I am introducing
bugs when, for example, we create varobj objects for opencl code.
The first issue you pointed out above "vector <binop> scalar" seems even
harder to fix. The current problem with my patch is that I call
value_vector_widen from value_binop, which will error if the scalar
value is truncated when casting to the vector type. For OpenCL this is
the wrong thing to do. I don't want to add an "if (language == opencl)"
switch to value_binop, and value_binop is called extensively throughout
the codebase. This would suggest then that it is value_vector_widen
that should change, however, this feels very much like the original
patch to which you objected.
So, to summarise the problem as I see it, your suggested solution was to
filter the different behaviours within opencl-lang.c, however, the
problem behaviours live within value_cast and value_binop, both of which
I believe are called from core gdb code, not just from opencl-lang.c, I
therefore believe there's no reliable way to intercept all calls to
these functions.
I'd like to put two other possible solutions on the table (they are
really just variations on the same theme), these would be (1) go back to
my original flag on the language structure, handle all the different
variations within value_cast or value_vector_widen, or (2) have a set of
"vector_ops" function pointers on the language structure, currently
there would be just two, "scalar_to_vector_widen" and
"scalar_to_vector_cast". The defaults would be standard gcc C behaviour
implemented in (probably) valops.c, while opencl would provide its own
within opencl-lang.c.
Alternatively I may have just miss-understood the issue here, in which
case feel free to set me straight!
Thanks for your time,
Andrew
>
>>> Unfortunately the only environment I know of to test the GDB OpenCL support
>>> is the IBM OpenCL SDK for PowerPC. I'll be happy to run the test for you ...
>>
>> I've built and tested on x86-64 GNU/Linux, but I've not run any OpenCL tests. If
>> you were able to give this patch a go and let me know if I've broken any of the
>> OpenCL tests I'd be very grateful.
>
> As expected, given the above, a whole bunch of tests fail ...
>
> Bye,
> Ulrich
>
next prev parent reply other threads:[~2013-01-04 14:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 14:10 Andrew Burgess
2012-11-19 21:17 ` Tom Tromey
2012-11-23 16:26 ` Andrew Burgess
2012-11-26 14:18 ` Ulrich Weigand
2012-11-28 22:08 ` Andrew Burgess
2012-11-29 17:50 ` Ulrich Weigand
2012-11-29 18:13 ` Andrew Burgess
2013-01-04 14:45 ` Andrew Burgess [this message]
2013-01-07 16:23 ` Ulrich Weigand
2013-01-08 15:08 ` Andrew Burgess
2013-01-08 19:05 ` Ulrich Weigand
2013-01-09 19:13 ` Tom Tromey
2013-01-25 17:18 ` Andrew Burgess
2013-01-09 19:08 ` Tom Tromey
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=50E6EB05.8010600@broadcom.com \
--to=aburgess@broadcom.com \
--cc=gdb-patches@sourceware.org \
--cc=ken@linux.vnet.ibm.com \
--cc=tromey@redhat.com \
--cc=uweigand@de.ibm.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