Repository navigation
PortChannel: make CPU owners non-template - #975
Changho Hwang (chhwang) wants to merge 11 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thanks for this PR, it looks good to me, just some minor comments |
There was a problem hiding this comment.
🔵 Needs a closer look
The HIP-specific handle-deduction fix lacks actual ROCm toolchain validation and final-head runtime qualification, requiring human review of pending CI and runtime evidence.
No open issues 🎉
What changed in this PR
This PR unifies BasePortChannel and PortChannel into non-template CPU owners while preserving backend-specific GPU handles and static GPU dispatch. It builds on #910 and #963 without changing GPU operations or EP behavior.
Changes:
- Store Host or Device ownership and bindings in one owner type, with explicit backend selection and runtime validation during handle extraction.
- Update generic handle deduction, callers, examples, and Python bindings while preserving Python public names.
- Add selector, ownership, binding, and kernel-scope compile regressions; document source migration and lifetime requirements.
Reported CUDA compilation passed; final runtime and ROCm validation remain outstanding.
| File | Description |
|---|---|
test/unit/semaphore_tests.cc |
Tests unified ownership, backend selection, and binding validation. |
test/unit/proxy_service_tests.cu |
Updates proxy lifecycle and unassigned-owner tests. |
test/unit/local_channel_tests.cu |
Selects Host handles explicitly. |
test/unit/compile_tests.cu |
Adds selector, cv/ref, and kernel-scope deduction regressions. |
test/mscclpp-test/common.hpp |
Updates mesh setup declarations to explicit Host handles. |
test/mscclpp-test/common.cc |
Migrates mesh setup handle extraction. |
test/mscclpp-test/alltoall_test.cu |
Migrates all-to-all handle types and storage. |
test/mscclpp-test/allreduce_test.cu |
Migrates all-reduce handle types and storage. |
test/mscclpp-test/allgather_test.cu |
Migrates all-gather handles and proxy extraction. |
test/mp_unit/port_channel_tests.cu |
Selects handles by runtime IB mode. |
test/mp_unit/mp_unit_tests.hpp |
Replaces the test owner variant with PortChannel. |
test/allgather_test_cpp.cu |
Migrates standalone all-gather handles and extraction. |
src/ext/collectives/include/collective_utils.hpp |
Updates collective owner and handle storage. |
src/core/port_channel.cc |
Implements unified state, bindings, and validated extraction. |
src/core/include/execution_kernel.hpp |
Uses explicit Host handles in kernel shared storage. |
src/core/include/execution_common.hpp |
Updates execution-plan Port handle arrays. |
src/core/executor/executor.cc |
Stores unified owners and extracts Host handles. |
README.md |
Updates the introductory GPU handle example. |
python/csrc/port_channel_py.cpp |
Adapts bindings while retaining public Python names. |
include/mscclpp/port_channel.hpp |
Defines non-template owners and explicit backend extractors. |
include/mscclpp/core.hpp |
Derives handle types from fixed or selected member expressions. |
examples/tutorials/04-port-channel/bidir_port_channel.cu |
Updates tutorial handle extraction. |
examples/torch-integration/customized_allgather.cu |
Migrates Torch example handles and setup. |
examples/customized-collective-algorithm/customized_allgather.cu |
Migrates native collective example handles and setup. |
docs/tutorials/04-port-channel.md |
Explains Host extraction and owner lifetime. |
docs/guide/mscclpp-torch-integration.md |
Updates the documented kernel handle type. |
docs/guide/gpunetio.md |
Documents unified owners and explicit Device extraction. |
docs/cpp_api.rst |
Documents selectors, validation, ownership, and source migration. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The new connection-backed Python Device constructors and ownership lifetimes require human runtime qualification on real GPUNetIO/RDMA hardware, and final-revision HIP validation remains pending.
No open issues 🎉
Review effort: Balanced
|
/azp run mscclpp-ut |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
🔵 Needs a closer look
The ownership-sensitive Python Device constructors and registration lifetimes require human review and real multi-rank GPUNetIO validation, while final-revision HIP qualification remains pending.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Python GPUNetIO/Device construction and ownership lifetimes lack real connection-backed two-rank validation, while final-revision HIP checks remain unexecuted and the pytest stall unresolved, requiring qualified runtime and portability review.
No open issues 🎉
Review effort: Balanced
Purpose
Make
BasePortChannelandPortChannelnon-template CPU owners so setup code can name, store, and pass either backend through one owner type. Keep backend-specific GPU handles and static GPU dispatch.This follows merged #910 and #963 on main
4dab9f5033b718f55a2892da5399cb359c3b211e. It is not a Git revert of #910: GPUNetIO, GPU operations, concurrency/scratch policies, and current-main features remain intact, including EP #962 and FP8 behavior.API and behavior
BasePortChannelDeviceHandle<B>andPortChannelDeviceHandle<B>. Owners exposeBasePortChannel::DeviceHandle<B>andPortChannel::DeviceHandle<B>alias templates; Port extraction requires an explicit backend.mscclpp::DeviceHandle<mscclpp::MemoryChannel>andmscclpp::deviceHandle(owner). Port usesmscclpp::DeviceHandle<mscclpp::PortChannel, B>andmscclpp::deviceHandle<B>(owner); Base owners follow the same fixed/selected forms. The alias derives the actual chosen member expression, not a nested-type mapping or owner registry. Both helpers access the argument as a named lvalue, preserving cv/ref results without moving the owner or extending its lifetime. No Port default or ignored fixed-owner selector is provided; omitted, irrelevant, wrong-kind/out-of-domain and multiple selectors are rejected through requires/SFINAE-safe availability checks.InvalidUsage; Host ID0 remains valid. Lifetime and moved-semaphore checks remain, including checking the Port semaphore handle before connection access.noexceptmove construction/assignment; moved-from owners reject extraction. Base-only assignment is not a rebind guarantee: same-backend replacement still requires compatible connection/proxy/regions. Prefer whole-owner replacement.Semaphoreconstruction creates a new synchronization wrapper and its expected/outbound counters. Channel copies share that wrapper; independently constructed owners do not share those counters merely because they use the same raw Semaphore. Default/moved-from raw inputs do not satisfy the documented precondition and are not guaranteed to throwInvalidUsage.device_handle()remain unchanged. Device-backed Python construction usesPortDevice2DeviceSemaphore(raw_semaphore)or(communicator, connection), thenPortChannel(semaphore, dst, src)(or the Base constructor) and explicitdevice_backend_handle().raw. Device handles have distinct types; no Python runtime return-type dispatcher is introduced. Keep the CPU owner and buffers alive during GPU use.Source migration and tradeoffs
For Port owners only:
PortChannel<B>/BasePortChannel<B>PortChannel/BasePortChannelChannel::DeviceHandlePortChannel::DeviceHandle<B>orBasePortChannel::DeviceHandle<B>owner.deviceHandle()/mscclpp::deviceHandle(owner)owner.deviceHandle<B>()ormscclpp::deviceHandle<B>(owner)The no-selector form
mscclpp::DeviceHandle<PortChannel>remains unsupported; usemscclpp::DeviceHandle<PortChannel, B>. Generic Port callers carry the backend explicitly. Fixed Memory/Switch extractors retain their no-selector syntax, with result types derived from the actual member call. The namespace helper now has fixed and backend-selected cases, delegating runtime validation to the owner. Host and Device GPU handles remain distinct and nonassignable across backends.Simpler CPU naming/storage costs explicit backend annotations and runtime owner/binding validation instead of backend guarantees in the owner type. Earlier aarch64/GCC 13.3 measurements at
8760e26in both IB configurations showed Base owners 40 → 48 bytes and bound owners 80 → 88 bytes, all aligned to 8 bytes, with equal GPU handle sizes/alignment. This affected-utility gate does not remeasure layout: owner fields and public GPU headers remain unchanged. No transparent old C++ API/binary compatibility, performance gain, or unconditional LoC reduction is claimed.Validation
Final head
bacf7664ebb5349795b94d15b62ff207ce13f3f4contains test-only corrections after production/binding pined51d471d52945f26e101c6833381ddfd102d4e4: integer enum comparisons and collective CUDA/IB/SM90+ admission before the two-rank Device test creates connections. All 553 other files are identical to ED51. Python test cleanup also clears retained exception frames and synchronizes reciprocal IPC imports before local assertions; the reported A100 CUDA12 95-minute pytest stall has not been reproduced or attributed.Fresh ED51 validation: GB200/aarch64, CUDA 13.0.88, GCC 13.3, CMake 3.28.3; Release C++20, IB ON/OFF:
int(CppErrorCode.InvalidUsage)conversionUnit selection:
unit_tests --exclude-perf-tests --filter=-GpuIpcMemTest; four IPC/fabric cases and one performance case filtered, not runtime-skipped. Counter/storage tests use real GPU allocations with metadata-only connections, not GPUNetIO transport. The corrected smoke reused the unchanged actual ED51 extension; it did not execute the original pytest functions or real connection-backed Python Device constructors/lifetimes. Initial missing-enum-.valuefailure receipts were retained; comparisons now use integer conversion.Original pytest/full-package imports/exports and two-rank Python Host NVLink/Device GPUNetIO tests remain unrun because generated
_version.pyand test/framework dependencies (including pytest/mpi4py/CUDA bindings and optional Torch/pybind11) are missing. No installs, fake packages or mocked connections bypassed them. Real Python Device construction/extraction and RDMA payloads remain unqualified. MP/non-unit consumers are compile-only. No inter-node/multi-rank transport, performance, new-revision HIP, installed-package or rendered-doc qualification is claimed. Layout figures above remain earlier 8760 measurements, not a fresh layout/ABI result.