annotate libhsail-rt/include/internal/phsa-rt.h @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* phsa-rt.h -- Data structures and functions of the PHSA device side runtime
kono
parents:
diff changeset
2 scheduler, and HSAIL built-ins.
kono
parents:
diff changeset
3
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
4 Copyright (C) 2015-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
5 Contributed by Pekka Jaaskelainen <pekka.jaaskelainen@parmance.com>
kono
parents:
diff changeset
6 for General Processor Tech.
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 Permission is hereby granted, free of charge, to any person obtaining a
kono
parents:
diff changeset
9 copy of this software and associated documentation files
kono
parents:
diff changeset
10 (the "Software"), to deal in the Software without restriction, including
kono
parents:
diff changeset
11 without limitation the rights to use, copy, modify, merge, publish,
kono
parents:
diff changeset
12 distribute, sublicense, and/or sell copies of the Software, and to
kono
parents:
diff changeset
13 permit persons to whom the Software is furnished to do so, subject to
kono
parents:
diff changeset
14 the following conditions:
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 The above copyright notice and this permission notice shall be included
kono
parents:
diff changeset
17 in all copies or substantial portions of the Software.
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
kono
parents:
diff changeset
20 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
kono
parents:
diff changeset
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
kono
parents:
diff changeset
22 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
kono
parents:
diff changeset
23 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
kono
parents:
diff changeset
24 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
kono
parents:
diff changeset
25 USE OR OTHER DEALINGS IN THE SOFTWARE.
kono
parents:
diff changeset
26 */
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 #ifndef PHSA_RT_H
kono
parents:
diff changeset
29 #define PHSA_RT_H
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 #include <stdbool.h>
kono
parents:
diff changeset
32 #include <stdint.h>
kono
parents:
diff changeset
33 #include "hsa.h"
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 #define PHSA_MAX_WG_SIZE 1024 * 10
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 /* Pointer type for the public facing kernel launcher function generated
kono
parents:
diff changeset
38 by gccbrig. This launches the actual kernel for all work groups and
kono
parents:
diff changeset
39 work items in the grid. */
kono
parents:
diff changeset
40 typedef void (*gccbrigKernelLauncherFunc) (void *context, void *);
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 /* Pointer type for kernel functions produced by gccbrig from the HSAIL.
kono
parents:
diff changeset
43 This is private from outside the device binary and only called by
kono
parents:
diff changeset
44 the launcher. */
kono
parents:
diff changeset
45 typedef void (*gccbrigKernelFunc) (unsigned char *, void *, void *, uint32_t,
kono
parents:
diff changeset
46 void *);
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 /* Context data that is passed to the kernel function, initialized
kono
parents:
diff changeset
49 by the runtime to the current launch information. The data is
kono
parents:
diff changeset
50 used by different id functions etc.
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 The struct is used by both the launcher and the targeted device,
kono
parents:
diff changeset
53 thus the fields must have the same alignment/padding in both sides.
kono
parents:
diff changeset
54 */
kono
parents:
diff changeset
55 typedef struct
kono
parents:
diff changeset
56 {
kono
parents:
diff changeset
57 /* Data set by the HSA Runtime's kernel launcher. */
kono
parents:
diff changeset
58 hsa_kernel_dispatch_packet_t *dp;
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 size_t packet_id;
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 /* Data set by the device-side launcher. */
kono
parents:
diff changeset
63 gccbrigKernelFunc kernel;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 /* The range of a work groups this dispatch should execute. */
kono
parents:
diff changeset
66 size_t wg_min_x;
kono
parents:
diff changeset
67 size_t wg_min_y;
kono
parents:
diff changeset
68 size_t wg_min_z;
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 size_t wg_max_x;
kono
parents:
diff changeset
71 size_t wg_max_y;
kono
parents:
diff changeset
72 size_t wg_max_z;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 /* The barrier used to synch the work-items before executing a new WG. */
kono
parents:
diff changeset
75 void *wg_start_barrier;
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 /* The barrier to wait at after executing a work-group. */
kono
parents:
diff changeset
78 void *wg_completion_barrier;
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 /* The barrier used to synchronize WIs in case of the 'barrier' HSAIL
kono
parents:
diff changeset
81 instruction. */
kono
parents:
diff changeset
82 void *wg_sync_barrier;
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 /* This should be set to the flat address of the beginning of the group
kono
parents:
diff changeset
85 segment. */
kono
parents:
diff changeset
86 size_t group_segment_start_addr;
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 /* This must be set to the correct aligned flat address space location from
kono
parents:
diff changeset
89 where the kernel can actually read its arguments. Might point to the
kono
parents:
diff changeset
90 original global kernarg space. */
kono
parents:
diff changeset
91 void *kernarg_addr;
kono
parents:
diff changeset
92 } PHSAKernelLaunchData;
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 #endif