On Mon, Nov 30, 2015 at 02:14:41PM +0300, Alexander Monakov wrote:
> On Mon, 30 Nov 2015, Jakub Jelinek wrote:
> > Does your patch affect all the stack allocations within certain function
> > (i.e. no way to select on a per-variable bases what stack to allocate it
> > to)?  Without any detailed analysis at least e.g. spilled (non-addressable)
> > vars could at least go to the local stack.  But PTX doesn't have any spills,
> > right?  Not sure about HSA.  If it is a per-function thing only, then it
> > isn't worth to do more detailed analysis at the ompexp time.
> 
> Yes, there's no register allocation and thus no spills on PTX.
>  
> > BTW, surely it will be an advantage if PTX can support alloca through this,
> > it could e.g. turn on -msoft-stack for all functions that use alloca/VLAs
> > automatically.
> 
> Yes, I'm going to support alloca on soft stacks, but, -msoft-stack has a
> prerequisite of soft stacks being initially set up.  Therefore I'm treating it
> as an ABI variant (together with another option to handle atomics and
> "syscalls" outside of simd regions), and building a separate multilib for
> that.  So I see it the other way around: it's not safe for the compiler to
> always use soft-stacks for alloca (because OpenACC wouldn't set up soft
> stacks), but if soft stacks are enabled, alloca can use them.
> 
> In the multilib variant that I'm introducing, all addressable vars go to soft
> stacks, and classic .local stacks are used rarely, e.g. for stdarg passing,
> and implicitely for calls/returns (and after JIT, they'll service register
> spills too).

Does it really have to be a full multilib?  I mean, the only precondition is
that something sets up the var, right?  Would the OpenACC folks be willing
to set it up too?  For stuff like libc, functions that are ECF_LEAF builtins
IMHO really don't care whether they are built as -msoft-stack or not, they
shouldn't be passing addresses of local vars to code that could use OpenMP.
The only question is if say qsort or other functions that call user callbacks
could be passing addresses of local vars to those callbacks, or whether they
only pass addresses passed from callers, or addresses of heap objects.

        Jakub

Reply via email to