Discussion:
[PATCH, OpenACC] Enable GOMP_MAP_FIRSTPRIVATE_INT for OpenACC
Julian Brown
2018-12-06 22:40:41 UTC
Permalink
On Tue, 4 Dec 2018 15:27:12 +0100
gcc/
* omp-low.c (maybe_lookup_field_in_outer_ctx): New function.
(convert_to_firstprivate_int): New function.
(convert_from_firstprivate_int): New function.
(lower_omp_target): Enable GOMP_MAP_FIRSTPRIVATE_INT in
OpenACC.
libgomp/
* oacc-parallel.c (GOACC_parallel_keyed): Handle
GOMP_MAP_FIRSTPRIVATE_INT host addresses.
* plugin/plugin-nvptx.c (nvptx_exec): Handle
GOMP_MAP_FIRSTPRIVATE_INT host addresses.
* testsuite/libgomp.oacc-c++/firstprivate-int.C: New test.
New test.
* testsuite/libgomp.oacc-fortran/firstprivate-int.f90: New
test.
@@ -8039,7 +8182,7 @@ lower_omp_target (gimple_stmt_iterator
*gsi_p, omp_context *ctx) if (omp_is_reference (ovar))
type = TREE_TYPE (type);
if ((INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (type) <= POINTER_SIZE)
+ && tree_to_uhwi (TYPE_SIZE (type)) <=
POINTER_SIZE) || TREE_CODE (type) == POINTER_TYPE)
{
tkind = GOMP_MAP_FIRSTPRIVATE_INT;
@@ -8194,7 +8337,7 @@ lower_omp_target (gimple_stmt_iterator
*gsi_p, omp_context *ctx) if (omp_is_reference (var))
type = TREE_TYPE (type);
if ((INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (type) <= POINTER_SIZE)
+ && tree_to_uhwi (TYPE_SIZE (type)) <=
POINTER_SIZE) || TREE_CODE (type) == POINTER_TYPE)
{
x = build_receiver_ref (var, false, ctx);
Why this?
My *guess* is that it was an attempt to handle cases where the type
precision is less than the type size, and maybe it was feared that
type-punning to an int would then copy the wrong bits. Those changes
appear to not have been necessary though, at least with respect to
testsuite coverage. I also fixed the Fortran test to use "STOP n"
instead of "call abort".

I re-tested the attached with offloading to nvptx. OK?

Thanks,

Julian
Jakub Jelinek
2018-12-07 14:05:46 UTC
Permalink
+ && (TREE_CODE (inner_type) == REAL_TYPE
+ || (!omp_is_reference (var)
+ && INTEGRAL_TYPE_P (inner_type))
+ || TREE_CODE (inner_type) == INTEGER_TYPE)
Not sure I understand the above. INTEGRAL_TYPE_P is INTEGER_TYPE,
BOOLEAN_TYPE and ENUMERAL_TYPE, so you want to handle INTEGER_TYPE
no magger whether var should be passed by reference or not, but BOOLEAN_TYPE
or ENUMERAL_TYPE only if it is not a reference?
That is just weird. Any test to back that up?
+ if ((TREE_CODE (inner_type) == REAL_TYPE
+ || (!omp_is_reference (var)
+ && INTEGRAL_TYPE_P (inner_type))
+ || TREE_CODE (inner_type) == INTEGER_TYPE)
Ditto here.

Jakub

Loading...