Observed issues › nested/afar-flang-pointer-root-allocatable-component-enter-data-fault
AFAR: pointer-root derived type with allocatable component faults in copy mode
Legality: independently confirmed. One independent reading was uncertain; 2 adjudicating readings that weighed both find the program legal and the result required: r is an associated pointer in a map clause, so its pointer target is implicitly mapped in the same clause, using the predefined default mapper, which maps each structure element including the allocated component a. The loop touches distinct elements and tot is a reduction, so tot=828 and sum=884 follow. The memory fault is a compiler or runtime defect. How this is checked
AFAR faults in copy mode on a Fortran pointer to a derived type with an allocatable component entered by enter data.
Affected variants
| Compiler | MI300A gfx942 unified memory (XNACK 1) | MI300A gfx942 copy (XNACK 0) | MI250X gfx90a copy (XNACK 0) | MI300X gfx942 copy (XNACK 0) | MI350X gfx950 copy (XNACK 0) | A100 sm_80 separate memory | A100 sm_80 managed memory |
|---|---|---|---|---|---|---|---|
| AFAR 24.3.0 | correct | behaves incorrectly | unknown not run | behaves incorrectly | behaves incorrectly | n/a | n/a |
| CCE 19.0.0 | correct | correct | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | correct | correct | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | correct | correct | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | correct | correct | unknown not run | unknown not run | unknown not run | n/a | n/a |
| NVHPC 25.11 | n/a | n/a | n/a | n/a | n/a | fails another way | correct |
| NVHPC 26.9 | n/a | n/a | n/a | n/a | n/a | fails another way | correct |
| GCC 16.2.0 | correct | correct | correct | correct | correct | correct | n/a |
"behaves incorrectly" / "not supported": this issue, confirmed in up to four environments (another build directory, another node, a repeat). "fails another way": a different failure, not counted as this issue. "unknown": not run there, or the runs disagree.
Messages
| Result | Compiler and GPU | Message |
|---|---|---|
| behaves incorrectly | AFAR 24.3.0, MI300A copy | showWarning: Queue error - HSA_STATUS_ERROR_MEMORY_FAULT Display last 2 kernels launched: Kernel 0: 'omp target in _QQmain @ 55 (__omp_offloading_14_13ca78a__QQmain_l55)' Kernel 1: 'omp target in _QQmain @ 45 (__omp_offloading_14_13ca78a__QQmain_l45)' Use 'OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=<num>' to adjust the number of shown stack traces (0 now, up to 8) OFFLOAD ERROR: memory access fault by GPU 5 (agent 0x5555556d55a0) at virtual address 0x555555b59000. Reasons: Unknown (0) Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations |
| behaves incorrectly | AFAR 24.3.0, MI300X | showWarning: Queue error - HSA_STATUS_ERROR_MEMORY_FAULT Display last 2 kernels launched: Kernel 0: 'omp target in _QQmain @ 100 (__omp_offloading_fc10_20250d6__QQmain_l100)' Kernel 1: 'omp target in _QQmain @ 90 (__omp_offloading_fc10_20250d6__QQmain_l90)' Use 'OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=<num>' to adjust the number of shown stack traces (0 now, up to 8) OFFLOAD ERROR: memory access fault by GPU 1 (agent 0x555877a5f770) at virtual address 0x555877bf4000. Reasons: Unknown (0) Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations timeout: the monitored command dumped core |
| behaves incorrectly | AFAR 24.3.0, MI350X | showWarning: Queue error - HSA_STATUS_ERROR_MEMORY_FAULT Display last 2 kernels launched: Kernel 0: 'omp target in _QQmain @ 100 (__omp_offloading_fc10_4bd0__QQmain_l100)' Kernel 1: 'omp target in _QQmain @ 90 (__omp_offloading_fc10_4bd0__QQmain_l90)' Use 'OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=<num>' to adjust the number of shown stack traces (0 now, up to 8) OFFLOAD ERROR: memory access fault by GPU 1 (agent 0x564f2c60ed30) at virtual address 0x564f2c789000. Reasons: Unknown (0) Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations timeout: the monitored command dumped core |
| fails another way | NVHPC 25.11, A100 separate NVHPC 26.9, A100 separate | showFailing in Thread:1 Accelerator Fatal Error: call to cuMemcpyDtoHAsync returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution File: <dir> Function: t:35 Line: 60 |
Reproduce
AFAR 24.3.0, MI300A copy
$AFAR/bin/amdflang -fopenmp --offload-arch=gfx942 -O2 repro.f90 -o repro HSA_XNACK=0 OMP_TARGET_OFFLOAD=mandatory ./repro
CCE 19.0.0, MI300A unified (runs correctly)
module load cce/19.0.0 craype-accel-amd-gfx942 rocm/6.4.3 module unload cray-mpich ftn -fopenmp -O2 repro.f90 -o repro HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (111 lines)
! # Finding (nested-data): AFAR flang, copy mode: a derived-type object reached through a pointer (the root, or a pointer
! # component) with an allocatable component, mapped by enter data, makes the kernel fault
!
! - toolchains and modes that fail: afar (AFAR 24.3.0); modes: copy; -O2
! - build: amdflang -fopenmp --offload-arch=gfx942 -O2
! - failure: crash
! - observed: `Warning: Queue error - HSA_STATUS_ERROR_MEMORY_FAULT` (killed by signal 6); identical signature on 1 of 1 failing
! cells
! - expected: compiles and prints `tot= 828`, `sum= 884` with `check=pass`
! - rule: the structure is mapped by the target enter data directive and "If a variable is not a scalar then it is
! treated as if it had appeared in a map clause with a map-type of tofrom" (5.2 §5.8.1 p.149 l.4-5), so a reference in
! the later target region finds it present; an allocatable component of a mapped derived type is mapped with it by the
! predefined default mapper (5.2 §5.8.2 p.150 l.2-4)
! - same-compiler control: controls/m2-ctl-variable-root.f90 (one change from this file; correct on afar (AFAR 24.3.0); rows
! results/nested/red/tuo3.jsonl, results/nested/red/wgs.jsonl, results/nested/red/wnv.jsonl);
! controls/m3-ctl-fixed-array-component.f90 (one change from this file; correct on afar (AFAR 24.3.0); rows
! results/nested/red/tuo3.jsonl, results/nested/red/wgs.jsonl, results/nested/red/wnv.jsonl); controls/m5-ctl-no-enter-data.f90
! (one change from this file; correct on afar (AFAR 24.3.0); rows results/nested/red/tuo3.jsonl, results/nested/red/wgs.jsonl,
! results/nested/red/wnv.jsonl); controls/q2-ctl-fixed-array.f90 (one change from this file; correct on afar (AFAR 24.3.0); rows
! results/nested/red/tuo11.jsonl, results/nested/red/wgs.jsonl, results/nested/red/wnv.jsonl);
! controls/q3-ctl-allocatable-component-of-the-variable.f90 (one change from this file; correct on afar (AFAR 24.3.0); rows
! results/nested/red/tuo11.jsonl, results/nested/red/wgs.jsonl, results/nested/red/wnv.jsonl)
! - other families: cce19 (CCE 19.0.0), cce20 (CCE 20.0.2), cce21 (CCE 21.0.3), cce21_4 (CCE 21.0.4), nvhpc (NVHPC 25.11), nvhpc269
! (NVHPC 26.9), gcc_g90 (GCC 16.2.0), gcc_sm80 (GCC 16.2.0) run the file correctly in managed mode (rows
! results/nested/red/red7.jsonl, results/nested/red/tuo2.jsonl, results/nested/red/tuo3.jsonl, results/nested/red/tuo6.jsonl,
! results/nested/red/wgs.jsonl, results/nested/red/wnv.jsonl, site rows, check case
! site-nested--afar-flang-pointer-root-allocatable-component-enter-data-fault); nvhpc (NVHPC 25.11), nvhpc269 (NVHPC 26.9) fail it
! another way in copy mode, e.g. `Failing in Thread:1`
! - gate and confirmer: campaign gate of the programs below: 123 cells, 123 confirmed in the four environments (a-d; (c) on another
! node or GPU; rows results/nested/big/gate_reruns.part.<host>.3222831.jsonl,
! results/nested/big/gate_reruns.part.<host>.1040717.jsonl, results/nested/big/gate_reruns.part.<host>.1251749.jsonl,
! results/nested/big/gate_reruns.part.<host>.1434668.jsonl, results/nested/big/rows.part.<host>.1956389.jsonl,
! results/nested/big/rows.part.<host>.1523848.jsonl, results/nested/big/rows.part.<host>.1197409.jsonl,
! results/nested/main/gate_reruns.part.<host>.961942.jsonl, results/nested/main/gate_reruns.part.<host>.919396.jsonl,
! results/nested/main/gate_reruns.part.<host>.3910568.jsonl,
! results/nested/main/gate_reruns.part.<host>.4072524.jsonl, results/nested/main/rows.part.<host>.994167.jsonl)
! - programs (123): nd-f-omp-always-chain-d2-0b79aaa6, nd-f-omp-always-chain-d2-5b08a1dd, nd-f-omp-always-chain-d2-75ca3965,
! nd-f-omp-always-chain-d2-a1106ec3, nd-f-omp-always-chain-d2-af297865, nd-f-omp-always-chain-d2-b1ac0170,
! nd-f-omp-always-chain-d2-c87159f0, nd-f-omp-always-chain-d2-c931e678, nd-f-omp-always-chain-d3-0a19c378,
! nd-f-omp-always-chain-d3-23f3159f, nd-f-omp-always-chain-d3-6429d1f2, nd-f-omp-always-chain-d3-a2c50d15,
! nd-f-omp-always-chain-d3-d619d8f3, nd-f-omp-always-chain-d3-e6c04585, nd-f-omp-always-list-d2-1a3866f8,
! nd-f-omp-close-chain-d2-23d11b6c, nd-f-omp-close-chain-d2-53ab37a7, nd-f-omp-close-chain-d3-6805e4ee,
! nd-f-omp-close-chain-d3-7d95925f, nd-f-omp-close-chain-d3-9c214397, nd-f-omp-close-tree-d2-77fe8f90,
! nd-f-omp-enter-chain-d1-b2c324d9, nd-f-omp-enter-chain-d2-02ac29dd, nd-f-omp-enter-chain-d2-3197d0a8,
! nd-f-omp-enter-chain-d2-3be528ec, nd-f-omp-enter-chain-d2-446a7bbe, nd-f-omp-enter-chain-d2-6f9da85d,
! nd-f-omp-enter-chain-d2-a22671ae, nd-f-omp-enter-chain-d2-b1679c00, nd-f-omp-enter-chain-d2-b668ef1a,
! nd-f-omp-enter-chain-d2-c4de674a, nd-f-omp-enter-chain-d2-c8d85554, nd-f-omp-enter-chain-d2-cee2a3ae,
! nd-f-omp-enter-chain-d2-cf1e37c5, nd-f-omp-enter-chain-d2-ff520002, nd-f-omp-enter-chain-d3-0b3bdece,
! nd-f-omp-enter-chain-d3-181eb7ae, nd-f-omp-enter-chain-d3-27fc4e52, nd-f-omp-enter-chain-d3-5f7d1cd9,
! nd-f-omp-enter-chain-d3-6d18ea3c, nd-f-omp-enter-chain-d3-77e3bd5d, nd-f-omp-enter-chain-d3-8b826b39,
! nd-f-omp-enter-chain-d3-a54517a7, nd-f-omp-enter-chain-d3-e0125bfa, nd-f-omp-enter-list-d3-9b3ce758,
! nd-f-omp-enter-list-d4-880965d5, nd-f-omp-enter-tree-d2-15fff1f4, nd-f-omp-enter-tree-d2-c78514c5,
! nd-f-omp-mapper-chain-d1-0d36f37d, nd-f-omp-mapper-chain-d2-15137215, nd-f-omp-mapper-chain-d2-90256a87,
! nd-f-omp-mapper-chain-d2-b48755f6, nd-f-omp-mapper-chain-d2-c224f613, nd-f-omp-mapper-chain-d2-c26a1f3c,
! nd-f-omp-mapper_enter-chain-d2-194e7b57, nd-f-omp-mapper_enter-chain-d2-42baa788, nd-f-omp-mapper_enter-chain-d2-58989314,
! nd-f-omp-mapper_enter-chain-d2-843af8df, nd-f-omp-mapper_enter-chain-d2-a42fde14, nd-f-omp-mapper_enter-chain-d2-d66c239d,
! nd-f-omp-one-chain-d2-195ea825, nd-f-omp-one-chain-d2-1a15b55c, nd-f-omp-one-chain-d2-2a889054, nd-f-omp-one-chain-d2-30e18d0f,
! nd-f-omp-one-chain-d2-db9b2606, nd-f-omp-one-chain-d3-4df89a9f, nd-f-omp-one-chain-d3-7d0cf848, nd-f-omp-one-list-d2-1b67cb71,
! nd-f-omp-one-tree-d2-fe998394, nd-f-omp-present-chain-d2-6b433240, nd-f-omp-present-chain-d2-8328294e,
! nd-f-omp-present-chain-d2-98f96e52, nd-f-omp-present-chain-d2-9d7a0b6d, nd-f-omp-present-chain-d2-f3cf6eb5,
! nd-f-omp-present-chain-d3-04d9e7d3, nd-f-omp-present-chain-d3-512ec550, nd-f-omp-present-chain-d3-c07b93ee,
! nd-f-omp-present-chain-d3-d110420c, nd-f-omp-present-list-d2-865f5787, nd-f-omp-tdata-chain-d2-3ddce863,
! nd-f-omp-tdata-chain-d2-d7b601da, nd-f-omp-tdata-chain-d3-2be49672, nd-f-omp-tdata-chain-d3-5a6fdac0,
! nd-f-omp-tdata-chain-d3-85766a94, nd-f-omp-tdata-chain-d3-88f311be, nd-f-omp-tdata-chain-d3-8af496d0,
! nd-f-omp-tdata-chain-d3-96349065, nd-f-omp-tdata-list-d2-c3abf961, nd-f-omp-tdata-tree-d2-a44b533c,
! nd-f-omp-tdata-tree-d2-ba8e4a37, nd-f-omp-tdata_nested-chain-d2-ee52b5c1, nd-f-omp-tdata_nested-chain-d2-f63872c4,
! nd-f-omp-tdata_nested-chain-d3-1d9ac350, nd-f-omp-tdata_nested-chain-d3-78ee2d27, nd-f-omp-tdata_nested-chain-d3-833d215e,
! nd-f-omp-tdata_nested-chain-d3-9dd3b6ad, nd-f-omp-tdata_nested-chain-d3-cec76abb, nd-f-omp-tdata_nested-chain-d3-e0671608,
! nd-f-omp-tdata_nested-chain-d3-e61550e7, nd-f-omp-tdata_nested-chain-d4-355811c0, nd-f-omp-update-chain-d2-018eb6d9,
! nd-f-omp-update-chain-d2-0545e9b5, nd-f-omp-update-chain-d2-3daf06e5, nd-f-omp-update-chain-d2-75e83840,
! nd-f-omp-update-chain-d2-9756b365, nd-f-omp-update-chain-d2-b9c06ba7, nd-f-omp-update-chain-d2-d90fc1ec,
! nd-f-omp-update-chain-d2-eb4cf5ae, nd-f-omp-update-chain-d3-261315ff, nd-f-omp-update-chain-d3-3d5ca029,
! nd-f-omp-update-chain-d3-5b69f0e6, nd-f-omp-update-chain-d3-64ea229b, nd-f-omp-update-chain-d3-74e122b9,
! nd-f-omp-update-chain-d3-a40d2cc5, nd-f-omp-update-chain-d3-cf66ca90, nd-f-omp-update-chain-d3-d51553a5,
! nd-f-omp-update-chain-d3-f84ee81c, nd-f-omp-update-chain-d3-fddf3ef0, nd-f-omp-update-chain-d3-fee48361,
! nd-f-omp-update-chain-d4-0079ddfd, nd-f-omp-update-tree-d2-9a0f19f5, nd-f-omp-update-tree-d3-7d66722a,
! nd-f-omp-update-tree-d3-cef9276d
! - legality: the rules (offload.engine.rules) accept it, AFAR's flang front end accepts it and CCE compiles and runs it
! (the front ends of two other families)
program t
use omp_lib
implicit none
type :: n0
integer, allocatable :: a(:)
end type n0
type(n0), pointer :: r
integer :: q, hf, tot
logical :: ok
hf = 1
!$omp target map(from: hf)
hf = merge(1, 0, omp_is_initial_device())
!$omp end target
allocate(r)
allocate(r%a(8))
do q = 1, 8
r%a(q) = 100 + q - 1
end do
tot = 0
!$omp target enter data map(to: r)
!$omp target teams distribute parallel do reduction(+: tot)
do q = 1, 8
tot = tot + r%a(q)
r%a(q) = r%a(q) + 7
end do
!$omp end target teams distribute parallel do
!$omp target exit data map(from: r)
ok = tot == 828 .and. sum(r%a) == 884
print '(a,i0)', 'tot= ', tot
print '(a,i0)', 'sum= ', sum(r%a)
print '(a,i0,a,a)', 'RESULT ran_on_host=', hf, ' check=', merge('pass', 'fail', ok)
end program t
Something to add? Dispute its legality · Report it fixed in a newer release · Report a mistake on this page
Expected and observed
Observed where it behaves incorrectly
Warning: Queue error - HSA_STATUS_ERROR_MEMORY_FAULT Display last 2 kernels launched: Kernel 0: 'omp target in _QQmain @ 55 (__omp_offloading_14_13ca78a__QQmain_l55)' Kernel 1: 'omp target in _QQmain @ 45 (__omp_offloading_14_13ca78a__QQmain_l45)' Use 'OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=<num>' to adjust the number of shown stack traces (0 now, up to 8) OFFLOAD ERROR: memory access fault by GPU 5 (agent 0x5555556d55a0) at virtual address 0x555555b59000. Reasons: Unknown (0) Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations
What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 5.2 §5.8.1 p.149 l.4-5
If a variable is not a scalar then it is treated as if it had appeared in a map clause with a map-type of tofrom
OpenMP 5.2 §5.8.2 p.150 l.2-4
Evidence
Same compiler, one change
- one change from the finding; correct on afar: not run yet
Control program
! control: the root a variable, not a pointer program t use omp_lib implicit none type :: n0 integer, allocatable :: a(:) end type n0 type(n0) :: r integer :: q, hf, tot logical :: ok hf = 1 !$omp target map(from: hf) hf = merge(1, 0, omp_is_initial_device()) !$omp end target allocate(r%a(8)) do q = 1, 8 r%a(q) = 100 + q - 1 end do tot = 0 !$omp target enter data map(to: r) !$omp target teams distribute parallel do reduction(+: tot) do q = 1, 8 tot = tot + r%a(q) r%a(q) = r%a(q) + 7 end do !$omp end target teams distribute parallel do !$omp target exit data map(from: r) ok = tot == 828 .and. sum(r%a) == 884 print '(a,i0)', 'tot= ', tot print '(a,i0)', 'sum= ', sum(r%a) print '(a,i0,a,a)', 'RESULT ran_on_host=', hf, ' check=', merge('pass', 'fail', ok) end program t - one change from the finding; correct on afar: not run yet
Control program
! control: a fixed-size array component program t use omp_lib implicit none type :: n0 integer :: a(8) end type n0 type(n0), pointer :: r integer :: q, hf, tot logical :: ok hf = 1 !$omp target map(from: hf) hf = merge(1, 0, omp_is_initial_device()) !$omp end target allocate(r) do q = 1, 8 r%a(q) = 100 + q - 1 end do tot = 0 !$omp target enter data map(to: r) !$omp target teams distribute parallel do reduction(+: tot) do q = 1, 8 tot = tot + r%a(q) r%a(q) = r%a(q) + 7 end do !$omp end target teams distribute parallel do !$omp target exit data map(from: r) ok = tot == 828 .and. sum(r%a) == 884 print '(a,i0)', 'tot= ', tot print '(a,i0)', 'sum= ', sum(r%a) print '(a,i0,a,a)', 'RESULT ran_on_host=', hf, ' check=', merge('pass', 'fail', ok) end program t - one change from the finding; correct on afar: not run yet
Control program
! control: no enter/exit data, the map clause on the construct program t use omp_lib implicit none type :: n0 integer, allocatable :: a(:) end type n0 type(n0), pointer :: r integer :: q, hf, tot logical :: ok hf = 1 !$omp target map(from: hf) hf = merge(1, 0, omp_is_initial_device()) !$omp end target allocate(r) allocate(r%a(8)) do q = 1, 8 r%a(q) = 100 + q - 1 end do tot = 0 !$omp target teams distribute parallel do reduction(+: tot) map(tofrom: r) do q = 1, 8 tot = tot + r%a(q) r%a(q) = r%a(q) + 7 end do !$omp end target teams distribute parallel do ok = tot == 828 .and. sum(r%a) == 884 print '(a,i0)', 'tot= ', tot print '(a,i0)', 'sum= ', sum(r%a) print '(a,i0,a,a)', 'RESULT ran_on_host=', hf, ' check=', merge('pass', 'fail', ok) end program t - one change from the finding; correct on afar: not run yet
Control program
! control: the pointed-to type holds a fixed array program t use omp_lib implicit none type :: n1 integer :: a(8) = 0 end type n1 type :: n0 integer :: v = 0 type(n1), pointer :: nx => null() end type n0 type(n0) :: r integer :: q, hf, tot logical :: ok hf = 1 !$omp target map(from: hf) hf = merge(1, 0, omp_is_initial_device()) !$omp end target allocate(r%nx) do q = 1, 8 r%nx%a(q) = 200 + q - 1 end do tot = 0 !$omp target enter data map(to: r) !$omp target enter data map(to: r%nx) !$omp target teams distribute parallel do reduction(+: tot) do q = 1, 8 tot = tot + r%nx%a(q) end do !$omp end target teams distribute parallel do !$omp target exit data map(release: r%nx) !$omp target exit data map(release: r) ok = tot == 1628 print '(a,i0)', 'tot= ', tot print '(a,i0,a,a)', 'RESULT ran_on_host=', hf, ' check=', merge('pass', 'fail', ok) end program t - one change from the finding; correct on afar: not run yet
Control program
! control: the allocatable array in the variable, the pointer component holds a fixed array too program t use omp_lib implicit none type :: n1 integer :: s = 0 end type n1 type :: n0 integer :: v = 0 integer, allocatable :: a(:) type(n1), pointer :: nx => null() end type n0 type(n0) :: r integer :: q, hf, tot logical :: ok hf = 1 !$omp target map(from: hf) hf = merge(1, 0, omp_is_initial_device()) !$omp end target allocate(r%nx) allocate(r%a(8)) do q = 1, 8 r%a(q) = 200 + q - 1 end do tot = 0 !$omp target enter data map(to: r) !$omp target enter data map(to: r%nx) !$omp target teams distribute parallel do reduction(+: tot) do q = 1, 8 tot = tot + r%a(q) end do !$omp end target teams distribute parallel do !$omp target exit data map(release: r%nx) !$omp target exit data map(release: r) ok = tot == 1628 print '(a,i0)', 'tot= ', tot print '(a,i0,a,a)', 'RESULT ran_on_host=', hf, ' check=', merge('pass', 'fail', ok) end program t
Other compilers run it correctly
CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4, NVHPC 25.11, NVHPC 26.9, GCC 16.2.0