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
Source code in vllm/distributed/pp_transport/rocm_sdma.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
__init__(send_buf, peer_recv_buf, peer_full, words, peer_pci)
¶
words: this rank's uncached shared-buffer bytes for sent and
the step-number sources; peer_pci: the next stage's PCI address.
Source code in vllm/distributed/pp_transport/rocm_sdma.py
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.
Source code in vllm/distributed/pp_transport/rocm_sdma.py
_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.
Source code in vllm/distributed/pp_transport/rocm_sdma.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
copy(dst, dst_agent, src, src_agent, size, deps, done, engine)
¶
Queue a copy on engine that starts once every signal in deps is
0 and decrements done when it finishes.
Source code in vllm/distributed/pp_transport/rocm_sdma.py
free_engines(dst, src)
¶
The mask of SDMA engines free for copies from src to dst.