Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,23 @@ Set `SPARKINFER_PRINT_COMPILE_PROGRESS=1` to log each compiler invocation with i
cache-key parameters and duration — useful for figuring out what warmup
actually covered. `SPARKINFER_TIMING=1` enables per-kernel timing logs.

### Selected-record copy exchange

`sparkinfer.comm.pcie.SelectedRecordCopyExchange` moves sparse, fixed-width
records between CUDA-IPC peers through the PCIe copy engine. `exchange()`
handles one record plane. `exchange_layers()` packs three planes with one
destination map, issues one rotated DMA exchange and arrival barrier, then
unpacks the planes into caller-owned outputs. The layered layout overlays the
same IPC slab; `layered_max_records` reports its bounded capacity so callers can
fall back to `exchange()` when needed.

All ranks must call exchanges in the same order and with rank-consistent active
record counts. One exchange object is stream-affine. Run one eager exchange on
that stream before CUDA graph capture, then replay it on the same stream. The
balanced deferred-release protocol makes single-layer, three-layer, and empty
exchanges safe to alternate, but `close()` must run before the process group is
destroyed.

## Where to look next

- `tests/` is the executable spec — per-group API and numerical-reference
Expand Down
4 changes: 4 additions & 0 deletions sparkinfer/comm/pcie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
- ``DcpAllToAll``: DCP attention exchange with fused LSE reduce-scatter.
- ``SelectedRecordExchange``: direct peer writes for destination-selected,
fixed-width records.
- ``SelectedRecordCopyExchange``: compact, copy-engine transfer, and unpack
for destination-selected fixed-width records.

Raw CUDA (not CuTe): each class JIT-builds its colocated ``.cu`` via
torch.utils.cpp_extension, so nvcc must be available at runtime.
Expand All @@ -37,6 +39,7 @@
"DcpAllToAllPool",
"SelectedRecordExchange",
"SelectedRecordExchangeInitializationError",
"SelectedRecordCopyExchange",
"autotune_dma_crossovers",
"parse_oneshot_max_size",
"lse_reduce_scatter_reference",
Expand All @@ -63,6 +66,7 @@
OneshotAllReducePool,
SelectedRecordExchange,
SelectedRecordExchangeInitializationError,
SelectedRecordCopyExchange,
TwoShotReduceScatter,
autotune_dma_crossovers,
is_supported,
Expand Down
4 changes: 4 additions & 0 deletions sparkinfer/comm/pcie/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
from .pcie_selected_records import (
PCIeSelectedRecordExchangeInitializationError as SelectedRecordExchangeInitializationError,
)
from .pcie_selected_records_ce import (
PCIeSelectedRecordCopyExchange as SelectedRecordCopyExchange,
)
from .pcie_twoshot import (
PCIeTwoShotSP as TwoShotReduceScatter,
)
Expand All @@ -58,6 +61,7 @@ def is_supported(device=None) -> bool:
"DcpAllToAllPool",
"SelectedRecordExchange",
"SelectedRecordExchangeInitializationError",
"SelectedRecordCopyExchange",
"autotune_dma_crossovers",
"parse_oneshot_max_size",
"lse_reduce_scatter_reference",
Expand Down
Loading