[BRIGFE] The modulo in ID computation should not be needed.

The case where a dim is greater than the grid size doesn't seem
to be mentioned in the specs nor tested by PRM test suite.

From-SVN: r259944
This commit is contained in:
Pekka Jääskeläinen 2018-05-04 16:47:34 +00:00 committed by Pekka Jääskeläinen
parent 637f3cdec3
commit f986735ac5
2 changed files with 6 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2018-05-04 Pekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
* brig/brigfrontend/brig-code-entry-handler.cc: The modulo in
ID computation should not be needed.
2018-05-04 Pekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
* brig/brig-lang.c: Add support for whole program

View File

@ -1048,7 +1048,6 @@ brig_code_entry_handler::expand_builtin (BrigOpcode16_t brig_opcode,
tree local_id_var = m_parent.m_cf->m_local_id_vars[dim];
tree wg_id_var = m_parent.m_cf->m_wg_id_vars[dim];
tree wg_size_var = m_parent.m_cf->m_wg_size_vars[dim];
tree grid_size_var = m_parent.m_cf->m_grid_size_vars[dim];
tree wg_id_x_wg_size = build2 (MULT_EXPR, uint32_type_node,
convert (uint32_type_node, wg_id_var),
@ -1056,15 +1055,8 @@ brig_code_entry_handler::expand_builtin (BrigOpcode16_t brig_opcode,
tree sum
= build2 (PLUS_EXPR, uint32_type_node, wg_id_x_wg_size, local_id_var);
/* We need a modulo here because of work-groups which have dimensions
larger than the grid size :( TO CHECK: is this really allowed in the
specs? */
tree modulo
= build2 (TRUNC_MOD_EXPR, uint32_type_node, sum, grid_size_var);
return add_temp_var (std::string ("workitemabsid_")
+ (char) ((int) 'x' + dim),
modulo);
+ (char) ((int) 'x' + dim), sum);
}
else if (brig_opcode == BRIG_OPCODE_WORKITEMFLATID)
{