Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] Intended semantics for ``fence seq_cst``"
2013 Jul 31
0
[LLVMdev] Intended semantics for ``fence seq_cst``
2013/7/31 JF Bastien <jfb at google.com>:
> Hi,
>
> TL;DR: should we add a new memory ordering to fences?
>
>
> ``fence seq_cst`` is currently use to represent two things:
> - GCC-style builtin ``__sync_synchronize()`` [0][1].
> - C11/C++11's sequentially-consistent thread fence
> ``std::atomic_thread_fence(std::memory_order_seq_cst)`` [2].
>
> As far
2013 Jul 31
2
[LLVMdev] Intended semantics for ``fence seq_cst``
struct {
volatile int flag;
int value;
} s;
int get_value_when_ready() {
while (s.flag) ;
__sync_synchronize();
return s.value;
}
This is "valid" legacy code on some processors, yet it's not valid to
replace __sync_synchronize with an atomic_thread_fence because, in
theory, LLVM could hoist the load of s.value. In practice it currently
doesn't, but it may in the
2013 Aug 01
0
[LLVMdev] Intended semantics for ``fence seq_cst``
Ok, so the semantics of your fence would be that it's a volatile
memory access (http://llvm.org/docs/LangRef.html#volatile-memory-accesses),
and that it provides happens-before edges for volatile accesses in the
same way that a seq_cst fence provides for atomic accesses.
FWIW, I don't think we should add that, because it's an attempt to
define behavior that's undefined for other
2013 Aug 01
2
[LLVMdev] Intended semantics for ``fence seq_cst``
> FWIW, I don't think we should add that, because it's an attempt to
> define behavior that's undefined for other reasons (the data race on
> the volatile).
I had a discussion with Chandler and others, and something I
misunderstood was pointed out: it is not an explicit goal of LLVM to
support or continue supporting legacy code that did what it had to to
express functional
2011 Aug 23
1
[LLVMdev] LLVM Concurrency and Undef
On Mon, Aug 22, 2011 at 7:35 PM, Jeffrey Yasskin <jyasskin at google.com> wrote:
> On Mon, Aug 22, 2011 at 4:20 PM, Jianzhou Zhao <jianzhou at seas.upenn.edu> wrote:
>> On Mon, Aug 22, 2011 at 6:49 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>>> On Mon, Aug 22, 2011 at 3:40 PM, Jianzhou Zhao <jianzhou at seas.upenn.edu> wrote:
>>>> On
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 of a first-class
pair of "load linked"
2011 Aug 22
0
[LLVMdev] LLVM Concurrency and Undef
On Mon, Aug 22, 2011 at 4:20 PM, Jianzhou Zhao <jianzhou at seas.upenn.edu> wrote:
> On Mon, Aug 22, 2011 at 6:49 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>> On Mon, Aug 22, 2011 at 3:40 PM, Jianzhou Zhao <jianzhou at seas.upenn.edu> wrote:
>>> On Mon, Aug 22, 2011 at 6:08 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>>>> On
2016 Jan 14
2
RFC: non-temporal fencing in LLVM IR
On Thu, Jan 14, 2016 at 1:35 PM, David Majnemer <david.majnemer at gmail.com>
wrote:
>
>
> On Thu, Jan 14, 2016 at 1:13 PM, JF Bastien <jfb at google.com> wrote:
>
>> On Thu, Jan 14, 2016 at 1:10 PM, David Majnemer via llvm-dev <
>> llvm-dev at lists.llvm.org> wrote:
>>
>>>
>>>
>>> On Wed, Jan 13, 2016 at 7:00 PM, Hans
2015 Apr 24
2
[LLVMdev] Floating point atomic load and add
> } while (__c11_atomic_compare_exchange_weak(
> addr, &oldval, newval, memory_order_seq_cst, memory_order_relaxed));
Actually, I think this condition is inverted. Should be "while
(!_c11...". Sorry about that.
Tim.
2014 Mar 07
3
[LLVMdev] [RFC] Add second "failure" AtomicOrdering to cmpxchg instruction
Hi all,
The C++11 (& C11) compare_exchange functions with explicit memory
order allow you to specify two sets of semantics, one for when the
exchange actually happens and one for when it fails. Unfortunately, at
the moment the LLVM IR "cmpxchg" instruction only has one ordering,
which means we get sub-optimal codegen.
This probably affects all architectures which use
2014 Aug 08
6
[LLVMdev] Plan to optimize atomics in LLVM
> I am planning in doing in IR, but with target specific-passes (such as X86ExpandAtomicPass)
> that just share some of the code
This would more normally be done via target hooks in LLVM, though the
principle is sound.
> But it must be target-dependent as for example on Power a
> seq_cst store has a fence before it, while on ARM it has a fence
> both before and after it (per
2013 Aug 01
0
[LLVMdev] Intended semantics for ``fence seq_cst``
On Wed, Jul 31, 2013 at 6:10 PM, JF Bastien <jfb at google.com> wrote:
> This promotion happens after opt, but before most
> architecture-specific optimizations
>
You will need to do this in the frontend. The target independent optimizers
are allowed to use the memory model.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2013 Aug 01
0
[LLVMdev] Intended semantics for ``fence seq_cst``
On Wed, Jul 31, 2013 at 6:39 PM, JF Bastien <jfb at google.com> wrote:
> > You will need to do this in the frontend. The target independent
> optimizers are allowed to use the memory model.
>
> We discussed doing this, and concluded that doing it pre-opt was overly
> restrictive on correct code. Doing it post-opt bakes the behavior into the
> portable code, so in a way
2013 Aug 01
2
[LLVMdev] Intended semantics for ``fence seq_cst``
> You will need to do this in the frontend. The target independent
optimizers are allowed to use the memory model.
We discussed doing this, and concluded that doing it pre-opt was overly
restrictive on correct code. Doing it post-opt bakes the behavior into the
portable code, so in a way it'll be reliably broken but won't penalize good
code.
FWIW it's easy to change from one to
2016 Jan 13
4
RFC: non-temporal fencing in LLVM IR
Hello, fencing enthusiasts!
*TL;DR:* We'd like to propose an addition to the LLVM memory model
requiring non-temporal accesses be surrounded by non-temporal load barriers
and non-temporal store barriers, and we'd like to add such orderings to the
fence IR opcode.
We are open to different approaches, hence this email instead of a patch.
*Who's "we"?*
Philip Reames brought
2014 May 24
3
[LLVMdev] Why can't atomic loads and stores handle floats?
Looking through the documentation, I discovered that atomic loads and
stores are only supported for integer types. Can anyone provide some
background on this? Why is this true?
Currently, given code:
std::atomic<float> aFloat;
void foo() {
float f = atomic_load(&aFloat);
..
}
Clang generates code like:||
%"struct.std::atomic.2" = type { float }
@aFloat = global
2016 Jan 15
3
RFC: non-temporal fencing in LLVM IR
On 01/14/2016 04:05 PM, Hans Boehm via llvm-dev wrote:
>
>
> On Thu, Jan 14, 2016 at 1:37 PM, JF Bastien <jfb at google.com
> <mailto:jfb at google.com>> wrote:
>
> On Thu, Jan 14, 2016 at 1:35 PM, David Majnemer
> <david.majnemer at gmail.com <mailto:david.majnemer at gmail.com>> wrote:
>
>
>
> On Thu, Jan 14, 2016 at 1:13
2016 Jan 14
2
RFC: non-temporal fencing in LLVM IR
On Thu, Jan 14, 2016 at 1:10 PM, David Majnemer via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
>
>
> On Wed, Jan 13, 2016 at 7:00 PM, Hans Boehm via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> I agree with Tim's assessment for ARM. That's interesting; I wasn't
>> previously aware of that instruction.
>>
>> My
2016 Jan 14
2
RFC: non-temporal fencing in LLVM IR
Hi JF, Philip,
Clang currently has __builtin_nontemporal_store and __builtin_nontemporal_load. How will the usage model for those change?
Thanks again,
Hal
----- Original Message -----
> From: "Philip Reames via llvm-dev" <llvm-dev at lists.llvm.org>
> To: "JF Bastien" <jfb at google.com>, "llvm-dev"
> <llvm-dev at lists.llvm.org>
>
2016 Mar 28
0
RFC: atomic operations on SI+
On Fri, Mar 25, 2016 at 02:22:11PM -0400, Jan Vesely wrote:
> Hi Tom, Matt,
>
> I'm working on a project that needs few coherent atomic operations (HSA
> mode: load, store, compare-and-swap) for std::atomic_uint in HCC.
>
> the attached patch implements atomic compare and swap for SI+
> (untested). I tried to stay within what was available, but there are
> few issues