ARM64's Weak Memory Model: Why x86 Code Fails on AArch64
ARM64 does not guarantee x86's store-load ordering. Learn how AArch64's weak memory model breaks plain shared-variable code and how to fix it with acquire/release atomics.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
ARM64 does not guarantee x86's store-load ordering. Learn how AArch64's weak memory model breaks plain shared-variable code and how to fix it with acquire/release atomics.
Moving x86 lock-free code to ARM64 often exposes hidden ordering assumptions. Learn why plain stores are not enough, how acquire/release primitives map to LDAR/STLR, and when ARMv8.1 LSE atomics are safe to use.
Learn how to diagnose and fix subtle multithreading bugs when porting code from x86-64 to ARM64, focusing on the transition from a strong to a weak memory model.
Synchronization Constraints in Weakly Ordered Memory The ARMv8-A architecture utilizes a weakly ordered memory model where hardware may reorder memory accesses to maximize throughput. To manage synchronization, the architecture provides Load-Acquire (LDAR) and Store-Release (STLR) instructions, which establish one-way barriers to ensure specific ordering bet
Symptom Portable reasoning about data visibility after a collective subroutine (co_sum, co_max, co_min, co_reduce) is hindered because the Fortran 2018 standard specifies an implicit synchronization but does not mandate whether that synchronization acts as a full memory fence equivalent to sync memory . Context Current compilers diverge: GNU Fortran 12+ trea
Goal Ensure that a consumer thread observing a readiness flag via a load-acquire also sees the pagination offset updated by a preceding store-release, preventing duplicate or skipped pages when bounding queries and paginating large datasets on AArch64. Constraints and uncertainty AArch64 follows a weak memory model where normal loads and stores may be reorde
A design decision is needed for a producer-consumer handoff on aarch64 under the Weakly Ordered memory model. The goal is to guarantee visibility of data writes before the consumer observes the ready flag, without assuming x86-style Total Store Ordering. Two documented approaches are under consideration. Load-Acquire LDAR and Store-Release STLR provide one-w
Goal I want a producer work-group to write a result buffer in global memory and have a consumer work-group read that data reliably within the same kernel launch, without stale reads. Constraints and uncertainty My understanding of the OpenCL C memory model is that it is relaxed: writes to global memory by one work-item are not guaranteed visible to others wi