On Wed, Oct 21, 2015 at 03:09:55PM -0400, Nathan Sidwell wrote: > Bernd, any comments?
Just a few questions, otherwise it is a PTX territory you PTX maintainers should review. > (*oacc_ntid_insn, oacc_ntid, *oacc_tid_insn, oacc_tid): Delete. Extra space. > +/* Size of buffer needed to broadcast across workers. This is used > + for both worker-neutering and worker broadcasting. It is shared > + by all functions emitted. The buffer is placed in shared memory. > + It'd be nice if PTX supported common blocks, because then this > + could be shared across TUs (taking the largest size). */ > +static unsigned worker_bcast_hwm; As discussed in another thread for another patch, is hwm the best acronym here? If it is the size, then why not worker_bcast_size? > @@ -2129,6 +3242,19 @@ nvptx_file_end (void) > FOR_EACH_HASH_TABLE_ELEMENT (*needed_fndecls_htab, decl, tree, iter) > nvptx_record_fndecl (decl, true); > fputs (func_decls.str().c_str(), asm_out_file); > + > + if (worker_bcast_hwm) > + { > + /* Define the broadcast buffer. */ > + > + worker_bcast_hwm = (worker_bcast_hwm + worker_bcast_align - 1) > + & ~(worker_bcast_align - 1); > + > + fprintf (asm_out_file, "// BEGIN VAR DEF: %s\n", worker_bcast_name); > + fprintf (asm_out_file, ".shared .align %d .u8 %s[%d];\n", > + worker_bcast_align, > + worker_bcast_name, worker_bcast_hwm); > + } So, is the worker broadcast buffer effectively a file scope .shared variable? My worry is that as .shared is quite limited resource, if you compile many TUs and each allocates its own broadcast buffer you run out of shared memory. Is there any way how to share the broadcast buffers in between different TUs (other than LTO)? Jakub