[LLVMdev] Atomic ops cannot be built from C/OCaml bindings

Jonathan Ragan-Kelley jrk at csail.mit.edu
Fri Nov 2 10:38:56 PDT 2012


Take two, since I didn't hear anything last time I posted about this.

I have rebased the patch onto the trunk as of a few minutes ago and am
attaching it here as a patch. I'd really like to see this go in before
3.2.

test_llvm_atom.ml is a standalone OCaml program which uses the new
interface to generate a bunch of atomic ops. It need not be included
in the repository, I'm just adding it here to help anyone who wants to
sanity check the bindings.

Thanks!

On Wed, Oct 24, 2012 at 4:02 PM, Jonathan Ragan-Kelley
<jrk at csail.mit.edu> wrote:
> I finally got around to adding these.
>
> The patch is posted in a pull request on my copy of llvm.git:
>
>   https://github.com/jrk/llvm/pull/3
>
> and a simple test with OCaml is here:
>
>   https://gist.github.com/3948460
>
> Feedback welcome.
>
> On Sep 14, 2012, at 7:53 PM, Jonathan Ragan-Kelley <jrk at csail.mit.edu> wrote:
>
>> Forgive me if I'm missing something obvious, but it seems that a
>> number of core instructions—I'm specifically running in to
>> `atomicrmw`, `fence`, and `cmpxchg` at the moment—cannot be
>> constructed from the C bindings, and are therefore also inaccessible
>> to the OCaml bindings. There are opcodes for each of these in the
>> llvm-c/Core.h, but there seems to be no way to construct them.
>>
>> Is there a reason these should be omitted?
>>
>> (I am currently running into this trying to use NVPTX, where CUDA
>> atomics are largely built from the native atomic instructions, in a
>> compiler written in OCaml.)
>>
>> Thanks.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-atomicrmw-cmpxchg-to-llvm-c-OCaml-interfaces.patch
Type: application/octet-stream
Size: 8147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121102/e1479ebf/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_llvm_atom.ml
Type: application/octet-stream
Size: 2505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121102/e1479ebf/attachment-0001.obj>


More information about the llvm-dev mailing list