search for: atomicrmw

Displaying 20 results from an estimated 71 matches for "atomicrmw".

2011 Oct 29
1
[LLVMdev] atomicrmw
Hi! It is said in http://llvm.org/docs/LangRef.html#i_atomicrmw there is an atomicrmw opcode. But: store i8 %2, i8* %tape1.sub %3 = atomicrmw add i8* %tape1.sub, i8 1 acquire fails with: llc: test.bc:13:9: error: expected instruction opcode %3 = atomicrmw add i8* %tape1.sub, i8 1 acquire How can I do *ptr = *ptr + val with LLVM ?
2015 Dec 11
2
RFC: Extending atomic loads and stores to floating point and vector types
...re any? Same for loads? >> >> >> I'd go a bit further: should you also support basic FP operations >> atomically? The above C++ paper adds add/sub, and we've discussed >> adding FMA as well. > Just to be clear, I assume you mean extending the atomicrmw, and > cmpxchg instructions right? I agree this is worth doing, but I'm > purposely separating that into a possible later proposal. I don't > need this right now and keeping the work scoped reasonably is key > to making progress. > > > It seems a unfor...
2015 Apr 24
4
[LLVMdev] Floating point atomic load and add
Hello, I'm wondering how I can create an atomic load and add instruction for floating point values. If I use IRBuilder::CreateAtomicRMW() I get the error message: "atomicrmw operand must have integer type". I am using LLVM 3.4 and the only system I need to support is x86.
2014 Jan 03
2
[LLVMdev] AtomicRMW Additions
All, I was wondering if the following operations could be implemented atomically in LLVM (a la AtomicRMW): Multiplication, Division, Remainder, Bit Shifting, or Logical Not (this could be implemented by xor with a value of all 1's). Is there a reason implementation-wise that they are not there? Additionally, would it be possible to create something similar to AtomicRMW that returned the new valu...
2011 Nov 19
1
[LLVMdev] PTX backend support for atomics
Looking further during down time at the dev meeting today, it actually seems that PTX atom.* and red.* intrinsics map extremely naturally onto the LLVM atomicrmw and cmpxchg instructions. The biggest issue is that a subset of things expressible with these LLVM instructions do not trivially map to PTX, and the range of things naturally supported depends on the features of a given target. With sufficient effort, all possible uses of these instructions could b...
2018 Jun 13
12
RFC: Atomic LL/SC loops in LLVM revisited
...ese can be given as parameters to the atomic operations supported in LLVM IR: * Fences with the fence instruction * Atomic load and store with the 'load atomic' and 'store atomic' variants of the load/store instructions.. * Fetch-and-binop / read-modify-write operations through the atomicrmw instruction. * Compare and exchange via the cmpxchg instruction. Takes memory ordering for both success and failure cases. Can also specify a 'weak' vs 'strong' cmpxchg, where the weak variant allows spurious failure ## Background: Atomics in RISC-V For full details see a recent d...
2015 Dec 11
2
RFC: Extending atomic loads and stores to floating point and vector types
...anonicalization here. Are there any? Same for > loads? > > > I'd go a bit further: should you also support basic FP operations > atomically? The above C++ paper adds add/sub, and we've discussed > adding FMA as well. Just to be clear, I assume you mean extending the atomicrmw, and cmpxchg instructions right? I agree this is worth doing, but I'm purposely separating that into a possible later proposal. I don't need this right now and keeping the work scoped reasonably is key to making progress. > > This raises similar issues around FP exceptions (are t...
2014 May 29
4
[LLVMdev] Proposal: "load linked" and "store conditional" atomic instructions
Hi, I've been looking at improving atomicrmw & cmpxchg code more, particularly on architectures using the load-linked/store-conditional model. The summary is that current expansion for cmpxchg seems to happen too late for LLVM to make meaningful use of the opportunities it provides. I'd like to move it earlier and express it in terms...
2013 May 14
2
[LLVMdev] Keeping Clang from changing function calls to IR operations: cmpxchg
I'm working on getting the LLVM/projects/Test-Suite/UnitTest to compile for a target that I am developing. There is an example: AtomicOps, that uses calls to: __sync_fetch_and_add __sync_val_compare_and_swap __sync_lock_test_and_set These get converted into llvm IR operations like: atomicrmw cmpxchg Is there any way to keep these as function calls, as they are easier to map to the target's eventual functional then having to deal with atomicrmw and cmpxchg -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/at...
2018 Sep 14
5
RFC: Adding a !thread.private metadata
...hey, that's interesting" case at the moment.  It's not a major blocking item or anything.  As such, I'm mostly throwing this out for discussion because it's interesting.) Proposed Solution Add a new metadata type which applies to memory accessing instructions (store, load, atomicrmw, etc...) and indicates that the memory location accessed is known to be accessed only by a single thread everywhere it is dereferenceable. The framing is very similar to the one we use for !invariant.load and for much the same reasons.  If we can prove a location is dereferenceable, we want to...
2012 Sep 14
4
[LLVMdev] Atomic ops cannot be built from C/OCaml bindings
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 c...
2018 Jun 14
2
RFC: Atomic LL/SC loops in LLVM revisited
...nd I've never even seen > anyone attempt to get good CodeGen out of it (simplest example being > "add xD, xD, #1" in the loop for an increment but there are obviously > more). Doing so would almost certainly involve duplicating a lot of > basic arithmetic instructions into AtomicRMW variants. Let's separate the concerns here: 1) Quality of codegen within the LL/SC loop * What is the specific concern here? The LL/SC loop contains a very small number of instructions, even for the masked atomicrmw case. Are you worried about an extra arithmetic instruction or two? Sub-opti...
2011 Jul 31
2
[LLVMdev] Reviving the new LLVM concurrency model
On Sun, Jul 31, 2011 at 12:49 PM, Jianzhou Zhao <jianzhou at seas.upenn.edu> wrote: > I noticed the patch was already merged into the current LLVM language > reference manual with new memory instructions, fence, cmpxchg and > atomicrmw. Will the instructions be available in LLVM 3.0? Hopefully, yes; the implementation is in progress. -Eli
2011 Nov 01
0
[LLVMdev] PTX backend support for atomics
On Mon, Oct 31, 2011 at 3:15 PM, Jonathan Ragan-Kelley <jrk at csail.mit.edu>wrote: > I notice that there is not currently any intrinsic support for atomics in > the PTX backend. Is this on the roadmap? Should it be as easy to add as it > seems (plumbing through just like the thread ID instructions, &c.)? The > obvious difference is that these ops have side effects. > It
2011 Oct 31
2
[LLVMdev] PTX backend support for atomics
I notice that there is not currently any intrinsic support for atomics in the PTX backend. Is this on the roadmap? Should it be as easy to add as it seems (plumbing through just like the thread ID instructions, &c.)? The obvious difference is that these ops have side effects. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type:
2012 Oct 24
0
[LLVMdev] Atomic ops cannot be built from C/OCaml bindings
...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 sh...
2018 Jul 24
2
Possibility of implementing a low-level naive lock purely with LLVM atomics?
Hi: In our frontend we are attempting to build a lock mechanism without using system apis like pthreads and whatnot for internal reasons. In order to achieve this we are now creating a int32 type GV, and then use atomic load/store and comparisons. The generated IR looks like the following: ``` @Flag = private global i32 0, align 4 %0 = load atomic i32, i32* @Flag acquire, align 4 %1 = icmp eq
2017 Jan 19
4
[RFC] IR-level Region Annotations
...can begin with regions and metadata annotations, and then “promote” a few features to first-class instructions if the benefit is justified. Does that make sense? > Also I think we already have a lot of > simple constructs in the IR to express high-level information properly, > e.g. 'atomicrmw' instructions for high-level reduction. While we currently > lack analysis passes to extract information from such low-level > representations, these are certainly possible [2,3]. I would argue that such > analysis are a better way to do things than placing "high-level intrinsics...
2020 Feb 10
3
atomic ops are optimized with incorrect semantics .
Hi All, With the "https://gcc.godbolt.org/z/yBYTrd" case . the atomic is converted to non atomic ops for x86 like from xchg dword ptr [100], eax to mov dword ptr [100], 1 the pass is responsible for this tranformation was instCombine i.e InstCombiner::visitAtomicRMWInst which converts the IR like %0 = atomicrmw xchg i32* inttoptr (i64 100 to i32*), i32 1 monotonic to store atomic i32 1, i32* inttoptr (i64 100 to i32*) monotonic, align 4 which is valid for relax(monotonic) and release ordering as per the code out there. we think that,its the inst lowering...
2012 Feb 07
2
[LLVMdev] Vectorization: Next Steps
...is more than reasonable. > #pragma assert parallel > for (unsigned i = 0; i < n; i++) { > unsigned loc = int_fetch_add(start[src[i]], 1); > dst[loc] = src[i]; > } As the int_fetch_add is side effect free, it is fully polyhedral. It can be implemented with the relevant LLVM atomicrmw instruction [1]. Polly does not yet allow atomicrmw instructions, but adding support for them should not be too difficult. If polly get's the additional #pragma information, it can remove all dependences and it can execute the code in parallel. This is also not implemented, but seems doable...