mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-11 04:30:15 +08:00
BRIGFE fixes:
* brig-builtins.def: Treat HSAIL barrier builtins as setjmp/longjump style functions. * brigfrontend/brig-to-generic.cc: Ensure per WI copies of private variables are aligned too. * rt/workitems.c: Assume the host runtime allocates the work group memory. From-SVN: r253160
This commit is contained in:
parent
15e2333010
commit
c02bffe38a
@ -1,3 +1,8 @@
|
|||||||
|
2017-09-25 Pekka Jaaskelainen <pekka@parmance.com>
|
||||||
|
|
||||||
|
* brig-builtins.def: Treat HSAIL barrier builtins as
|
||||||
|
setjmp/longjump style functions.
|
||||||
|
|
||||||
2017-09-25 Richard Sandiford <richard.sandiford@linaro.org>
|
2017-09-25 Richard Sandiford <richard.sandiford@linaro.org>
|
||||||
|
|
||||||
* target.def (constant_alignment): New hook.
|
* target.def (constant_alignment): New hook.
|
||||||
|
@ -240,7 +240,7 @@ DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_FRACT_F64, BRIG_OPCODE_FRACT,
|
|||||||
|
|
||||||
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BARRIER, BRIG_OPCODE_BARRIER,
|
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BARRIER, BRIG_OPCODE_BARRIER,
|
||||||
BRIG_TYPE_NONE, "__hsail_barrier", BT_FN_VOID_PTR,
|
BRIG_TYPE_NONE, "__hsail_barrier", BT_FN_VOID_PTR,
|
||||||
ATTR_NOTHROW_LIST)
|
ATTR_RT_NOTHROW_LEAF_LIST)
|
||||||
|
|
||||||
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_INITFBAR, BRIG_OPCODE_INITFBAR,
|
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_INITFBAR, BRIG_OPCODE_INITFBAR,
|
||||||
BRIG_TYPE_NONE, "__hsail_initfbar", BT_FN_VOID_UINT_PTR,
|
BRIG_TYPE_NONE, "__hsail_initfbar", BT_FN_VOID_UINT_PTR,
|
||||||
@ -252,11 +252,11 @@ DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_JOINFBAR, BRIG_OPCODE_JOINFBAR,
|
|||||||
|
|
||||||
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WAITFBAR, BRIG_OPCODE_WAITFBAR,
|
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WAITFBAR, BRIG_OPCODE_WAITFBAR,
|
||||||
BRIG_TYPE_NONE, "__hsail_waitfbar", BT_FN_VOID_UINT_PTR,
|
BRIG_TYPE_NONE, "__hsail_waitfbar", BT_FN_VOID_UINT_PTR,
|
||||||
ATTR_NOTHROW_LIST)
|
ATTR_RT_NOTHROW_LEAF_LIST)
|
||||||
|
|
||||||
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_ARRIVEFBAR, BRIG_OPCODE_ARRIVEFBAR,
|
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_ARRIVEFBAR, BRIG_OPCODE_ARRIVEFBAR,
|
||||||
BRIG_TYPE_NONE, "__hsail_arrivefbar", BT_FN_VOID_UINT_PTR,
|
BRIG_TYPE_NONE, "__hsail_arrivefbar", BT_FN_VOID_UINT_PTR,
|
||||||
ATTR_NOTHROW_LIST)
|
ATTR_RT_NOTHROW_LEAF_LIST)
|
||||||
|
|
||||||
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_LEAVEFBAR, BRIG_OPCODE_LEAVEFBAR,
|
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_LEAVEFBAR, BRIG_OPCODE_LEAVEFBAR,
|
||||||
BRIG_TYPE_NONE, "__hsail_leavefbar", BT_FN_VOID_UINT_PTR,
|
BRIG_TYPE_NONE, "__hsail_leavefbar", BT_FN_VOID_UINT_PTR,
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2017-05-13 Pekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
|
||||||
|
|
||||||
|
* brigfrontend/brig-to-generic.cc: Ensure per WI copies of
|
||||||
|
private variables are aligned too.
|
||||||
|
|
||||||
2017-09-17 Thomas Schwinge <thomas@codesourcery.com>
|
2017-09-17 Thomas Schwinge <thomas@codesourcery.com>
|
||||||
|
|
||||||
* Make-lang.in (GO_TEXI_FILES): Rename to...
|
* Make-lang.in (GO_TEXI_FILES): Rename to...
|
||||||
|
@ -599,18 +599,34 @@ brig_to_generic::group_segment_size () const
|
|||||||
return m_next_group_offset;
|
return m_next_group_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Appends a new group variable to the current kernel's private segment. */
|
/* Appends a new variable to the current kernel's private segment. */
|
||||||
|
|
||||||
void
|
void
|
||||||
brig_to_generic::append_private_variable (const std::string &name,
|
brig_to_generic::append_private_variable (const std::string &name,
|
||||||
size_t size, size_t alignment)
|
size_t size, size_t alignment)
|
||||||
{
|
{
|
||||||
|
/* We need to take care of two cases of alignment with private
|
||||||
|
variables because of the layout where the same variable for
|
||||||
|
each work-item is laid out in successive addresses.
|
||||||
|
|
||||||
|
1) Ensure the first work-item's variable is in an aligned
|
||||||
|
offset: */
|
||||||
size_t align_padding = m_next_private_offset % alignment == 0 ?
|
size_t align_padding = m_next_private_offset % alignment == 0 ?
|
||||||
0 : (alignment - m_next_private_offset % alignment);
|
0 : (alignment - m_next_private_offset % alignment);
|
||||||
|
|
||||||
|
/* 2) Each successive per-work-item copy should be aligned.
|
||||||
|
If the variable has wider alignment than size then we need
|
||||||
|
to add extra padding to ensure it. The padding must be
|
||||||
|
included in the size to allow per-work-item offset computation
|
||||||
|
to find their own aligned copy. */
|
||||||
|
|
||||||
|
size_t per_var_padding = size % alignment == 0 ?
|
||||||
|
0 : (alignment - size % alignment);
|
||||||
|
m_private_data_sizes[name] = size + per_var_padding;
|
||||||
|
|
||||||
m_next_private_offset += align_padding;
|
m_next_private_offset += align_padding;
|
||||||
m_private_offsets[name] = m_next_private_offset;
|
m_private_offsets[name] = m_next_private_offset;
|
||||||
m_next_private_offset += size;
|
m_next_private_offset += size + per_var_padding;
|
||||||
m_private_data_sizes[name] = size + align_padding;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2017-09-25 Pekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
|
||||||
|
|
||||||
|
* rt/workitems.c: Assume the host runtime allocates the work group
|
||||||
|
memory.
|
||||||
2017-05-03 Pekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
|
2017-05-03 Pekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
|
||||||
|
|
||||||
* rt/workitems.c: Removed a leftover comment.
|
* rt/workitems.c: Removed a leftover comment.
|
||||||
|
@ -318,14 +318,6 @@ phsa_spawn_work_items (PHSAKernelLaunchData *context, void *group_base_ptr)
|
|||||||
hsa_kernel_dispatch_packet_t *dp = context->dp;
|
hsa_kernel_dispatch_packet_t *dp = context->dp;
|
||||||
size_t x, y, z;
|
size_t x, y, z;
|
||||||
|
|
||||||
/* TO DO: host-side memory management of group and private segment
|
|
||||||
memory. Agents in general are less likely to support efficient dynamic mem
|
|
||||||
allocation. */
|
|
||||||
if (dp->group_segment_size > 0
|
|
||||||
&& posix_memalign (&group_base_ptr, PRIVATE_SEGMENT_ALIGN,
|
|
||||||
dp->group_segment_size) != 0)
|
|
||||||
phsa_fatal_error (3);
|
|
||||||
|
|
||||||
context->group_segment_start_addr = (size_t) group_base_ptr;
|
context->group_segment_start_addr = (size_t) group_base_ptr;
|
||||||
|
|
||||||
/* HSA seems to allow the WG size to be larger than the grid size. We need to
|
/* HSA seems to allow the WG size to be larger than the grid size. We need to
|
||||||
@ -371,9 +363,6 @@ phsa_spawn_work_items (PHSAKernelLaunchData *context, void *group_base_ptr)
|
|||||||
|
|
||||||
phsa_execute_wi_gang (context, group_base_ptr, sat_wg_size_x, sat_wg_size_y,
|
phsa_execute_wi_gang (context, group_base_ptr, sat_wg_size_x, sat_wg_size_y,
|
||||||
sat_wg_size_z);
|
sat_wg_size_z);
|
||||||
|
|
||||||
if (dp->group_segment_size > 0)
|
|
||||||
free (group_base_ptr);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -390,14 +379,6 @@ phsa_execute_work_groups (PHSAKernelLaunchData *context, void *group_base_ptr)
|
|||||||
hsa_kernel_dispatch_packet_t *dp = context->dp;
|
hsa_kernel_dispatch_packet_t *dp = context->dp;
|
||||||
size_t x, y, z, wg_x, wg_y, wg_z;
|
size_t x, y, z, wg_x, wg_y, wg_z;
|
||||||
|
|
||||||
/* TODO: host-side memory management of group and private segment
|
|
||||||
memory. Agents in general are less likely to support efficient dynamic mem
|
|
||||||
allocation. */
|
|
||||||
if (dp->group_segment_size > 0
|
|
||||||
&& posix_memalign (&group_base_ptr, GROUP_SEGMENT_ALIGN,
|
|
||||||
dp->group_segment_size) != 0)
|
|
||||||
phsa_fatal_error (3);
|
|
||||||
|
|
||||||
context->group_segment_start_addr = (size_t) group_base_ptr;
|
context->group_segment_start_addr = (size_t) group_base_ptr;
|
||||||
|
|
||||||
/* HSA seems to allow the WG size to be larger than the grid size. We need
|
/* HSA seems to allow the WG size to be larger than the grid size. We need
|
||||||
@ -509,10 +490,6 @@ phsa_execute_work_groups (PHSAKernelLaunchData *context, void *group_base_ptr)
|
|||||||
printf ("### %lu WIs executed in %lu s (%lu WIs / s)\n", wi_total,
|
printf ("### %lu WIs executed in %lu s (%lu WIs / s)\n", wi_total,
|
||||||
(uint64_t) spent_time_sec, (uint64_t) wis_per_sec);
|
(uint64_t) spent_time_sec, (uint64_t) wis_per_sec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dp->group_segment_size > 0)
|
|
||||||
free (group_base_ptr);
|
|
||||||
|
|
||||||
free (private_base_ptr);
|
free (private_base_ptr);
|
||||||
private_base_ptr = NULL;
|
private_base_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user