[llvm] [BPF] Lower ATOMIC_FENCE: real barrier for cross-thread seq_cst, no-op otherwise (PR #196734)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 13 04:50:27 PDT 2026
bidhan-a wrote:
> > @4ast
> > Are you suggesting generating an atomic exchange (xchg) on a stack slot for SeqCst, similar to x86?
> > We can do that but my understanding is that the BPF stack is per invocation and private to the current program execution, so I’m not sure what it would synchronize against.
>
> from libarena/include/bpf_atomic.h #define smp_mb() ({ volatile unsigned long __val; __sync_fetch_and_add(&__val, 0); })
>
> iirc x86 does 'lock or (rsp)' which is same idea. __sync_fetch_and_add in BPF will eventually be JITed as 'lock xadd' on x86.
@4ast Updated the handling for `fence seq_cst` as per your suggestion. Could you please take a look?
https://github.com/llvm/llvm-project/pull/196734
More information about the llvm-commits
mailing list