public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Stubbs <ams@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] amdgcn: Pass -mstack-size through to runtime Date: Tue, 7 Feb 2023 09:56:01 +0000 (GMT) [thread overview] Message-ID: <20230207095601.50D9E3858D35@sourceware.org> (raw) https://gcc.gnu.org/g:196b25d7b9b73fa89ffb2f6dc73b851584f81127 commit 196b25d7b9b73fa89ffb2f6dc73b851584f81127 Author: Andrew Stubbs <ams@codesourcery.com> Date: Mon Feb 6 12:47:28 2023 +0000 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. (cherry picked from commit 45e01229af33a3dc3f124dcaec4b4ae11e9d07ce) Diff: --- gcc/ChangeLog.omp | 6 ++++++ gcc/config/gcn/mkoffload.cc | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index f7d0c439245..4205a15ef7b 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,9 @@ +2023-02-06 Andrew Stubbs <ams@codesourcery.com> + + * 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. + 2023-02-06 Andrew Stubbs <ams@codesourcery.com> * config/gcn/gcn-run.cc: Include libgomp-gcn.h. diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 14d7eedc790..3af3f717ea6 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -123,6 +123,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 @@ -701,6 +703,18 @@ process_asm (FILE *in, FILE *out, FILE *cfile) ? "val[0] != '1' || val[1] != '\\0'" : "val[0] == '1' && val[1] == '\\0'")); + /* 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); @@ -961,6 +975,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))
reply other threads:[~2023-02-07 9:56 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230207095601.50D9E3858D35@sourceware.org \ --to=ams@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).