vllm.distributed.pp_transport.rocm_sdma
¶
The flag ops and peer copy of copy_engine.CopyEngineTransport on ROCm
(gfx950): HIP stream memory ops and SDMA engines.
On HIP 7.16 a HIP peer copy runs as a blit kernel on the sender's CUs
(hipMemcpyFlagExtPreferCE does not apply to device-to-device copies, and
hipMemcpyDeviceToDeviceNoCU picks engines whose peer copy fails on MI355X
while returning success). The copies therefore go through ROCr's
hsa_amd_memory_async_copy_on_engine on explicit engines, kept in order with
the side stream by HSA signals. Per step N:
- the host queues the data copies behind a dependency signal, which the side
stream opens (writes 0) after the transport's
empty >= N - 1wait; - two 8-byte copies of N, queued behind the data copies, publish
full = Nto the receiver andsent = Nto this rank; - the side stream waits for
sent >= N, so the transport's event recorded on it covers the copies, as on CUDA.
The copies sit on their engines' queues, blocked on the dependency signal, until the side stream opens it. ROCr gives each engine one queue per process, so only other SDMA peer copies from this GPU on the same engines would wait behind them: host copies run on engines 0 and 1, and HIP peer copies on blit kernels.
The shared buffers come from allocate_shared_buffer_and_handle, which on ROCm
allocates uncached memory, so a stream wait never reads a stale L2 line.
Classes:
-
SdmaCopyEngines–ROCm's flag ops and, for a sender, its peer copy to the next stage.
SdmaCopyEngines
¶
ROCm's flag ops and, for a sender, its peer copy to the next stage.
Methods:
-
__init__–words: this rank's uncached shared-buffer bytes forsentand -
copy–Queue, behind
stream's work, the copy of each key's firstrows
__init__(send_buf, peer_recv_buf, peer_full, words, peer_pci, cross_node)
¶
words: this rank's uncached shared-buffer bytes for sent and
the step-number sources; peer_pci: the next stage's PCI address.
The peer must be on this node (cross_node false).
copy(stream, layout, rows, seq)
¶
Queue, behind stream's work, the copy of each key's first rows
rows into the peer's receive region and the publish of full = seq,
and make stream wait for them.
_Hsa
¶
The ROCr calls of an SDMA copy, over ctypes.
Methods:
-
copy–Queue a copy on
enginethat starts once every signal indepsis -
free_engines–The mask of SDMA engines free for copies from
srctodst.
_agent(pci)
¶
The HSA agent at PCI (domain, bus, device).