From patchwork Tue Oct 29 12:10:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 99765 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7C253385840E for ; Tue, 29 Oct 2024 12:18:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by sourceware.org (Postfix) with ESMTPS id 69E2F3858C98 for ; Tue, 29 Oct 2024 12:18:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 69E2F3858C98 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 69E2F3858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730204299; cv=none; b=MlGEAMw4kMgikxpK3kpCLfvwL/TPJAgLBXLMW5UZKJ+8nODJ55vB4U8n4Hp5vr35Is6ZyOkKsBy1xazGIN3eYunAlq2wM0bED05xoSTF5I+3QXowdfEJwTYWCT3+ToyFiIDZ1b7ljyNZ80BVHmRkPMh03xD0MCzZNsDzgA50S7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730204299; c=relaxed/simple; bh=cIisoVj8xwuEoLTnXvsaJnqYX3tJOrJTJTmEx2+JEbs=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=dQLPCtxvPkBqZtt6oJkWCSdgNfHxVWxgFvRHrsoYOGU8OvuUNW9e9IBkq1F8nOWHTKme2T+E6Cu/GRfSJN7ya8FzcFhAGqfF1s/jplhARFBMSKCpLMGfB93fAjZ+dZDjdFn1mfqktnOOW2rOvtbi1UXnqw8HxBYl/5LHDuWgyRw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-539eb97f26aso5536063e87.2 for ; Tue, 29 Oct 2024 05:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1730204294; x=1730809094; darn=gcc.gnu.org; h=in-reply-to:content-language:references:to:from:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=aVqS8YWg6IZoP2j+plbQUTQGYsV4NdndPV0kP41TIRs=; b=lbdt+AO/XdM/Sq+FGL0uMK5/kP3d4y8JyYXbsK7V2aEgCe0lH9rix6IdY7VQWxKhxy YCQzG+o676jpNApNHa8FeMSjeCl44AWVKDLPc24rSjlrvkMhKZejLwlW/J4laXOqAFFz jE/H6wmIe6sXrtpOg3JNRGclC5Sewpf/vKlAI00jDn5sSoBflyws5E2u1bWucR7tx1h/ k/chqFdxAuJNZkuf1tqC+7SdSqL1x8G7vQ3mJnRWrcunS9dmXKrwe8cq8jq95rrMKXTc a6NTOaltzDko+vGpz9IhsabaWuRFCNNy85PJ6TUTIARlS/AhGxzPYDQKiR5UlmGpLnrh 3Z9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730204294; x=1730809094; h=in-reply-to:content-language:references:to:from:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=aVqS8YWg6IZoP2j+plbQUTQGYsV4NdndPV0kP41TIRs=; b=izkI8jMfQ6n57cC5HEDBsHJKuA9TymHKfjB6mtajPj/+dHbam9b4XqnORtyFFliV3Y XSIjioAuzayGsrQ9gy2DGSDGiuWtU7KUSNIAJq2zJG7fL/nwzrJ5DWcXIrSeAMhHRL1r Y6gWPMM3lTtAa8k/WcijQyHa7gxpPWNSoNQrGeYb5g4783KlmSK8C0wq7xdSchQQRyXh ljEfiRzWSC0tSvs5GKBH0GAWn73lAtNezIG4DBdffSXVQbbcJ/I6PPHuqww6wlA9w2Q4 58AP7nLsrhL/KxiQdGZA/tEzoDzx2KdioNP8fPxxtDKO3/OKpkb5zplTbd1tjInWV1bs VXnQ== X-Forwarded-Encrypted: i=1; AJvYcCWVqrFy2nHRLSlRCm1Imdhdwyk0KTmm5y2PsXpdbqy20fz/JzI9u5Qz/aRoFGJNXeFnB62uZLH4sTIYuQ==@gcc.gnu.org X-Gm-Message-State: AOJu0YwLQPIE1EOKrKzjFZxSarFRVSY3zEnTD9yf8OOdBoyZltMJCG4p o0kKsBT21ZgSgJ6EKX+W6h/gBCRc9MvcmMtIk4GuYRw+h7K3R4XKQ7W4ikiuKKqZrY6yBt9JEe9 W X-Google-Smtp-Source: AGHT+IF+CT4NRT8A4csq7pDzmx0JG5IMiLdMtULg10y1BJfl+pQTrZeRsYh96/WfpscUOQDc7VYKRA== X-Received: by 2002:a17:907:7e9a:b0:a9a:2d04:b577 with SMTP id a640c23a62f3a-a9de5d783cfmr1168719666b.32.1730203856890; Tue, 29 Oct 2024 05:10:56 -0700 (PDT) Received: from [192.168.8.104] (tmo-084-76.customers.d1-online.com. [80.187.84.76]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f2994f4sm464591566b.123.2024.10.29.05.10.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Oct 2024 05:10:56 -0700 (PDT) Message-ID: Date: Tue, 29 Oct 2024 13:10:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [Patch] AMD GCN: mkoffload.cc - set HSA_XNACK for USM and 'xnack+' / 'xnack-' (was [Patch] AMD GCN: Set HSA_XNACK for USM and 'xnack+' / 'xnack-') From: Tobias Burnus To: Andrew Stubbs , gcc-patches References: Content-Language: en-US In-Reply-To: X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, HTML_MESSAGE, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Reposted because of two reasons: First, I realized that the message should contain the word 'mkoffload.cc' to be clearer. But the main reason is that I kept changing whether I wanted to set HSA_XNACK=0 and warn with USM for gfx90{0,6,8} or only one or not. (In GCC, those default to xnack=no as they have XNACK but do not have a well-working USM support.) At the end, I settled on: Yes, both set the env var and warn. But I forgot to remove all traces of the unused variable. Appended the corrected patch … Tobias Tobias Burnus wrote: > While users can set HSA_XNACK themselves, it is much more convenient if > the compiler sets it for them (at least if it is overriddable). > > Some systems don't have XNACK, but for those that have it, the somewhat > newisher object code versions support three modes: unset (GCC: > '-mxnack=any'; > supporting both XNACK and not), set and unset; the last two only work > if the > compiled-for mode matches the actual mode in which the GPU is running. > Therefore, setting HSA_XNACK in this case makes sense. > > XNACK (when available) also needs to be enabled in order to have a > working > unified-shared memory access, hence, setting it in that case also > makes sense. > Therefore, this patch sets HSA_XNACK to 0 or 1. > > This somewhat matches what is done in OG13 and in Andrew's patch at > https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655951.html > albeit the code is somewhat different. > [For some reasons, this code is not in OG14 ?!?] > > While doing so, I also updated the documentation and moved the code from > the existing stack-size constructor in the existing 'init' constructor to > reduce the number of used constructors. > > OK for mainline? > > Tobias AMD GCN: mkoffload.cc - set HSA_XNACK for USM and 'xnack+' / 'xnack-' Code compiled with explicit 'xnack-' (-mxnack=off) or 'xnack+' (-mnack=on) only runs when the hardware mode matches. Additionally, on GPUs that support XNACK, the GPU has to use this mode in order that unified-shared memory access is possible. This commit adds code to the constructor, created by mkoffload.cc, to set the HSA_XNACK environment variable (if not set by the user) - either to 0 for 'xnack-' or to 1 for 'xnack+' and if the code contains 'omp requires self_maps' or '... unified_shared_memory'. There is a compile-time warning when combining 'xnack-' with USM. At runtime, when XNACK is supported but not enabled, the GPU is excluded (host fallback). The new setenv has been added to the 'init' constructor - and the existing setenv code for the stack size has been moved there to reduce the pointless larger overhead due having multiple constructors. Note: In GCC, gfx90{0,6,8} default to 'xnack-'; hence, the constructor will set HSA_XNACK=0 by default. Note 2: There is probably a preexisting endian issue in handling omp_requires if the host compiler and the target compiler (in the GCC sense) have a different endianess, which would be fixable. [If target and offload target would have different endianess, it would be mostly unfixable, esp. with USM.] Co-Authored-By: Andrew Stubbs gcc/ChangeLog: * config/gcn/mkoffload.cc (process_asm): Take omp_requires argument; extend conditions for requiring an '#include' in the generated C file. Remove code generation for the GCN_STACK_SIZE constructor. (process_obj): Inside the generated 'init' constructor, set GCN_STACK_SIZE and HSA_XNACK, if applicable. (main): Update process_asm call. libgomp/ChangeLog: * libgomp.texi (nvptx): Mention 'self_maps' besides 'unified_shared_memory' clause. (AMD GCN): Likewise; state that GCC might automatically set HSA_XNACK. * testsuite/libgomp.c-c++-common/requires-4.c: Add dg-prune-output for the -mxnack=off with USM warning. * testsuite/libgomp.c-c++-common/requires-4a.c: Likewise. * testsuite/libgomp.c-c++-common/requires-5.c: Likewise. * testsuite/libgomp.c-c++-common/requires-7.c: Likewise. * testsuite/libgomp.c-c++-common/target-implicit-map-4.c: Likewise. * testsuite/libgomp.c-c++-common/target-link-3.c: Likewise. * testsuite/libgomp.c-c++-common/target-link-4.c: Likewise. * testsuite/libgomp.fortran/self_maps.f90: Likewise. gcc/config/gcn/mkoffload.cc | 61 ++++++++++++++++------ libgomp/libgomp.texi | 24 +++++---- .../testsuite/libgomp.c-c++-common/requires-4.c | 5 ++ .../testsuite/libgomp.c-c++-common/requires-4a.c | 5 ++ .../testsuite/libgomp.c-c++-common/requires-5.c | 5 ++ .../testsuite/libgomp.c-c++-common/requires-7.c | 5 ++ .../libgomp.c-c++-common/target-implicit-map-4.c | 5 ++ .../testsuite/libgomp.c-c++-common/target-link-3.c | 5 ++ .../testsuite/libgomp.c-c++-common/target-link-4.c | 5 ++ libgomp/testsuite/libgomp.fortran/self_maps.f90 | 5 ++ 10 files changed, 100 insertions(+), 25 deletions(-) diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 17a33421134..b50c28881da 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -442,7 +442,7 @@ copy_early_debug_info (const char *infile, const char *outfile) encoded as structured data. */ static void -process_asm (FILE *in, FILE *out, FILE *cfile) +process_asm (FILE *in, FILE *out, FILE *cfile, uint32_t omp_requires) { int fn_count = 0, var_count = 0, ind_fn_count = 0; int dims_count = 0, regcount_count = 0; @@ -616,7 +616,14 @@ process_asm (FILE *in, FILE *out, FILE *cfile) struct oaccdims *dims = XOBFINISH (&dims_os, struct oaccdims *); struct regcount *regcounts = XOBFINISH (®counts_os, struct regcount *); - if (gcn_stack_size) + /* Used in the constructor, generated in process_obj. */ + if (gcn_stack_size + || TEST_XNACK_OFF (elf_flags) + || TEST_XNACK_ON (elf_flags) + || (SET_XNACK_ANY (elf_flags) + && (omp_requires + & (GOMP_REQUIRES_UNIFIED_SHARED_MEMORY + | GOMP_REQUIRES_SELF_MAPS)))) { fprintf (cfile, "#include \n"); fprintf (cfile, "#include \n\n"); @@ -662,18 +669,6 @@ process_asm (FILE *in, FILE *out, FILE *cfile) } fprintf (cfile, "\n};\n\n"); - /* Set the stack size if the user configured a value. */ - if (gcn_stack_size) - fprintf (cfile, - "static __attribute__((constructor))\n" - "void configure_stack_size (void)\n" - "{\n" - " const char *val = getenv (\"GCN_STACK_SIZE\");\n" - " if (!val || val[0] == '\\0')\n" - " setenv (\"GCN_STACK_SIZE\", \"%d\", true);\n" - "}\n\n", - gcn_stack_size); - obstack_free (&fns_os, NULL); for (i = 0; i < dims_count; i++) free (dims[i].name); @@ -736,8 +731,42 @@ process_obj (const char *fname_in, FILE *cfile, uint32_t omp_requires) fprintf (cfile, "extern const void *const __OFFLOAD_TABLE__[];\n\n"); + /* Create the constructor to handle stack size and xnack and to call + GOMP_offload_register_ver. */ + fprintf (cfile, "static __attribute__((constructor)) void init (void)\n" - "{\n" + "{\n"); + + /* Set the stack size if the user configured a value. */ + if (gcn_stack_size) + fprintf (cfile, + " const char *val2 = getenv (\"GCN_STACK_SIZE\");\n" + " if (!val2 || val2[0] == '\\0')\n" + " setenv (\"GCN_STACK_SIZE\", \"%d\", true);\n", + gcn_stack_size); + + /* If the user explicitly disabled XNACK ('xnack-', -mxnack=off), set at + runtime HSA_XNACK=0. Otherwise, if either USM was requested or explicitly + compiled for XNACK ('xnack-', -mxnack=off), set HSA_XNACK=1. + In either case, a user-set HSA_XNACK env var is not overridden. */ + if (TEST_XNACK_OFF (elf_flags) + && (omp_requires & (GOMP_REQUIRES_UNIFIED_SHARED_MEMORY + | GOMP_REQUIRES_SELF_MAPS))) + warning (0, "%<-mxnack=off%> is incompatible with OpenMP's " + "% and % clauses"); + if (TEST_XNACK_OFF (elf_flags) + || TEST_XNACK_ON (elf_flags) + || (SET_XNACK_ANY (elf_flags) + && (omp_requires + & (GOMP_REQUIRES_UNIFIED_SHARED_MEMORY + | GOMP_REQUIRES_SELF_MAPS)))) + fprintf (cfile, + " const char *val = getenv (\"HSA_XNACK\");\n" + " if (!val || val[0] == '\\0')\n" + " setenv (\"HSA_XNACK\", \"%d\", true);\n", + TEST_XNACK_OFF (elf_flags) ? 0 : 1); + + fprintf (cfile, " GOMP_offload_register_ver (%#x, __OFFLOAD_TABLE__," " %d/*GCN*/, &gcn_data);\n" "};\n", @@ -1250,7 +1279,7 @@ main (int argc, char **argv) if (!out) fatal_error (input_location, "cannot open %qs", gcn_s2_name); - process_asm (in, out, cfile); + process_asm (in, out, cfile, omp_requires); fclose (in); fclose (out); diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index 6860963f368..667edd9ecc4 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -6576,14 +6576,20 @@ The implementation remark: @code{device(ancestor:1)}) are processed serially per @code{target} region such that the next reverse offload region is only executed after the previous one returned. -@item OpenMP code that has a @code{requires} directive with - @code{unified_shared_memory} is only supported if all AMD GPUs have the - @code{HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT} property; for - discrete GPUs, this may require setting the @code{HSA_XNACK} environment - variable to @samp{1}; for systems with both an APU and a discrete GPU that - does not support XNACK, consider using @code{ROCR_VISIBLE_DEVICES} to - enable only the APU. If not supported, all AMD GPU devices are removed +@item OpenMP code that has a @code{requires} directive with a @code{self_maps} or + @code{unified_shared_memory} clause is only supported if all AMD GPUs have + the @code{HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT} property. With + some discrete GPUs, this requires that the @code{HSA_XNACK} environment + variable is set to @samp{1}. For systems with both an APU and a discrete + GPU that does not support XNACK, consider using @code{ROCR_VISIBLE_DEVICES} + to enable only the APU. If not supported, all AMD GPU devices are removed from the list of available devices (``host fallback''). +@item If unset and XNACK is supported by the architecture, GCC automatically + sets the @code{HSA_XNACK} environment variable as follows: It is set to + @samp{0} when compiled with @code{-mxnack=off}; otherwise, it is set to + @samp{1} if either compiled with @code{-mxnack=on} or if the OpenMP + @code{self_maps} or @code{unified_shared_memory} requirement clause has + been specified. Else, it is not set. @item The available stack size can be changed using the @code{GCN_STACK_SIZE} environment variable; the default is 32 kiB per thread. @item Low-latency memory (@code{omp_low_lat_mem_space}) is supported when the @@ -6663,8 +6669,8 @@ The implementation remark: Per device, reverse offload regions are processed serially such that the next reverse offload region is only executed after the previous one returned. -@item OpenMP code that has a @code{requires} directive with - @code{unified_shared_memory} runs on nvptx devices if and only if +@item OpenMP code that has a @code{requires} directive with a @code{self_maps} or + @code{unified_shared_memory} clause runs on nvptx devices if and only if all of those support the @code{pageableMemoryAccess} property;@footnote{ @uref{https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#um-requirements}} otherwise, all nvptx device are removed from the list of available diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-4.c b/libgomp/testsuite/libgomp.c-c++-common/requires-4.c index 8cb4821ee53..e76c6ff4f5f 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-4.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-4.c @@ -34,3 +34,8 @@ main (void) foo (); return 0; } + +/* AMD GCN's gfx900/gfx906/gfx908 support in principle the XNACK flag, but the support is lurkwarm; + hence, GCC defaults to OFF, causing the warning + gcn mkoffload: warning: ‘-mxnack=off’ is incompatible with OpenMP's ‘self_maps’ and ‘unified_shared_memory’ clauses */ +/* { dg-prune-output "mxnack=off" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-4a.c b/libgomp/testsuite/libgomp.c-c++-common/requires-4a.c index 0e0db927c2c..de7412913f1 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-4a.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-4a.c @@ -38,3 +38,8 @@ main (void) __builtin_free (a); return 0; } + +/* AMD GCN's gfx900/gfx906/gfx908 support in principle the XNACK flag, but the support is lurkwarm; + hence, GCC defaults to OFF, causing the warning + gcn mkoffload: warning: ‘-mxnack=off’ is incompatible with OpenMP's ‘self_maps’ and ‘unified_shared_memory’ clauses */ +/* { dg-prune-output "mxnack=off" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-5.c b/libgomp/testsuite/libgomp.c-c++-common/requires-5.c index d43d78db6fa..dda758c318f 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-5.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-5.c @@ -28,3 +28,8 @@ main (void) foo (); return 0; } + +/* AMD GCN's gfx900/gfx906/gfx908 support in principle the XNACK flag, but the support is lurkwarm; + hence, GCC defaults to OFF, causing the warning + gcn mkoffload: warning: ‘-mxnack=off’ is incompatible with OpenMP's ‘self_maps’ and ‘unified_shared_memory’ clauses */ +/* { dg-prune-output "mxnack=off" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/requires-7.c b/libgomp/testsuite/libgomp.c-c++-common/requires-7.c index 63afcc92b9a..7f5dd28bb2c 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/requires-7.c +++ b/libgomp/testsuite/libgomp.c-c++-common/requires-7.c @@ -30,3 +30,8 @@ main (void) ..., but we may still verify that the rest of the diagnostic is correct: { dg-note {' has 'unified_address'} {} { target *-*-* } 0 } */ /* { dg-excess-errors "Ignore messages like: errors during merging of translation units|mkoffload returned 1 exit status" } */ + +/* AMD GCN's gfx900/gfx906/gfx908 support in principle the XNACK flag, but the support is lurkwarm; + hence, GCC defaults to OFF, causing the warning + gcn mkoffload: warning: ‘-mxnack=off’ is incompatible with OpenMP's ‘self_maps’ and ‘unified_shared_memory’ clauses */ +/* { dg-prune-output "mxnack=off" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-4.c b/libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-4.c index d0b0cd178c0..c7de68ed410 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-4.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-4.c @@ -157,3 +157,8 @@ main() test_device (i); return 0; } + +/* AMD GCN's gfx900/gfx906/gfx908 support in principle the XNACK flag, but the support is lurkwarm; + hence, GCC defaults to OFF, causing the warning + gcn mkoffload: warning: ‘-mxnack=off’ is incompatible with OpenMP's ‘self_maps’ and ‘unified_shared_memory’ clauses */ +/* { dg-prune-output "mxnack=off" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-link-3.c b/libgomp/testsuite/libgomp.c-c++-common/target-link-3.c index c707b38b7d4..5de44cc4532 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-link-3.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-link-3.c @@ -50,3 +50,8 @@ main () q = 42; } } + +/* AMD GCN's gfx900/gfx906/gfx908 support in principle the XNACK flag, but the support is lurkwarm; + hence, GCC defaults to OFF, causing the warning + gcn mkoffload: warning: ‘-mxnack=off’ is incompatible with OpenMP's ‘self_maps’ and ‘unified_shared_memory’ clauses */ +/* { dg-prune-output "mxnack=off" } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-link-4.c b/libgomp/testsuite/libgomp.c-c++-common/target-link-4.c index 785055e216d..a624e969819 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-link-4.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-link-4.c @@ -50,3 +50,8 @@ main () q = 42; } } + +/* AMD GCN's gfx900/gfx906/gfx908 support in principle the XNACK flag, but the support is lurkwarm; + hence, GCC defaults to OFF, causing the warning + gcn mkoffload: warning: ‘-mxnack=off’ is incompatible with OpenMP's ‘self_maps’ and ‘unified_shared_memory’ clauses */ +/* { dg-prune-output "mxnack=off" } */ diff --git a/libgomp/testsuite/libgomp.fortran/self_maps.f90 b/libgomp/testsuite/libgomp.fortran/self_maps.f90 index 208fd1c71d5..8486e769101 100644 --- a/libgomp/testsuite/libgomp.fortran/self_maps.f90 +++ b/libgomp/testsuite/libgomp.fortran/self_maps.f90 @@ -47,3 +47,8 @@ do i = 0, omp_get_num_devices() !$omp end target end do end + +! AMD GCN's gfx900/gfx906/gfx908 support in principle the XNACK flag, but the support is lurkwarm; +! hence, GCC defaults to OFF, causing the warning +! gcn mkoffload: warning: ‘-mxnack=off’ is incompatible with OpenMP's ‘self_maps’ and ‘unified_shared_memory’ clauses +! { dg-prune-output "mxnack=off" }