Renato Golin
2010-Apr-27 16:01 UTC
[LLVMdev] Proposal for a new LLVM concurrency memory model
On 27 April 2010 16:46, David Greene <dag at cray.com> wrote:> It shouldn't be very hard for the compiler to detect the second case. > It's a pretty straightforward pattern. For everything else it would > have to assume case #1.The only problem is that threads are rarely within language specs, so the compiler would have to choose one particular flavour of threads or "find out" what flavour is being used. That would require the compiler to know all / implement all types, which are not only time consuming and error prone, but not the compiler's job in the first place. cheers, --renato http://systemcall.org/ Reclaim your digital rights, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm
David Greene
2010-Apr-27 16:28 UTC
[LLVMdev] Proposal for a new LLVM concurrency memory model
On Tuesday 27 April 2010 11:01:16 Renato Golin wrote:> On 27 April 2010 16:46, David Greene <dag at cray.com> wrote: > > It shouldn't be very hard for the compiler to detect the second case. > > It's a pretty straightforward pattern. For everything else it would > > have to assume case #1. > > The only problem is that threads are rarely within language specs, so > the compiler would have to choose one particular flavour of threads or > "find out" what flavour is being used. That would require the compiler > to know all / implement all types, which are not only time consuming > and error prone, but not the compiler's job in the first place.The compiler has to know the threading model. There's no way around that. gcc has the -pthread switch, for example. The compiler integrates into a comprehensive programming environment. It has to know what the environment provides and uses. That _is_ very much the compiler's responsibility. That's why target-independent code is so hard to write. :) Again, my vote is to define vector atomics as respecting atomicity across elements and make it the compiler's and user's job to know when it can use them. -Dave
Renato Golin
2010-Apr-27 17:16 UTC
[LLVMdev] Proposal for a new LLVM concurrency memory model
On 27 April 2010 17:28, David Greene <dag at cray.com> wrote:> The compiler integrates into a comprehensive programming environment. > It has to know what the environment provides and uses. That _is_ very much > the compiler's responsibility.I agree the compilers should know about threads, but enough to work around the issues and not start creating threads the user didn't ask for. I'm not against enhancing the compiler to that point, I just think that you're digging too deep and Balrog might show up unexpectedly. Thread issues can be daunting by themselves, automatically creating threaded code is a recipe to disaster, IMHO.> Again, my vote is to define vector atomics as respecting atomicity across > elements and make it the compiler's and user's job to know when it can use > them.By means of #pragmas? cheers, --renato http://systemcall.org/ Reclaim your digital rights, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm
Seemingly Similar Threads
- [LLVMdev] Proposal for a new LLVM concurrency memory model
- [LLVMdev] Proposal for a new LLVM concurrency memory model
- [LLVMdev] Proposal for a new LLVM concurrency memory model
- [LLVMdev] Proposal for a new LLVM concurrency memory model
- [LLVMdev] Proposal for a new LLVM concurrency memory model