[LLVMdev] parallel loop metadata simplification

Pekka Jääskeläinen pekka.jaaskelainen at tut.fi
Thu Feb 28 13:21:24 PST 2013


Hi Paul,

On 02/28/2013 09:30 PM, Redmond, Paul wrote:
> I'd like to reopen the discussion on requiring the
> llvm.mem.parallel_loop_access metadata. I understand the reason for the
> metadata is to protect against transformations that may introduce unsafe
> parallel memory accesses (the reg2mem example.) I'm wondering if perhaps we
> can make the metadata more user-friendly by providing a single loop metadata
> which can be expanded into "safer" metadata as required. Specifically a loop
> pass could be added that expands llvm.loop.parallel into
> llvm.loop.parallel_protected + llvm.mem.parallel_loop_access.

Did I understand this correctly: llvm.loop.parallel would become
a version which does not require the parallel_loop_access? Basically it
would be a placeholder for a later pass (before unsafe optimizations?) that
converts it to the "safe" metadata pair? Then you can generate the loads/stores
in Clang without worrying about the mem metadata but add the safe
metadata once and for all.

The problem I see with this is that I do not think there is use for
"unsafe"/"unprotected" parallel metadata after Clang. Thus, the
"unprotected metadata" would be merely book keeping until the final IR is
generated in Clang (with the safe metadata). Maybe some other book keeping
mechanism could do? If it's not easily workable (I'm not a Clang expert)
then I'd propose a descriptive name for the new metadata like 
llvm.loop.parallel_under_construction that strongly states that
it's for this purpose only and should not be used for anything
during optimizations (as it's not safe to do so!).

-- 
--Pekka



More information about the llvm-dev mailing list