[LLVMdev] [RFC] Parallelization metadata and intrinsics in LLVM

Renato Golin rengolin at systemcall.org
Wed Aug 15 03:56:48 PDT 2012


On 15 August 2012 11:04, Raghavendra, Prakash
<Prakash.Raghavendra at amd.com> wrote:
> My idea is to capture parallelism with the way you have said using
> ‘metadata’. I agree to record the parallel regions in the metadata (as given by the user). However, we
> could also give placeholders to record any additional information that the compiler writer needs like
> number of threads, scheduling parameters, chunk size, etc etc which are specific perhaps to
> OpenMP.

Hi Prakash,

I can't see the silver bullet you do. Different types of parallelism
(thread/process/network/heterogeneous) have completely different
assumptions, and the same keyword can mean different things, depending
on the context. If you try to create a magic metadata that will cover
from OpenCL to OpenMP to MPI, you'll end up having to have namespaces
in metadata, which is the same as having N different types of
metadata.

If there was a language that could encompass the pure meaning of
parallelism (Oracle just failed building that), one could assume many
things for each paradigm (OpenCL, mp, etc) much easier than trying to
fit the already complex rules of C/C++ into the even more complex
rules of target/vendor-dependent behaviour. OpenCL is supposed to be
less of a problem in that, but the target is so different that I
wouldn't try to merge OpenCL keywords with OpenMP ones.

True, you can do that with a handful of basic concepts, but the more
obscure ones will break your leg. And you *will* have to implement
them. Those of us unlucky enough to have to have implement bitfields,
anonymous unions, volatile and C++ class layout know what I mean by
that.

True, we're talking about the language-agnostic LLVM IR, but you have
to remember that LLVM IR is build from real-world languages, and thus,
full of front-end hacks and fiddles to tell the back end about the ABI
decisions in a generic way.

I'm still not convinced there will be a lot of shared keywords between
all parallel paradigms, ie. that you can take the same IR and compile
to OpenCL, or OpenMP, or MPI, etc and it'll just work (and optimise).

-- 
cheers,
--renato

http://systemcall.org/




More information about the llvm-dev mailing list