Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: uweigand@de.ibm.com
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc] Implement support for IBM XL C for OpenCL vector ABI
Date: Sun, 13 Feb 2011 15:38:00 -0000	[thread overview]
Message-ID: <201102131537.p1DFbvf2004634@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <201102021748.p12Hm18H010975@d06av02.portsmouth.uk.ibm.com>	(uweigand@de.ibm.com)

> Date: Wed, 2 Feb 2011 18:48:00 +0100 (CET)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
> 
> Hello,
> 
> code generated for OpenCL C kernels does not necessarily need to
> adhere to a platform-defined ABI, since OpenCL does not allow to
> link binary components together.  However, since GDB allows for
> inferior function calls to routines defined as part of an OpenCL
> C kernel, it needs to understand the de-facto ABI used on any
> given implementation.
> 
> With the IBM XL C for OpenCL compiler, we mostly use the existing
> platform ABI for the PowerPC and SPU architectures.  However, the
> OpenCL C language defines a large set of vector types that do not
> correspond to any of the pre-existing data types.  For those, the
> compiler chose to implement an ABI.  GDB's current implementation
> does not always match this ABI.
> 
> The following patch implements support for the actually implemented
> ABI in OpenCL C for PowerPC and SPU.  To do so, we need to actually
> know whether any given function uses the OpenCL C ABI (as opposed
> to the regular platform ABI).  Ideally, we'd want to know if the
> inferior function to be called originates in an OpenCL C source
> file compiled with the IBM XL compiler, but this information is
> no longer directly available in the push_dummy_call etc. callbacks.
> 
> What *is* available is the TYPE_CALLING_CONVENTION attribute.  However,
> this is determined from DWARF DW_AT_calling_convention attributes,
> which the OpenCL compiler does not actually set.  To work around this,
> the patch below hard-codes a special flag to be used as value of
> TYPE_CALLING_CONVENTION, which is set depending on the compiler
> that built the source file (i.e. DWARF "producer").
> 
> This extra flag is defined by GDB itself, and has a value outside
> the defined range of DW_AT_calling_convention attribute values,
> so there should be no potential conflict.
> 
> Does this look reasonable?  If anyone sees a better way to implement
> this, I'd appreciate any suggestions ...
> 
> Using this value, the patch below then implements the OpenCL ABI
> for both PowerPC (32-bit and 64-bit) and SPU, both for function
> calls and function return.
> 
> Tested on powerpc64-linux and Cell/B.E. using the IBM XL C for
> OpenCL compiler and OpenCL runtime.
> 
> Note that this patch assumes the PowerPC AltiVec ABI fix here:
> http://sourceware.org/ml/gdb-patches/2011-02/msg00021.html
> is already applied.
> 
> Any comments welcome!  I'm planning on committing this in a
> week or so.

I didn't look too closely at the diff yet, but given that
push_dummy_call() functions tend to be fairly complex already, would
it be possible to move the OpenCL calling convention into a seperate
function?


  parent reply	other threads:[~2011-02-13 15:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 17:48 Ulrich Weigand
2011-02-04 16:47 ` Tom Tromey
2011-02-07 19:25   ` Ulrich Weigand
2011-02-07 20:05     ` Tom Tromey
2011-02-08 13:30       ` Ulrich Weigand
2011-02-14 12:59         ` Luis Machado
2011-02-14 12:07           ` Luis Machado
2011-02-14 13:41           ` Yao Qi
2011-10-24 17:09     ` [commit/powerpc] crash trying to allocate memory in inferior Joel Brobecker
2011-10-26 17:31       ` Ulrich Weigand
2011-10-26 18:16         ` Joel Brobecker
2011-02-13 15:38 ` Mark Kettenis [this message]
2011-02-14 13:47   ` [rfc] Implement support for IBM XL C for OpenCL vector ABI Ulrich Weigand

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=201102131537.p1DFbvf2004634@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=gdb-patches@sourceware.org \
    --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