From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 6D4493858C2C for ; Fri, 1 Apr 2022 12:28:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6D4493858C2C 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.90,227,1643702400"; d="scan'208";a="76502785" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 01 Apr 2022 04:28:40 -0800 IronPort-SDR: 1qYVcQxWjsjGdyl8IAVwT0vjTDtQ3enJFrO4XT72QCEoUVOgf3vc7Nbv8ywOPEFls8I+/2/6a0 T8YifCpBlZI+G6ZIoTJK4UJdK+a5AEiajlDms1yFVDqLEsp8XQksbkQMlqyHSxqCetz964J/I5 IXYGKe7ncX0pS0yhDsPoKLjqz/06DbFWIX2aOEcqVhRHOH5+i3jlv+NvsrZeBtC6ytDWm838Wd z6pgQTqXOhHnSRAht6y69r4avnPLaoqG7C+431xz4c9UCF1/mufvCfLu3jy76/8lQp3dtXeygD ZwM= From: Thomas Schwinge To: Tom de Vries CC: Jakub Jelinek , Subject: Re: [PATCH][libgomp, testsuite, nvptx] Limit recursion in declare_target-{1,2}.f90 In-Reply-To: <20220401112438.GA19247@delia> References: <20220401112438.GA19247@delia> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Fri, 1 Apr 2022 14:28:32 +0200 Message-ID: <8735ixm1hr.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-07.mgc.mentorg.com (139.181.222.7) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Apr 2022 12:28:43 -0000 Hi Tom! On 2022-04-01T13:24:40+0200, Tom de Vries wrote: > When running testcases libgomp.fortran/examples-4/declare_target-{1,2}.f9= 0 on > an RTX A2000 (sm_86) with driver 510.60.02 and with GOMP_NVPTX_JIT=3D-O0 = I run > into: > ... > FAIL: libgomp.fortran/examples-4/declare_target-1.f90 -O0 \ > -DGOMP_NVPTX_JIT=3D-O0 execution test > FAIL: libgomp.fortran/examples-4/declare_target-2.f90 -O0 \ > -DGOMP_NVPTX_JIT=3D-O0 execution test > ... > > Fix this by further limiting recursion depth in the test-cases for nvptx. > > Furthermore, make the recursion depth limiting nvptx-specific. Careful: > --- a/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-1.f90 > +++ b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-1.f90 > @@ -1,4 +1,16 @@ > ! { dg-do run } > +! { dg-additional-options "-cpp" } > +! Reduced from 25 to 23, otherwise execution runs out of thread stack on > +! Nvidia Titan V. > +! Reduced from 23 to 22, otherwise execution runs out of thread stack on > +! Nvidia T400 (2GB variant), when run with GOMP_NVPTX_JIT=3D-O0. > +! Reduced from 22 to 20, otherwise execution runs out of thread stack on > +! Nvidia RTX A2000 (6GB variant), when run with GOMP_NVPTX_JIT=3D-O0. > +! { dg-additional-options "-DREC_DEPTH=3D20" { target { offload_target_n= vptx } } } */ 'offload_target_nvptx' doesn't mean that offloading execution is done on nvptx, but rather that we're "*compiling* for offload target nvptx" (emphasis mine). That means, with such a change we're now getting different behavior in a system with an AMD GPU, when using a toolchain that only has GCN offloading configured vs. a toolchain that has GCN and nvptx offloading configured. This isn't going to cause any real problems, of course, but it's confusing, and a bad example of 'offload_target_nvptx'. 'offload_device_nvptx' ought to work: "using nvptx offload device". But again, to keep things simple, I again suggest to unconditionally reduce the recursion depth for all configurations, unless there exists an actual rationale for the original value. Gr=C3=BC=C3=9Fe Thomas > + > +#ifndef REC_DEPTH > +#define REC_DEPTH 25 > +#endif > > module e_53_1_mod > integer :: THRESHOLD =3D 20 > @@ -27,9 +39,5 @@ end module > program e_53_1 > use e_53_1_mod, only : fib, fib_wrapper > if (fib (15) /=3D fib_wrapper (15)) stop 1 > - ! Reduced from 25 to 23, otherwise execution runs out of thread stack = on > - ! Nvidia Titan V. > - ! Reduced from 23 to 22, otherwise execution runs out of thread stack = on > - ! Nvidia T400 (2GB variant), when run with GOMP_NVPTX_JIT=3D-O0. > - if (fib (22) /=3D fib_wrapper (22)) stop 2 > + if (fib (REC_DEPTH) /=3D fib_wrapper (REC_DEPTH)) stop 2 > end program > --- a/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-2.f90 > +++ b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-2.f90 > @@ -1,16 +1,24 @@ > ! { dg-do run } > +! { dg-additional-options "-cpp" } > +! Reduced from 25 to 23, otherwise execution runs out of thread stack on > +! Nvidia Titan V. > +! Reduced from 23 to 22, otherwise execution runs out of thread stack on > +! Nvidia T400 (2GB variant), when run with GOMP_NVPTX_JIT=3D-O0. > +! Reduced from 22 to 18, otherwise execution runs out of thread stack on > +! Nvidia RTX A2000 (6GB variant), when run with GOMP_NVPTX_JIT=3D-O0. > +! { dg-additional-options "-DREC_DEPTH=3D18" { target { offload_target_n= vptx } } } */ > + > +#ifndef REC_DEPTH > +#define REC_DEPTH 25 > +#endif > > program e_53_2 > !$omp declare target (fib) > integer :: x, fib > !$omp target map(from: x) > - ! Reduced from 25 to 23, otherwise execution runs out of thread stac= k on > - ! Nvidia Titan V. > - ! Reduced from 23 to 22, otherwise execution runs out of thread stac= k on > - ! Nvidia T400 (2GB variant), when run with GOMP_NVPTX_JIT=3D-O0. > - x =3D fib (22) > + x =3D fib (REC_DEPTH) > !$omp end target > - if (x /=3D fib (22)) stop 1 > + if (x /=3D fib (REC_DEPTH)) stop 1 > end program > > integer recursive function fib (n) result (f) ----------------- 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