﻿# AMD LDS layouts: banks and cooperative data movement

LDS bank behavior follows simultaneous addresses and instruction width; validate layout transformations against the actual AMD target and full kernel cost.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/learn-amd-lds-bank-layout/
Language: en

LDS is AMD's workgroup-shared scratchpad, and its organization into banks affects concurrent access. Neighboring logical elements are not automatically a conflict-free layout for every instruction. Address stride, element width, lane mapping, and target architecture all matter. The useful diagnostic question is which simultaneous accesses contend for the same bank, not whether the code happens to use a shared-memory array.

## A bank is a parallel access resource

LDS banks allow multiple addresses to be served concurrently, but different addresses mapping onto one bank can require serialization. The exact organization differs across AMD families. Avoid importing one architecture's bank-count assumption as a universal constant. Start from the documented target and the actual byte addresses generated by active lanes. A source-level matrix row is only a logical grouping; hardware sees the resulting address pattern for each instruction.

Primary reference: [HIP Documentation: Hardware Implementation](https://rocm.docs.amd.com/projects/HIP/en/latest/understand/hardware_implementation.html).

## Transpose access exposes stride conflicts

A tiled transpose can write neighboring values efficiently and then read columns with an unfavorable bank stride. Changing the leading dimension or using a supported swizzled layout can alter the bank mapping. Such a transformation must preserve the mathematical coordinate mapping. Test with distinguishable element values so an accidental transpose or permutation does not pass unnoticed. A faster access pattern with incorrect coordinates is not a valid optimization.

Primary reference: [HIP C++ Language Extensions](https://rocm.docs.amd.com/projects/HIP/en/latest/how-to/hip_cpp_language_extensions.html).

## Instruction width changes the analysis

A scalar source expression can compile into vectorized or otherwise grouped memory operations. Bank behavior therefore depends on the emitted access instruction as well as the source indexing formula. Inspect compiler output or appropriate profiler evidence when a predicted conflict pattern does not match measurements. Avoid deriving an architecture-wide conclusion from one microbenchmark with one element type. A wider element changes which bytes each lane requests and how those requests overlap bank resources.

Primary reference: [rocWMMA API Reference Guide](https://rocm.docs.amd.com/projects/rocWMMA/en/latest/api-reference/api-reference-guide.html).

## Padding has a residency price

Adding unused elements can improve bank distribution while increasing LDS allocation per workgroup. That can reduce resident workgroups and change latency hiding. Measure the complete kernel after the transformation, including any extra index arithmetic. A layout that wins in an isolated scratchpad benchmark can lose in the real kernel because it purchases local access efficiency with a larger resource footprint. Keep both effects in the explanation of the final result.

## Use a target-specific layout experiment

Compare the original layout, a carefully justified padded layout, and any supported swizzle using the same mathematical input. Record the target architecture, element type, generated access width, LDS footprint, and kernel completion time. Check partial tiles and unusual dimensions. This produces a reproducible layout decision rather than a universal padding slogan. Revisit the decision when a compiler change alters instruction selection or the kernel moves to another AMD GPU family.

Related reading: [A GPU inference benchmark you can trust](/journal/inference-benchmark-method/); [Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/).
