This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] add support for placing variables in shared memory
- From: Nathan Sidwell <nathan at acm dot org>
- To: Alexander Monakov <amonakov at ispras dot ru>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 26 Apr 2016 09:06:46 -0400
- Subject: Re: [PATCH] add support for placing variables in shared memory
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LNX dot 2 dot 20 dot 1604201957570 dot 14803 at monopod dot intra dot ispras dot ru> <5718DCF0 dot 5000808 at acm dot org> <alpine dot LNX dot 2 dot 20 dot 1604211708150 dot 20393 at monopod dot intra dot ispras dot ru> <571A226B dot 9020906 at acm dot org> <alpine dot LNX dot 2 dot 20 dot 1604221638001 dot 24838 at monopod dot intra dot ispras dot ru> <571E2E0F dot 7040204 at acm dot org> <alpine dot LNX dot 2 dot 20 dot 1604251954290 dot 5702 at monopod dot intra dot ispras dot ru>
On 04/25/16 13:49, Alexander Monakov wrote:
On Mon, 25 Apr 2016, Nathan Sidwell wrote:
acceptable?
No, that really doesn't sound viable. You'd need to somehow take into account
every instance where the compiler attempts to switch sections internally
(.text/.data/.bss, -ffunction-sections/-fdata-sections etc.).
Hm, -f{function/data}=sections would be the killer here.
Ugh. Checking DECL_INITIAL in nvptx_encode_section_info would be much
simpler (and that's how other backends perform a similar test).
If that's available, then great.
Note, rejecting zero-initializers is debatable:
C and C++ don't have a concept of uninitialized global-scope data; if
the initializer is missing, it's exactly as if it was 0. However, GCC has
-fcommon enabled by default (which, btw, shouldn't we change on NVPTX?), and
that makes a difference: 'int v = 0;' is a strong definition, while 'int v;'
becomes a common symbol, and ultimately a weak definition on NVPTX.
So if all-zeros initializers are rejected, to make a strong definition of a
shared variable one would have to write:
I think we should reject the cases where the backend gets to see an explicit
initializer.
fno-common would be a good default for PTX (I had thought it was already on?)
nathan