*PING*

On 6/24/20 7:32 PM, Tobias Burnus wrote:
(OpenMP 5 extends this a lot, but this is about OpenMP 4.5.
It touches code which is also used by OpenACC's attach/detach.)

@OpenACC/Julian: I think the character attach/detach for
deferred-length strings does not work properly with OpenACC;
I did not touch this code – but I think it needs some love.

This code adds support for
  map(dt%comp, dt%comp2)
where "comp" can be either a nonpointer, nonallocatable element
scalar, array or array section. Or it can be a pointer - where
character strings are one complication as for deferred-length
ones, the length is stored in an extra DT component.

While testing, I encountered two bugs, one relating to kind=4
character string (patch pending review; PR95837)
not part of testcase) and one related to deferred-length
character strings (commented in the test case; larger issue;
PR95868).

Like always, some more tests/testcase probably would not harm.

Regarding the patch:

(a) openmp.c:
This enabled component matching for 'map(' and
piggybacks on the OpenACC code for the checks. I think that
some additional checks might be useful – and I hope that no
check is too strict.
The "depend" clause was excluded as one otherwise gets a
testsuite fails due to the is-contiguous check.

(b) trans-openmp.c:
- gfc_trans_omp_clauses now has a "bool openacc".
- GOMP_MAP_ATTACH_DETACH is replaced by GOMP_MAP_ALWAYS_POINTER
- For arrays, the mapping of the descriptor is squeezed before
  "node" which contains the data transfer (var.desc.data mapping
  followed by the always_pointer for the mapping).
  In this array case, the latter gets a pointless cast in order
  to prevent that for both var.desc and var.desc.data memory gets
  allocated in the struct.
  → That's also the reason the big switch table is moved up.
- For deferred-length strings, the string-length is in an extra
  struct element (derived-type component) and will be mapped in
  addition.
- Bugs in the previous version:
  * gfc_trans_omp_array_section for "element == true", the size
    of a pointer instead of the size of the element was mapped.
  * For string variables (with constant length) the kind=4 was
    not properly handled.
  * Allocatable scalars were not handled – missing second clause
    for the always_pointer (and attach_detach, I assume)

Comments, remarks, suggestions?
Otherwise: OK for the trunk?

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter

Reply via email to