From: Thomas Schwinge <thomas@codesourcery.com>
To: Ilya Verbin <iverbin@gmail.com>,
Bernd Schmidt <bernds@codesourcery.com>,
Jakub Jelinek <jakub@redhat.com>
Cc: "Michael V. Zolotukhin" <michael.v.zolotukhin@gmail.com>,
Richard Biener <rguenther@suse.de>,
Kirill Yukhin <kirill.yukhin@gmail.com>,
Andrey Turetskiy <andrey.turetskiy@gmail.com>,
Ilya Tocar <tocarip.intel@gmail.com>,
gcc-patches <gcc-patches@gcc.gnu.org>,
Nathan Sidwell <nathan_sidwell@mentor.com>
Subject: Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
Date: Mon, 17 Mar 2014 15:12:00 -0000 [thread overview]
Message-ID: <87pplkna4k.fsf@kepler.schwinge.homeip.net> (raw)
In-Reply-To: <20140308145015.GA61489@msticlxl57.ims.intel.com>
[-- Attachment #1: Type: text/plain, Size: 3021 bytes --]
Hi!
On Sat, 8 Mar 2014 18:50:15 +0400, Ilya Verbin <iverbin@gmail.com> wrote:
> --- a/libgomp/libgomp.map
> +++ b/libgomp/libgomp.map
> @@ -208,6 +208,7 @@ GOMP_3.0 {
>
> GOMP_4.0 {
> global:
> + GOMP_offload_register;
> GOMP_barrier_cancel;
> GOMP_cancel;
> GOMP_cancellation_point;
Now that the GOMP_4.0 symbol version is being used in GCC trunk, and will
be in the GCC 4.9 release, can we still add new symbols to it here?
(Jakub?)
> --- a/libgomp/plugin-host.c
> +++ b/libgomp/plugin-host.c
> +const int TARGET_TYPE_HOST = 0;
We'll have to see whether this (that is, libgomp/target.c:enum
target_type) should live in a shared header file, but OK for the moment.
> +void
> +device_run (void *fn_ptr, void *vars)
> +{
> +#ifdef DEBUG
> + printf ("libgomp plugin: %s:%s (%p, %p)\n", __FILE__, __FUNCTION__, fn_ptr,
> + vars);
> +#endif
> +
> + void (*fn)(void *) = (void (*)(void *)) fn_ptr;
> +
> + fn (vars);
> +}
Why not make fn_ptr a proper function pointer? Ah, because of
GOMP_target passing (void *) tgt_fn->tgt->tgt_start for the
!TARGET_TYPE_HOST case...
Would it make sense to have device_run return a value to make it able to
indicate to libgomp that the function cannot be run on the device (for
whatever reason), and libgomp should use host-fallback execution?
(Probably that needs more thought and discussion, OK to defer.)
> --- a/libgomp/target.c
> +++ b/libgomp/target.c
> +enum target_type {
> + TARGET_TYPE_HOST,
> + TARGET_TYPE_INTEL_MIC
> +};
(As discussed above, but OK to defer.)
> @@ -120,15 +140,26 @@ struct gomp_device_descr
> TARGET construct. */
> int id;
>
> + /* This is the TYPE of device. */
> + int type;
Use enum target_type instead of int?
> +/* This function should be called from every offload image. It gets the
> + descriptor of the host func and var tables HOST_TABLE, TYPE of the target,
> + and TARGET_DATA needed by target plugin (target tables, etc.) */
> +void
> +GOMP_offload_register (void *host_table, int type, void *target_data)
> +{
> + offload_images = realloc (offload_images,
> + (num_offload_images + 1)
> + * sizeof (struct offload_image_descr));
> +
> + if (offload_images == NULL)
> + return;
Fail silently, or use gomp_realloc to fail loudly?
> @@ -701,16 +836,25 @@ gomp_find_available_plugins (void)
> - out:
> +out:
Emacs wants the space to be there, so I assume that's the coding standard
to use. ;-)
> if (dir)
> closedir (dir);
> + free (offload_images);
I suggest to set offload_images = NULL, for clarity.
> + num_offload_images = 0;
> }
We may need to revisit this later: currently it's not possible to
register additional plugins after libgomp has initialized
(gomp_target_init, gomp_find_available_plugins just executed once), but
should that ever be made possible, we'd need to preserve offload_images.
OK to commit, thanks!
Grüße,
Thomas
[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]
next prev parent reply other threads:[~2014-03-17 15:00 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 17:18 [RFC][gomp4] Offloading: Add device initialization and host->target function mapping Ilya Verbin
2013-12-26 13:37 ` Ilya Verbin
2014-01-15 15:09 ` Ilya Verbin
2014-03-12 18:21 ` Ilya Verbin
2014-03-17 13:10 ` Ilya Verbin
2014-03-17 15:12 ` Thomas Schwinge [this message]
2014-03-17 16:49 ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Jakub Jelinek
2014-03-18 17:36 ` Ilya Verbin
-- strict thread matches above, loose matches on Subject: below --
2013-12-17 11:40 Michael V. Zolotukhin
2014-01-16 11:37 ` Michael Zolotukhin
2014-01-28 11:20 ` Bernd Schmidt
[not found] ` <CADG=Z0GQ8ORLe1XRUU7VMYeLhwuWisMyCcGLQj-nY_bhkbD_1Q@mail.gmail.com>
2014-01-28 12:53 ` Fwd: " Ilya Verbin
2014-01-29 14:43 ` Bernd Schmidt
2014-01-29 16:06 ` Ilya Verbin
2014-02-14 14:49 ` Ilya Verbin
2014-02-14 15:02 ` Bernd Schmidt
2014-02-14 15:12 ` Jakub Jelinek
2014-02-14 15:50 ` Bernd Schmidt
2014-02-14 16:06 ` Jakub Jelinek
2014-02-20 18:27 ` Bernd Schmidt
2014-02-21 15:17 ` Ilya Verbin
2014-02-21 15:41 ` Bernd Schmidt
2014-02-21 18:00 ` Ilya Verbin
2014-02-28 16:09 ` Ilya Verbin
2014-02-28 16:23 ` Bernd Schmidt
2014-02-28 21:41 ` Bernd Schmidt
2014-05-27 10:18 ` Ilya Verbin
2014-05-27 10:59 ` Bernd Schmidt
2014-05-27 11:11 ` Ilya Verbin
2014-05-27 11:16 ` Bernd Schmidt
2014-05-27 15:33 ` Ilya Verbin
2014-05-27 19:03 ` Bernd Schmidt
2014-02-28 22:10 ` Ilya Verbin
2014-03-05 17:15 ` Ilya Verbin
2014-03-06 8:48 ` Bernd Schmidt
2014-03-06 11:11 ` Ilya Verbin
2014-03-06 11:54 ` Bernd Schmidt
2014-03-06 12:52 ` Ilya Verbin
2014-03-08 15:39 ` Ilya Verbin
2014-03-12 14:14 ` Bernd Schmidt
2014-03-12 14:52 ` Ilya Verbin
2014-03-20 17:41 ` Bernd Schmidt
2014-06-17 18:20 ` Ilya Verbin
2014-06-17 19:23 ` Bernd Schmidt
2014-06-18 14:14 ` Ilya Verbin
2014-06-18 14:23 ` Bernd Schmidt
2014-06-19 10:19 ` Ilya Verbin
2014-06-27 7:33 ` Bernd Schmidt
2014-07-07 14:51 ` Ilya Verbin
2014-07-07 15:04 ` Bernd Schmidt
2014-07-07 15:14 ` Jakub Jelinek
2014-07-07 15:22 ` Jakub Jelinek
2014-07-10 18:24 ` Ilya Verbin
2014-07-10 18:28 ` Bernd Schmidt
2014-07-23 14:18 ` Bernd Schmidt
2014-07-23 14:40 ` Ilya Verbin
2014-08-04 21:00 ` Bernd Schmidt
2014-08-07 17:35 ` Thomas Schwinge
2014-09-05 16:36 ` [gomp4] Revert more old Makefile/configure bits Bernd Schmidt
2014-09-08 9:42 ` Thomas Schwinge
2014-07-24 15:58 ` Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation Ilya Verbin
2014-05-08 9:44 ` [gomp4] Mark __OPENMP_TARGET__ as addressable (was: Offloading patches (2/3): Add tables generation) Thomas Schwinge
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=87pplkna4k.fsf@kepler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=andrey.turetskiy@gmail.com \
--cc=bernds@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=iverbin@gmail.com \
--cc=jakub@redhat.com \
--cc=kirill.yukhin@gmail.com \
--cc=michael.v.zolotukhin@gmail.com \
--cc=nathan_sidwell@mentor.com \
--cc=rguenther@suse.de \
--cc=tocarip.intel@gmail.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).