diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2022-11-19 10:36:27 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2022-11-19 10:36:27 +0100 |
commit | 8c05d8cd4300f74bf2698f0a6b96464b5be571be (patch) | |
tree | 0073b1875ad14dbadafb0c083eb34434c3ad0ff3 /libgomp/plugin | |
parent | b1115dbfea4d6df51d608cece7416d658d2e2822 (diff) | |
download | gcc-8c05d8cd4300f74bf2698f0a6b96464b5be571be.zip gcc-8c05d8cd4300f74bf2698f0a6b96464b5be571be.tar.gz gcc-8c05d8cd4300f74bf2698f0a6b96464b5be571be.tar.bz2 |
libgomp/gcn: Prepare for reverse-offload callback handling
libgomp/ChangeLog:
* config/gcn/libgomp-gcn.h: New file; contains
struct output, declared previously in plugin-gcn.c.
* config/gcn/target.c: Include it.
(GOMP_ADDITIONAL_ICVS): Declare as extern var.
(GOMP_target_ext): Handle reverse offload.
* plugin/plugin-gcn.c: Include libgomp-gcn.h.
(struct kernargs): Replace struct def by the one
from libgomp-gcn.h for output_data.
(process_reverse_offload): New.
(console_output): Call it.
Diffstat (limited to 'libgomp/plugin')
-rw-r--r-- | libgomp/plugin/plugin-gcn.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index 04b122f..ffe5cf5 100644 --- a/libgomp/plugin/plugin-gcn.c +++ b/libgomp/plugin/plugin-gcn.c @@ -42,6 +42,7 @@ #include <dlfcn.h> #include <signal.h> #include "libgomp-plugin.h" +#include "config/gcn/libgomp-gcn.h" /* For struct output. */ #include "gomp-constants.h" #include <elf.h> #include "oacc-plugin.h" @@ -252,21 +253,7 @@ struct kernargs { int64_t arena_ptr; /* Output data. */ - struct output { - int return_value; - unsigned int next_output; - struct printf_data { - int written; - char msg[128]; - int type; - union { - int64_t ivalue; - double dvalue; - char text[128]; - }; - } queue[1024]; - unsigned int consumed; - } output_data; + struct output output_data; }; /* A queue entry for a future asynchronous launch. */ @@ -1931,6 +1918,19 @@ create_kernel_dispatch (struct kernel_info *kernel, int num_teams) return shadow; } +static void +process_reverse_offload (uint64_t fn, uint64_t mapnum, uint64_t rev_data, + uint64_t dev_num64) +{ + int dev_num = dev_num64; + uint64_t addrs_sizes_kinds[3]; + GOMP_OFFLOAD_host2dev (dev_num, &addrs_sizes_kinds, (void *) rev_data, + sizeof (addrs_sizes_kinds)); + GOMP_PLUGIN_target_rev (fn, mapnum, addrs_sizes_kinds[0], + addrs_sizes_kinds[1], addrs_sizes_kinds[2], + dev_num, NULL, NULL, NULL); +} + /* Output any data written to console output from the kernel. It is expected that this function is polled during kernel execution. @@ -1975,6 +1975,10 @@ console_output (struct kernel_info *kernel, struct kernargs *kernargs, case 1: printf ("%.128s%f\n", data->msg, data->dvalue); break; case 2: printf ("%.128s%.128s\n", data->msg, data->text); break; case 3: printf ("%.128s%.128s", data->msg, data->text); break; + case 4: + process_reverse_offload (data->msg_u64[0], data->msg_u64[1], + data->value_u64[0],data->value_u64[1]); + break; default: printf ("GCN print buffer error!\n"); break; } data->written = 0; |