[Others] Adapt new FlagCX interfaces for MetaX backend#509
[Others] Adapt new FlagCX interfaces for MetaX backend#509zhujiaxiaowang wants to merge 1 commit into
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR updates the MetaX backend integration to match newly introduced FlagCX device/CCL interface hooks, enabling MetaX-specific implementations for host pointer mapping, DMA buffer handle export, host memory registration, and symmetric-memory (VMM + multicast) primitives. It also gates newer MCCL features behind a version check to keep older MCCL builds compiling.
Changes:
- Update MetaX build configuration (library/include locations and compiler) in the Makefile.
- Extend MetaX device adaptor (
maca_adaptor.cc) with implementations forhostGetDevicePointer, DMA handle export, host register/unregister, and symmetric memory (flat map + multicast) APIs. - Add MCCL >= 2.30.4 implementations for mem alloc/free and (window) registration APIs, with fallbacks to
flagcxNotSupportedfor older MCCL.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| Makefile | Adjusts MetaX library/include paths and sets the MetaX device compiler. |
| flagcx/adaptor/include/metax_adaptor.h | Adds MCCL-version-gated types/includes needed for new MCCL/MetaX interfaces. |
| flagcx/adaptor/device/maca_adaptor.cc | Implements new FlagCX device-side interface hooks for MetaX, including symmetric memory and multicast support. |
| flagcx/adaptor/ccl/mccl_adaptor.cc | Implements MCCL >= 2.30.4 new CCL hooks (mem alloc/free, comm register/deregister, window register/deregister) with fallbacks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #if MCCL_VERSION_CODE >= MCCL_VERSION(2, 30, 4) | ||
| #include "mccl/mccl_device.h" | ||
|
|
| mcError_t res = | ||
| mcMemImportFromShareableHandle(&mcMcHandle, (void *)(intptr_t)importFd, | ||
| mcMemHandleTypePosixFileDescriptor); | ||
| if (res != mcSuccess) { | ||
| WARN("symMulticastBind: cuMemImportFromShareableHandle failed: %d", res); | ||
| return flagcxUnhandledDeviceError; | ||
| } |
| res = mcMemSetAccess(mcVa, alignedSize, &accessDesc, 1); | ||
| if (res != mcSuccess) { | ||
| WARN("symMulticastBind: cuMemSetAccess failed: %d", res); | ||
| mcMemUnmap(mcVa, alignedSize); | ||
| mcMemAddressFree(mcVa, alignedSize); | ||
| if (imported) | ||
| mcMemRelease(mcMcHandle); | ||
| return flagcxUnhandledDeviceError; | ||
| } |
| flagcxResult_t | ||
| macaAdaptorMemGetHandleForAddressRange(void *handleOut, void *buffer, | ||
| size_t size, unsigned long long flags) { | ||
| // MCdeviceptr dptr = (MCdeviceptr)buffer; | ||
| DEVCHECK(mcMemGetHandleForAddressRange(handleOut, buffer, size, 0x1, flags)); | ||
| return flagcxSuccess; | ||
| } |
| flagcxResult_t macaAdaptorSymMulticastFree(void *mcHandle) { | ||
| if (mcHandle == NULL) | ||
| return flagcxSuccess; | ||
| mcMemGenericAllocationHandle handle = | ||
| *(mcMemGenericAllocationHandle *)mcHandle; | ||
| DEVCHECK(mcMemRelease(handle)); | ||
| free(mcHandle); | ||
| return flagcxSuccess; | ||
| } |
PR Category
Others
PR Types
New Features
PR Description
[adaptor/metax] Implement adaptation for new FlagCX interfaces:
memAlloc
memFree
commRegister
commDeregister
commWindowRegister
commWindowDeregister
getHandleForAddressRange
hostGetDevicePointer
hostRegister
hostUnregister
symPhysAlloc
symPhysFree
symFlatMap
symFlatUnmap
symMulticastSupported
symMulticastCreate
symMulticastBind
symMulticastTeardown
symMulticastFree