Skip to content

Commit 8338fe1

Browse files
committed
lint: the rule covers every routine level, not only seq
1 parent 65055ef commit 8338fe1

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

docs/documentation/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Both human reviewers and AI code reviewers reference this section.
181181
- **`stp` vs `wp` mixing:** In mixed-precision mode, `stp` (storage) may be half-precision while `wp` (working) is double. Conversions between them must be intentional, especially in MPI pack/unpack and RHS accumulation.
182182
- **No double-precision intrinsics:** `dsqrt`, `dexp`, `dlog`, `dble`, `dabs`, `real(8)`, `real(4)` are forbidden. Use generic intrinsics with `wp` kind.
183183
- **MPI type matching:** `mpi_p` must match `wp`; `mpi_io_p` must match `stp`. Mismatches corrupt communicated data.
184-
- **Scalars into device routines that loop:** a `GPU_ROUTINE` containing a ``GPU_LOOP(parallelism='[seq]')`` (itself or through what it calls) must be called with scalars, never an array element (`q%%sf(j,k,l)`, `alpha(i)`). Copy the element to a local first and receive results into a local. Cray OpenACC 19 to 21 miscompiles the pair silently ([#1815](https://github.com/MFlowCode/MFC/issues/1815)); the linter enforces it inside kernels and device routines.
184+
- **Scalars into device routines that loop:** a `GPU_ROUTINE` containing any `GPU_LOOP` (itself or through what it calls) must be called with scalars, never an array element (`q%%sf(j,k,l)`, `alpha(i)`). Copy the element to a local first and receive results into a local. Cray OpenACC 19 to 21 miscompiles the pair silently at every routine level, OpenMP offload does not ([#1815](https://github.com/MFlowCode/MFC/issues/1815)); the linter enforces it inside kernels and device routines.
185185

186186
### Memory and Allocation
187187

toolchain/mfc/lint_source.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,10 @@ def _procedures(lines: list[str]):
621621
def check_device_routine_element_args(repo_root: Path) -> list[str]:
622622
"""Flag an array element passed to a device routine that runs a seq loop.
623623
624-
CCE OpenACC (19.0.0 through 21.0.2, -O2) miscompiles the pair: a routine containing
625-
`GPU_LOOP(parallelism='[seq]')`, called with an array element as an actual argument, reads
626-
the element as garbage and never writes it back. Either alone is fine. The loop counts
627-
when it sits in anything the routine calls, since CCE inlines the chain. Copy the element
624+
CCE OpenACC (19.0.0 through 21.0.2, -O2; OpenMP offload is correct) miscompiles the pair: a
625+
routine containing any `GPU_LOOP`, called with an array element as an actual argument, reads
626+
the element as garbage and never writes it back. Either alone is fine, every `routine` level
627+
is affected, and the loop counts when it sits in anything the routine calls. Copy the element
628628
to a scalar before the call and receive results into a scalar. See
629629
.claude/rules/common-pitfalls.md and sbryngelson/compiler-bugs cce/acc-routine-element-by-reference.
630630
"""

0 commit comments

Comments
 (0)