From: Bernd Schmidt <bschmidt@redhat.com>
To: Alexander Monakov <amonakov@ispras.ru>, gcc-patches@gcc.gnu.org
Cc: Jakub Jelinek <jakub@redhat.com>, Dmitry Melnik <dm@ispras.ru>
Subject: Re: [PATCH] nvptx: implement automatic storage in custom stacks
Date: Thu, 12 Nov 2015 14:40:00 -0000 [thread overview]
Message-ID: <5644A4E5.2040908@redhat.com> (raw)
In-Reply-To: <alpine.LNX.2.20.1511121609140.3050@monopod.intra.ispras.ru>
> I'm proposing the following patch as a step towards resolving the issue with
> inaccessibility of stack storage (.local memory) in PTX to other threads than
> the one using that stack. The idea is to have preallocated stacks, and have
> __nvptx_stacks[] array in shared memory hold current stack pointers. Each
> thread is maintaining __nvptx_stacks[tid.y] as its stack pointer, thus for
> OpenMP the intent is to preallocate on a per-warp basis (not per-thread).
> For OpenMP SIMD regions we'll have to ensure that conflicting accesses are not
> introduced.
This is of course really ugly; I'd propose we keep it on an nvptx-OpenMP
specific branch for now until we know that this is really going somewhere.
> I've run it through make -k check-c regtesting. These are new fails, all
> mysterious:
These would have to be investigated first.
> + sz = (sz + keep_align - 1) & ~(keep_align - 1);
Use the ROUND_UP macro.
> + fprintf (file, "\tmul%s.u32 %%fstmp1, %%fstmp0, %d;\n",
> + bits == 64 ? ".wide" : "", bits);
Use a shift.
> +
> + if (need_softstack_decl)
> + {
> + fprintf (asm_out_file, ".extern .shared .u64 __nvptx_stacks[];\n;");
> + }
Lose excess braces.
> +.global .u64 %__softstack[16384];
Maybe declarea as .u8 so you don't have two different constants for the
stack size?
> + .reg .u64 %stackptr;
> + mov.u64 %stackptr, %__softstack;
> + cvta.global.u64 %stackptr, %stackptr;
> + add.u64 %stackptr, %stackptr, 131072;
> + st.shared.u64 [__nvptx_stacks], %stackptr;
> +
I'm guessing you have other missing pieces for setting this up for
multiple threads.
Bernd
next prev parent reply other threads:[~2015-11-12 14:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-12 13:58 Alexander Monakov
2015-11-12 14:40 ` Bernd Schmidt [this message]
2015-11-12 14:59 ` Alexander Monakov
2015-11-12 15:03 ` Bernd Schmidt
2015-11-30 10:35 ` Jakub Jelinek
2015-11-30 11:23 ` Alexander Monakov
2015-11-30 11:25 ` Jakub Jelinek
2015-11-30 11:47 ` Alexander Monakov
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=5644A4E5.2040908@redhat.com \
--to=bschmidt@redhat.com \
--cc=amonakov@ispras.ru \
--cc=dm@ispras.ru \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.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).