Hi! On 2024-10-14T10:23:56+0200, I wrote: > On 2024-10-13T10:21:01+0200, Tobias Burnus <tbur...@baylibre.com> wrote: >> Now pushed as r15-4298-g3269a722b7a036.
>>>>> Tested on x86-64 without and with offloading configured, running >>>>> with nvptx offloading. I see an UNRESOLVED: +PASS: libgomp.oacc-fortran/acc_on_device-2.f90 -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable -O scan-tree-dump-not optimized "acc_on_device" +PASS: libgomp.oacc-fortran/acc_on_device-2.f90 -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable -O scan-tree-dump-times gimple "acc_on_device" 1 +PASS: libgomp.oacc-fortran/acc_on_device-2.f90 -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable -O (test for excess errors) +PASS: libgomp.oacc-fortran/acc_on_device-2.f90 -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O at line 37 (test for warnings, line 36) +UNRESOLVED: libgomp.oacc-fortran/acc_on_device-2.f90 -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O scan-nvptx-none-offload-tree-dump-not optimized "acc_on_device" +PASS: libgomp.oacc-fortran/acc_on_device-2.f90 -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O scan-tree-dump-not optimized "acc_on_device" +PASS: libgomp.oacc-fortran/acc_on_device-2.f90 -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O scan-tree-dump-times gimple "acc_on_device" 1 +PASS: libgomp.oacc-fortran/acc_on_device-2.f90 -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O (test for excess errors) >> --- /dev/null >> +++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-2.f90 >> @@ -0,0 +1,40 @@ >> +! { dg-do link } >> + >> +! Check whether 'acc_on_device()' is properly compile-time optimized. */ >> + >> +! { dg-additional-options "-fdump-tree-gimple -fdump-tree-optimized" } >> +! { dg-additional-options -foffload-options=-fdump-tree-optimized { target >> { offload_device_nvptx || offload_target_amdgcn } } } >> + >> +! { dg-final { scan-tree-dump-times "acc_on_device" 1 "gimple" } } >> + >> +! { dg-final { scan-tree-dump-not "acc_on_device" "optimized" } } >> + >> +! { dg-final { only_for_offload_target amdgcn-amdhsa >> scan-offload-tree-dump-not "acc_on_device" "optimized" { target >> offload_target_amdgcn } } } >> +! { dg-final { only_for_offload_target nvptx-none >> scan-offload-tree-dump-not "acc_on_device" "optimized" { target >> offload_target_nvptx } } } Pushed to trunk branch commit c3774b2e2d7d00ad9f9f6fce10aa6bc872bd951f "Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' __builtin_is_initial_device: Fix effective-target keyword in 'libgomp.oacc-fortran/acc_on_device-2.f90'", see attached. Grüße Thomas >> + >> + >> +module m >> + integer :: xxxx >> + !$acc declare device_resident(xxxx) >> +contains >> + subroutine set_var >> + !$acc routine >> + use openacc >> + implicit none (type, external) >> + if (acc_on_device(acc_device_host)) then >> + xxxx = 1234 >> + else >> + xxxx = 4242 >> + end if >> + end >> +end module m >> + >> + >> +program main >> + use m >> + call set_var >> + !$acc serial >> + ! { dg-warning "using 'vector_length \\(32\\)', ignoring 1" "" { target >> openacc_nvidia_accel_selected } .-1 } >> + call set_var >> + !$acc end serial >> +end
>From c3774b2e2d7d00ad9f9f6fce10aa6bc872bd951f Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tschwi...@baylibre.com> Date: Mon, 14 Oct 2024 10:26:13 +0200 Subject: [PATCH] Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' __builtin_is_initial_device: Fix effective-target keyword in 'libgomp.oacc-fortran/acc_on_device-2.f90' The test case 'libgomp.oacc-fortran/acc_on_device-2.f90' added in commit 3269a722b7a03613e9c4e2862bc5088c4a17cc11 "Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' __builtin_is_initial_device" had a mismatch between dump file production and its scanning; the former needs to use 'offload_target_nvptx' (like 'offload_target_amdgcn'), not 'offload_device_nvptx'. PR testsuite/82250 libgomp/ * testsuite/libgomp.oacc-fortran/acc_on_device-2.f90: Fix effective-target keyword. --- libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-2.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-2.f90 index 39d4357dd55..306555cfccf 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-2.f90 +++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-2.f90 @@ -3,7 +3,7 @@ ! Check whether 'acc_on_device()' is properly compile-time optimized. */ ! { dg-additional-options "-fdump-tree-gimple -fdump-tree-optimized" } -! { dg-additional-options -foffload-options=-fdump-tree-optimized { target { offload_device_nvptx || offload_target_amdgcn } } } +! { dg-additional-options -foffload-options=-fdump-tree-optimized { target { offload_target_nvptx || offload_target_amdgcn } } } ! { dg-final { scan-tree-dump-times "acc_on_device" 1 "gimple" } } -- 2.34.1