On 28/10/2026 17:18, Tobias Burnus wrote:
While the patch looks to be against OG16, I think it applies at
least in principle to mainline, which as:

gcc/config/gcn/mkoffload.cc:  const char *collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS"); gcc/config/nvptx/mkoffload.cc:  const char *collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS");

I think it would be good to have it fixed on mainline for both
archs - which I think PA was also suggesting for GCN.

In any case: Is the likewise patch for GCN - and NVPTX - mainline
okay, Andrew & Thomas? (getenv -> read_collect_gcc_options)

This is not needed for:

  const char *collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS");
  if (!collect_gcc_options) ...

which only checks whether the env var is set but does not look up its value.

The SIMT instance the patch fixes (which is OG16-only indeed) is the only one actually reading the value.

Tobias

Andrew Stubbs wrote:
On 28/10/2026 15:48, Paul-Antoine Arras wrote:
Since r17-1526-g619a5e5586759a
"driver: Spill long COLLECT_GCC_OPTIONS to a response file [PR111527]"
it is not safe to use a raw getenv call to read COLLECT_GCC_OPTIONS.

As a result, with a command line longer than 1024, the check for
--param=offload-gpu-mode=simt in mkoffload never saw the option and did not add
-msimt. OpenMP offload compilations then failed with
"'--param=offload-gpu-mode=simt-directed|simt' is incompatible with
'-no-msimt'", and OpenACC ones ICEd in gen_oacc_fork.

gcc/ChangeLog:

    * config/gcn/mkoffload.cc (main): Use read_collect_gcc_options
    instead of getenv to read COLLECT_GCC_OPTIONS.
---
  gcc/config/gcn/mkoffload.cc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc
index f6b61cf4ea7..b79c0e215ef 100644
--- a/gcc/config/gcn/mkoffload.cc
+++ b/gcc/config/gcn/mkoffload.cc
@@ -1134,7 +1134,7 @@ main (int argc, char **argv)
    /* Add -msimt when in SIMT mode, but that option doesn't get passed directly
       to mkoffload, so let's check the environment.  */
-  const char *collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS");
+  const char *collect_gcc_options = read_collect_gcc_options ();
    if (collect_gcc_options
        && strstr (collect_gcc_options, "--param=offload-gpu- mode=simt"))
      simt = true;

Presumably this is for OG16?

LGTM.

Andrew




--
PA

Reply via email to