Some of you may have noticed that I addedd include/llvm/System/ Atomics.h to the repository briefly, which will be used for adding support for threading in LLVM. I have tried to provided appropriate implementations of the atomic ops (currently memory fence and CAS) for platforms we care about, but my knowledge of these, and my ability to test them, is limited. So, please, if you run on any less common platform, test out the file, and send me patches to improve it if it doesn't work verbatim on your system. Thanks, --Owen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4463 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090516/fe19e9cd/attachment.bin>
Hi, You might want to use this: http://www.hpl.hp.com/research/linux/atomic_ops/ Zoltan On Sat, May 16, 2009 at 11:11 PM, Owen Anderson <resistor at mac.com> wrote:> Some of you may have noticed that I addedd include/llvm/System/Atomics.h to > the repository briefly, which will be used for adding support for threading > in LLVM. > > I have tried to provided appropriate implementations of the atomic ops > (currently memory fence and CAS) for platforms we care about, but my > knowledge of these, and my ability to test them, is limited. So, please, if > you run on any less common platform, test out the file, and send me patches > to improve it if it doesn't work verbatim on your system. > > Thanks, > > --Owen > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090517/6ac99301/attachment.html>
Surprisingly enough, libatomic_ops doesn't define just a hardware memory fence call as far as I can tell. --Owen On May 16, 2009, at 3:00 PM, Zoltan Varga wrote:> Hi, > > You might want to use this: > > http://www.hpl.hp.com/research/linux/atomic_ops/ > > Zoltan > > On Sat, May 16, 2009 at 11:11 PM, Owen Anderson <resistor at mac.com> > wrote: > Some of you may have noticed that I addedd include/llvm/System/ > Atomics.h to the repository briefly, which will be used for adding > support for threading in LLVM. > > I have tried to provided appropriate implementations of the atomic > ops (currently memory fence and CAS) for platforms we care about, > but my knowledge of these, and my ability to test them, is limited. > So, please, if you run on any less common platform, test out the > file, and send me patches to improve it if it doesn't work verbatim > on your system. > > Thanks, > > --Owen > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090516/f560bd15/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4463 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090516/f560bd15/attachment.bin>
Actually, I take that back. The non-obviously named AO_nop_full() what I want. :-) --Owen On May 16, 2009, at 3:00 PM, Zoltan Varga wrote:> Hi, > > You might want to use this: > > http://www.hpl.hp.com/research/linux/atomic_ops/ > > Zoltan > > On Sat, May 16, 2009 at 11:11 PM, Owen Anderson <resistor at mac.com> > wrote: > Some of you may have noticed that I addedd include/llvm/System/ > Atomics.h to the repository briefly, which will be used for adding > support for threading in LLVM. > > I have tried to provided appropriate implementations of the atomic > ops (currently memory fence and CAS) for platforms we care about, > but my knowledge of these, and my ability to test them, is limited. > So, please, if you run on any less common platform, test out the > file, and send me patches to improve it if it doesn't work verbatim > on your system. > > Thanks, > > --Owen > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090516/16479e63/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4463 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090516/16479e63/attachment.bin>
Owen Anderson wrote:> Some of you may have noticed that I addedd include/llvm/System/Atomics.h > to the repository briefly, which will be used for adding support for > threading in LLVM.Just out of curiosity, is there a design document somewhere for the plan for threading? Also, atomic ops are usually pretty low level things used for nonblocking algorithms or to build higher level locking constructs. Is that the plan here too? It seems like you'd want to avoid anything too fancy since LLVM has to run on so many different architectures with their variety of memory semantics, etc. Luke> > I have tried to provided appropriate implementations of the atomic ops > (currently memory fence and CAS) for platforms we care about, but my > knowledge of these, and my ability to test them, is limited. So, > please, if you run on any less common platform, test out the file, and > send me patches to improve it if it doesn't work verbatim on your system. > > Thanks, > > --Owen > > > ------------------------------------------------------------------------ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
OK, I've enhanced Atomic.h by pulling in a bunch of implementations from libatomic_ops, and others that I could figure out on my own. Again, my plea: PLEASE TRY THIS OUT ON YOUR PLATFORM, AND SEND ME PATCHES IF IT DOESN'T WORK! Similarly, if you think the implementation could be improved for your platform, send me a patch. I know that Sparc doesn't work currently (no CAS implementation yet), and I'm a little unsure about the ARM version, so it'd be great if gurus for those platforms could look at them. --Owen On May 16, 2009, at 3:00 PM, Zoltan Varga wrote:> Hi, > > You might want to use this: > > http://www.hpl.hp.com/research/linux/atomic_ops/ > > Zoltan > > On Sat, May 16, 2009 at 11:11 PM, Owen Anderson <resistor at mac.com> > wrote: > Some of you may have noticed that I addedd include/llvm/System/ > Atomics.h to the repository briefly, which will be used for adding > support for threading in LLVM. > > I have tried to provided appropriate implementations of the atomic > ops (currently memory fence and CAS) for platforms we care about, > but my knowledge of these, and my ability to test them, is limited. > So, please, if you run on any less common platform, test out the > file, and send me patches to improve it if it doesn't work verbatim > on your system. > > Thanks, > > --Owen > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090516/6fae4db3/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4463 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090516/6fae4db3/attachment.bin>
On May 16, 2009, at 7:47 PM, Luke Dalessandro wrote:> Owen Anderson wrote: >> Some of you may have noticed that I addedd include/llvm/System/ >> Atomics.h >> to the repository briefly, which will be used for adding support for >> threading in LLVM. > > Just out of curiosity, is there a design document somewhere for the > plan > for threading?Not as yet. Chris may have ideas in this direction, but I don't think they're been written down anywhere. For now, I'm just trying to enhance the thread-safety of some obviously unsafe pieces of code.> Also, atomic ops are usually pretty low level things used for > nonblocking algorithms or to build higher level locking constructs. Is > that the plan here too? It seems like you'd want to avoid anything too > fancy since LLVM has to run on so many different architectures with > their variety of memory semantics, etc.I totally agree. However, at least one case of thread-unsafety (ManagedStatic), has proven very-difficult-to-impossible to implement correctly without using lower-level operations. --Owen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4463 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090516/37f0253c/attachment.bin>