diff options
author | Andrew Stubbs <ams@codesourcery.com> | 2023-02-06 12:47:28 +0000 |
---|---|---|
committer | Andrew Stubbs <ams@codesourcery.com> | 2023-02-06 17:14:06 +0000 |
commit | 45e01229af33a3dc3f124dcaec4b4ae11e9d07ce (patch) | |
tree | 45f9c11dc58fb4fbd25f61693629359e8b9e3e5f /gcc | |
parent | 7433747543195a4b936892d066b10026509512b7 (diff) | |
download | gcc-45e01229af33a3dc3f124dcaec4b4ae11e9d07ce.zip gcc-45e01229af33a3dc3f124dcaec4b4ae11e9d07ce.tar.gz gcc-45e01229af33a3dc3f124dcaec4b4ae11e9d07ce.tar.bz2 |
amdgcn: Pass -mstack-size through to runtime
But only for the offload case.
gcc/ChangeLog:
* config/gcn/mkoffload.cc (gcn_stack_size): New global variable.
(process_asm): Create a constructor for GCN_STACK_SIZE.
(main): Parse the -mstack-size option.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/gcn/mkoffload.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 9c262f9..9493f89 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -117,6 +117,8 @@ uint32_t elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX803; // Default GPU architecture. uint32_t elf_flags = (EF_AMDGPU_FEATURE_XNACK_ANY_V4 | EF_AMDGPU_FEATURE_SRAMECC_ANY_V4); +static int gcn_stack_size = 0; /* Zero means use default. */ + /* Delete tempfiles. */ void @@ -662,6 +664,18 @@ 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); @@ -920,6 +934,10 @@ main (int argc, char **argv) elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX908; else if (strcmp (argv[i], "-march=gfx90a") == 0) elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX90a; +#define STR "-mstack-size=" + else if (startswith (argv[i], STR)) + gcn_stack_size = atoi (argv[i] + strlen (STR)); +#undef STR } if (!(fopenacc ^ fopenmp)) |