Skip to content

[Others] Adapt new FlagCX interfaces for MetaX backend#509

Open
zhujiaxiaowang wants to merge 1 commit into
flagos-ai:mainfrom
zhujiaxiaowang:main
Open

[Others] Adapt new FlagCX interfaces for MetaX backend#509
zhujiaxiaowang wants to merge 1 commit into
flagos-ai:mainfrom
zhujiaxiaowang:main

Conversation

@zhujiaxiaowang

Copy link
Copy Markdown
Contributor

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

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for hostGetDevicePointer, 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 flagcxNotSupported for 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.

Comment on lines +12 to +14
#if MCCL_VERSION_CODE >= MCCL_VERSION(2, 30, 4)
#include "mccl/mccl_device.h"

Comment on lines +583 to +589
mcError_t res =
mcMemImportFromShareableHandle(&mcMcHandle, (void *)(intptr_t)importFd,
mcMemHandleTypePosixFileDescriptor);
if (res != mcSuccess) {
WARN("symMulticastBind: cuMemImportFromShareableHandle failed: %d", res);
return flagcxUnhandledDeviceError;
}
Comment on lines +651 to +659
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;
}
Comment on lines +359 to 365
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;
}
Comment on lines +677 to 685
flagcxResult_t macaAdaptorSymMulticastFree(void *mcHandle) {
if (mcHandle == NULL)
return flagcxSuccess;
mcMemGenericAllocationHandle handle =
*(mcMemGenericAllocationHandle *)mcHandle;
DEVCHECK(mcMemRelease(handle));
free(mcHandle);
return flagcxSuccess;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants