From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id B06933858412; Sat, 12 Nov 2022 09:20:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B06933858412 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.96,159,1665475200"; d="scan'208";a="86709611" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 12 Nov 2022 01:20:10 -0800 IronPort-SDR: XTD6sbOX72FmrLiWINcthGjmK0WHmsw8lM9dkCL+Kx7O9BZhsGbQBBR1crcmETxO423iTirS5y ae3kzAIdaWSEYrHJTIICvK88AQzWcvJwInu+QP6WtiS5MHK9r1Z/wW52581zrn6J4DdHwv49hb k9Z+04Al2B6mm8P1HU907c/YdUc5+3nuB67g3xUYN+Oa1hEzwFJhnQJNxuVxSMLcn9MGyAPr+r V9hJ4rK8s7n6trCq8sS3GRsS2fKd8c/iBHJk8Mp+UaiVpk6xelpDoeJjezoFRjI1vB0nZpIVyq nP0= From: Thomas Schwinge To: Tobias Burnus CC: , , Jakub Jelinek Subject: Re: [Patch] OpenMP/Fortran: Use firstprivat not alloc for ptr attach for arrays In-Reply-To: References: User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Sat, 12 Nov 2022 10:19:59 +0100 Message-ID: <87iljk4ji8.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-09.mgc.mentorg.com (139.181.222.9) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Tobias! On 2022-05-13T19:44:51+0200, Jakub Jelinek via Fortran wrote: > On Fri, May 13, 2022 at 07:21:02PM +0200, Tobias Burnus wrote: >> gcc/fortran/ChangeLog: >> >> * trans-openmp.cc (gfc_trans_omp_clauses): When mapping nondescript= or >> array sections, use GOMP_MAP_FIRSTPRIVATE_POINTER instead of >> GOMP_MAP_POINTER for the pointer attachment. >> >> libgomp/ChangeLog: >> >> * testsuite/libgomp.fortran/target-nowait-array-section.f90: New te= st. > > Not 100% sure if we want to add such a testcase into the testsuite given > that it is not valid OpenMP, but perhaps it is ok as we are testing a QoI= . For non-offloading x86_64-pc-linux-gnu '-m32', I'm occasionally (but very rarely!) seeing this test case FAIL its execution test. Similar can also be seen on occasional reports via , . Gr=C3=BC=C3=9Fe Thomas 'libgomp.fortran/target-nowait-array-section.f90': | ! Runs the the target region asynchrolously and checks for it | ! | ! Note that map(alloc: work(:, i)) + nowait should be safe | ! given that a nondescriptor array is used. However, it still | ! violates a map clause restriction, added in OpenMP 5.1 [354:10-13]. | | PROGRAM test_target_teams_distribute_nowait | USE ISO_Fortran_env, only: INT64 | implicit none | INTEGER, parameter :: N =3D 1024, N_TASKS =3D 16 | INTEGER :: i, j, k, my_ticket | INTEGER :: order(n_tasks) | INTEGER(INT64) :: work(n, n_tasks) | INTEGER :: ticket | logical :: async | | ticket =3D 0 | | !$omp target enter data map(to: ticket, order) | | !$omp parallel do num_threads(n_tasks) | DO i =3D 1, n_tasks | !$omp target map(alloc: work(:, i), ticket) private(my_ticket) now= ait | !!$omp target teams distribute map(alloc: work(:, i), ticket) priv= ate(my_ticket) nowait | DO j =3D 1, n | ! Waste cyles | ! work(j, i) =3D 0 | ! DO k =3D 1, n*(n_tasks - i) | ! work(j, i) =3D work(j, i) + i*j*k | ! END DO | my_ticket =3D 0 | !$omp atomic capture | ticket =3D ticket + 1 | my_ticket =3D ticket | !$omp end atomic | !$omp atomic write | order(i) =3D my_ticket | END DO | !$omp end target !teams distribute | END DO | !$omp end parallel do | | !$omp target exit data map(from:ticket, order) | | IF (ticket .ne. n_tasks*n) stop 1 | if (maxval(order) /=3D n_tasks*n) stop 2 | ! order(i) =3D=3D n*i if synchronous and between n and n*n_tasks if r= un concurrently | do i =3D 1, n_tasks | if (order(i) < n .or. order(i) > n*n_tasks) stop 3 | end do | async =3D .false. | do i =3D 1, n_tasks | if (order(i) /=3D n*i) async =3D .true. | end do | if (.not. async) stop 4 ! Did not run asynchronously | end ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955