ReadonlylayerReadonlysharedK/V a layer reuses from an earlier layer of the same forward.
donorOf[i] is the layer whose fetched K/V layer i consumes, or null
when i attends its own; reusedDonors are the layers others consume,
whose K/V must cross segment boundaries. Both are empty/null for a graph
without KV sharing.
Begin one pass over ids [1, T]. With a prefix layout the pass ropes and
masks the prefix-shared concat (only for a graph that also declares
prefixShared); the pass's caches own the layout (TrainingAttentionCache.ropePositions).
Optionalprefix: PrefixLayout
Backward that streams a sequence layer-segment by layer-segment. The driver owns the autograd (per-segment vjps over detached boundaries); the graph owns how a range of its layers runs and what crosses segment boundaries.