mirror of
https://github.com/clang-retro/llvm.git
synced 2026-11-28 21:29:24 -08:00
olMemcpy currently disallows host-to-host copies with a queue, even though that is a desirable use case (e.g. to copy a buffer as a dependency for another operation) This PR adds support for asynchronous host-to-host copies by adding `GenericDeviceTy::dataMemcpy` and the corresponding required `dataMemcpyImpl` plugin operation. Unlike `dataSubmit`, `dataRetrieve`, and `dataExchange`, this operation does not assign a device direction to either pointer: - CUDA: Uses `cuMemcpyAsync`, which by itself determines the pointer types and preserves stream ordering. Dynamic CUDA symbol declarations and `_v2` lookup support are included. - Level Zero: Uses the existing queue `memoryCopy` operation (backed by `zeCommandListAppendMemoryCopy`), which appends a memory-copy command to the command list. - AMDGPU: No "enqueue a host-to-host copy" operation exists directly in that API, so we enqueue a `std::memcpy` callback through `pushHostCallback`. - Host: Call `memcpy` directly. The `olMemcpy` API documentation now states that queued host-to-host copies are ordered with other work in the queue. The public function signature is unchanged. A new unit test executes an `h2d -> d2h -> h2h -> h2d -> d2h` operation chain, which should fail if the queue order isn't respected. Assisted-by: Codex