AMDGCN: Add vector atomics using new memory support
AMDGCN backend gains support for vector atomic operations, performing 64 atomics in parallel.
The AMDGCN backend now supports vector atomic operations by utilizing new support for memory operands that are vectors of registers. These operations function similarly to scalar atomics but execute 64 in parallel, significantly boosting performance for concurrent memory access patterns on AMD GPUs.
In Details
This patch introduces vector atomics for the AMDGCN backend, leveraging the new (mem (reg:<vectype>)) capability. It defines new UNSPEC_PAIR and ATOMICMODE constructs and expands atomic_fetch_* and atomic_* instructions to operate on vector modes. This enables simultaneous atomic operations across multiple lanes, provided the hardware supports it, by treating a vector of addresses as a single memory operand.
- AMDGCN
- A graphics processor architecture developed by AMD, used in their Radeon GPUs. GCC's AMDGCN backend targets this architecture.
- vector atomic operations
- Atomic memory operations (like compare-and-swap or fetch-and-add) that are applied to multiple memory locations simultaneously using a vector of addresses.
- atomic
- An operation that is guaranteed to execute indivisibly, meaning it completes entirely without interruption or interference from other threads or processes. Crucial for maintaining data consistency in concurrent environments.
- GCC backend
- The part of the GCC compiler responsible for translating the compiler's intermediate representation into machine-specific assembly code for a particular target architecture.
- UNSPEC
- An intermediate representation in GCC's RTL (Register Transfer Language) used to represent operations that do not have a direct machine instruction mapping, often custom or backend-specific.