Bug
In src/common/include/omp_macros.fpp, the dedicated attach generator is commented out:
#! #:def OMP_ATTACH_STR(attach)
#! #:set attach_val = OMP_MAP_STR('always,to', attach)
#! $:attach_val
and the live path in OMP_PARALLEL_LOOP (line 135) renders it differently:
#:set attach_val = OMP_MAP_STR('always,tofrom', attach)
OpenACC's attach only fixes up device pointers within an aggregate that is already present;
it performs no data transfer, and certainly no copy-back. The OpenMP branch emits
map(always,tofrom:), which forces an unconditional host→device and device→host transfer
on every launch.
So the same GPU_PARALLEL_LOOP(..., attach='[...]') call means two different things depending
on backend: a pointer fix-up under OpenACC, a full round-trip copy under OpenMP. Besides the
performance cost, a copy-back can overwrite device-side updates with stale host data.
Suggested fix
Either restore the commented-out generator (always,to, matching the intent), or — closer to
OpenACC semantics — emit no map at all for attach and rely on the aggregate already being
present, since attach is a pointer-attachment operation rather than a data-movement one.
Context
Found during a systematic ACC-vs-OMP differential audit of the macro layer while porting MFC
to CCE 21 on Frontier. Two other divergences of the same shape have already been found in this
layer:
The pattern is that the OpenMP branch does more than the OpenACC branch means. A full audit
of the remaining clauses is worthwhile; the stubs at omp_macros.fpp:36 (default='none'),
:261 and :318 are the other known gaps.
Bug
In
src/common/include/omp_macros.fpp, the dedicatedattachgenerator is commented out:and the live path in
OMP_PARALLEL_LOOP(line 135) renders it differently:OpenACC's
attachonly fixes up device pointers within an aggregate that is already present;it performs no data transfer, and certainly no copy-back. The OpenMP branch emits
map(always,tofrom:), which forces an unconditional host→device and device→host transferon every launch.
So the same
GPU_PARALLEL_LOOP(..., attach='[...]')call means two different things dependingon backend: a pointer fix-up under OpenACC, a full round-trip copy under OpenMP. Besides the
performance cost, a copy-back can overwrite device-side updates with stale host data.
Suggested fix
Either restore the commented-out generator (
always,to, matching the intent), or — closer toOpenACC semantics — emit no map at all for
attachand rely on the aggregate already beingpresent, since
attachis a pointer-attachment operation rather than a data-movement one.Context
Found during a systematic ACC-vs-OMP differential audit of the macro layer while porting MFC
to CCE 21 on Frontier. Two other divergences of the same shape have already been found in this
layer:
defaultmap(firstprivate:scalar)emitted unconditionally, which CCE 21 lets override anexplicit
map(to:)(compiler defect, but MFC only exposes it because of this clause)no_createaccepted by the macro API but#:stop-ed in the OpenMP layer (GPU_PARALLEL_LOOP advertises no_create but OMP_NOCREATE_STR aborts fypp, breaking OpenACC-only builds #1687)The pattern is that the OpenMP branch does more than the OpenACC branch means. A full audit
of the remaining clauses is worthwhile; the stubs at
omp_macros.fpp:36(default='none'),:261and:318are the other known gaps.