From: Andrew Stubbs <ams@codesourcery.com>
To: Tobias Burnus <tobias@codesourcery.com>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch] gcn: Add __builtin_gcn_{get_stack_limit,first_call_this_thread_p}
Date: Fri, 18 Nov 2022 17:49:41 +0000 [thread overview]
Message-ID: <fbcfe3a7-1275-4906-f576-03695605f603@codesourcery.com> (raw)
In-Reply-To: <1bec26d6-e2c5-3408-4f61-0fb17e730b3e@codesourcery.com>
On 18/11/2022 17:20, Tobias Burnus wrote:
> This patch adds two builtins (getting end-of-stack pointer and
> a Boolean answer whether it was the first call to the builtin on this
> thread).
>
> The idea is to replace some hard-coded values in newlib, permitting to move
> later to a manually allocated stack on the compiler side without the
> need to
> modify newlib again. The GCC patch matches what newlib did in reent; I
> could
> imagine that we change this later on.
>
> Lightly tested (especially by visual inspection).
> Currently doing a final regtest, OK when it passes?
>
> Any comments to this patch - or the attached newlib patch?*
>
> Tobias
>
> (*) I also included a patch to newlib to see where were are heading
> + to actually use them for regtesting ...
This looks wrong:
> + /* stackbase = (stack_segment_decr & 0x0000ffffffffffff)
> + + stack_wave_offset);
> + seg_size = dispatch_ptr->private_segment_size;
> + stacklimit = stackbase + seg_size*64;
> + with segsize = dispatch_ptr + 6*sizeof(int16_t) + 3*sizeof(int32_t);
> + cf. struct hsa_kernel_dispatch_packet_s in the HSA doc. */
> + rtx ptr;
> + if (cfun->machine->args.reg[DISPATCH_PTR_ARG] >= 0
> + && cfun->machine->args.reg[PRIVATE_SEGMENT_BUFFER_ARG] >= 0)
> + {
> + rtx size_rtx = gen_rtx_REG (DImode,
> + cfun->machine->args.reg[DISPATCH_PTR_ARG]);
> + size_rtx = gen_rtx_MEM (DImode,
> + gen_rtx_PLUS (DImode, size_rtx,
> + GEN_INT (6*16 + 3*32)));
> + size_rtx = gen_rtx_MULT (DImode, size_rtx, GEN_INT (64));
> +
seg_size is calculated from the private_segment_size loaded from the
dispatch_ptr, not calculated from the dispatch_ptr itself.
Andrew
next prev parent reply other threads:[~2022-11-18 17:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 17:20 Tobias Burnus
2022-11-18 17:49 ` Andrew Stubbs [this message]
2022-11-19 10:46 ` Tobias Burnus
2022-11-20 0:23 ` Andrew Stubbs
2022-11-21 13:41 ` Tobias Burnus
2022-11-21 14:58 ` Stubbs, Andrew
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=fbcfe3a7-1275-4906-f576-03695605f603@codesourcery.com \
--to=ams@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=tobias@codesourcery.com \
/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: link
Be 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).