On 04/21/16 10:25, Alexander Monakov wrote:
On Thu, 21 Apr 2016, Nathan Sidwell wrote:
On 04/20/16 12:58, Alexander Monakov wrote:
Allow using __attribute__((shared)) to place static variables in '.shared'
memory space.

What is the rationale for a new attribute, rather than leveraging the existing
section(".shared") machinery?

Section switching does not work at all on NVPTX in GCC at present.  PTX
assembly has no notion of different data sections, so the backend does not
advertise section switching capability to the middle end.

Correct.  How is that relevant?  Look at DECL_SECTION_NAME in 
encode_section_info.

CUDA C does it via attributes too, and there's no point in diverging
gratuitously I think.

Also correct. It seems you're trying to make the compiler look like CUDA rather than fit new features into existing idioms.

I avoided using 'static' because it applies to external declarations as well.
Other backends use "%qE attribute not allowed with auto storage class"; I'll
be happy to switch to that for consistency.


Why can it not be applied to external declarations? Doesn't '.extern .shared whatever' work?


Why can it not apply to variables of auto storage? I.e. function scope, function lifetime? That would seem to be a useful property.

What happens if an initializer is present, is it silently ignored? thinking further the uninitialized behaviour might be a reason for not going with section(".shared").

nathan

Reply via email to