How Geometry schedules work across a CUDA boundary#
A query result can export an Arrow device array for a downstream CUDA consumer.
What survives closing the result?#
Suppose you export the result with cugeo_geometry_cudf_result_export_arrow_device, then immediately close the producing result and Session. Does the array remain usable?
The owning Arrow device export retains its allocations, so closing the result and Session does not by itself release those bytes. The exported schema and array have independent release obligations. A child correctly moved out of the export can also survive release of its root.
When may the second stream read?#
Now take the still-live array to a second CUDA stream. An unbound consumer must wait on the export’s sync_event before reading. If the consumer stream is bound to the export, that stream must stay live through release.
Keeping the allocation alive answers whether the bytes exist. Honoring the stream dependency answers when the read may start.
What must survive the last use?#
Choose the handoff according to how the downstream component will use the result, as described below.
Handoff |
What the consumer receives |
Lifetime obligation |
|---|---|---|
|
A releasable device owner |
Release the export when it is no longer needed. |
|
A view and a distinct lease |
Release the lease after dependent use. |
|
An explicit copy in host memory |
Use the host copy for downstream host access. |
Saving a pointer alone loses the ownership and readiness information. For the owner, event and release operation associated with a particular handoff, see Device buffers, streams and ownership.
The original result handle can close while its allocations are retained. The producer’s allocator callbacks must remain valid through the final release of any child or resource that depends on them.