+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>
* target.def (constant_alignment): New hook.
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BARRIER, BRIG_OPCODE_BARRIER,
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,
BRIG_TYPE_NONE, "__hsail_initfbar", BT_FN_VOID_UINT_PTR,
DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WAITFBAR, BRIG_OPCODE_WAITFBAR,
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,
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,
BRIG_TYPE_NONE, "__hsail_leavefbar", BT_FN_VOID_UINT_PTR,
+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>
* Make-lang.in (GO_TEXI_FILES): Rename to...
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
brig_to_generic::append_private_variable (const std::string &name,
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 ?
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_private_offsets[name] = m_next_private_offset;
- m_next_private_offset += size;
- m_private_data_sizes[name] = size + align_padding;
+ m_next_private_offset += size + per_var_padding;
}
size_t
+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>
* rt/workitems.c: Removed a leftover comment.
hsa_kernel_dispatch_packet_t *dp = context->dp;
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;
/* HSA seems to allow the WG size to be larger than the grid size. We need to
phsa_execute_wi_gang (context, group_base_ptr, sat_wg_size_x, sat_wg_size_y,
sat_wg_size_z);
-
- if (dp->group_segment_size > 0)
- free (group_base_ptr);
}
#endif
hsa_kernel_dispatch_packet_t *dp = context->dp;
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;
/* HSA seems to allow the WG size to be larger than the grid size. We need
printf ("### %lu WIs executed in %lu s (%lu WIs / s)\n", wi_total,
(uint64_t) spent_time_sec, (uint64_t) wis_per_sec);
#endif
-
- if (dp->group_segment_size > 0)
- free (group_base_ptr);
-
free (private_base_ptr);
private_base_ptr = NULL;
}