Skip to content

Commit

Permalink
Remove stream-related APIs and memory functions defined in flagcxCCLA…
Browse files Browse the repository at this point in the history
…daptor (#6)
  • Loading branch information
MC952-arch authored Dec 20, 2024
1 parent 4bf8bf0 commit 83df87f
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 157 deletions.
8 changes: 1 addition & 7 deletions flagcx/adaptor/adaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ struct flagcxCCLAdaptor {
// Group semantics
flagcxResult_t (*groupStart)();
flagcxResult_t (*groupEnd)();

// Memory functions
flagcxResult_t (*memAlloc)(void** ptr, size_t size);
flagcxResult_t (*memFree)(void *ptr);
flagcxResult_t (*commRegister)(const flagcxHomoComm_t comm, void* buff, size_t size, void** handle);
flagcxResult_t (*commDeregister)(const flagcxHomoComm_t comm, void* handle);
};

const int MAX_VENDOR_LEN = 128;
Expand Down Expand Up @@ -122,4 +116,4 @@ struct flagcxDeviceAdaptor {
} // end extern "C"
#endif

#endif // end include guard
#endif // end include guard
29 changes: 1 addition & 28 deletions flagcx/adaptor/cncl_adaptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,28 +240,6 @@ flagcxResult_t cnclAdaptorGroupEnd() {
return (flagcxResult_t)c2f_ret_map[cnclGroupEnd()];
}

flagcxResult_t cnclAdaptorMemAlloc(void** ptr, size_t size) {
cnrtMalloc(ptr, size);
return flagcxSuccess;
}

flagcxResult_t cnclAdaptorMemFree(void *ptr) {
cnrtFree(ptr);
return flagcxSuccess;
}

flagcxResult_t cnclAdaptorCommRegister(const flagcxHomoComm_t comm, void* buff,
size_t size, void** handle) {
//return (flagcxResult_t)cnclCommRegister(comm->base, buff, size, handle);
return flagcxUnhandledDeviceError;
}

//TODO: unsupported
flagcxResult_t cnclAdaptorCommDeregister(const flagcxHomoComm_t comm, void* handle) {
//return (flagcxResult_t)cnclCommDeregister(comm->base, handle);
return flagcxUnhandledDeviceError;
}

struct flagcxCCLAdaptor cnclAdaptor = {
"CNCL",
// Basic functions
Expand Down Expand Up @@ -293,12 +271,7 @@ struct flagcxCCLAdaptor cnclAdaptor = {
cnclAdaptorRecv,
// Group semantics
cnclAdaptorGroupStart,
cnclAdaptorGroupEnd,
// Memory functions
cnclAdaptorMemAlloc,
cnclAdaptorMemFree,
cnclAdaptorCommRegister,
cnclAdaptorCommDeregister
cnclAdaptorGroupEnd
};

#endif // USE_CAMBRICON_ADAPTOR
24 changes: 1 addition & 23 deletions flagcx/adaptor/ixnccl_adaptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,6 @@ flagcxResult_t ixncclAdaptorGroupEnd() {
return (flagcxResult_t)ncclGroupEnd();
}

// flagcxResult_t ixncclAdaptorMemAlloc(void** ptr, size_t size) {
// return (flagcxResult_t)ncclMemAlloc(ptr, size);
// }

// flagcxResult_t ixncclAdaptorMemFree(void *ptr) {
// return (flagcxResult_t)ncclMemFree(ptr);
// }

// flagcxResult_t ixncclAdaptorCommRegister(const flagcxHomoComm_t comm, void* buff,
// size_t size, void** handle) {
// return (flagcxResult_t)ncclCommRegister(comm->base, buff, size, handle);
// }

// flagcxResult_t ixncclAdaptorCommDeregister(const flagcxHomoComm_t comm, void* handle) {
// return (flagcxResult_t)ncclCommDeregister(comm->base, handle);
// }

struct flagcxCCLAdaptor ixncclAdaptor = {
"IXNCCL",
// Basic functions
Expand Down Expand Up @@ -230,12 +213,7 @@ struct flagcxCCLAdaptor ixncclAdaptor = {
ixncclAdaptorRecv,
// Group semantics
ixncclAdaptorGroupStart,
ixncclAdaptorGroupEnd,
// Memory functions
NULL,
NULL,
NULL,
NULL
ixncclAdaptorGroupEnd
};

#endif // USE_ILUVATAR_COREX_ADAPTOR
24 changes: 1 addition & 23 deletions flagcx/adaptor/nccl_adaptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,6 @@ flagcxResult_t ncclAdaptorGroupEnd() {
return (flagcxResult_t)ncclGroupEnd();
}

flagcxResult_t ncclAdaptorMemAlloc(void** ptr, size_t size) {
return (flagcxResult_t)ncclMemAlloc(ptr, size);
}

flagcxResult_t ncclAdaptorMemFree(void *ptr) {
return (flagcxResult_t)ncclMemFree(ptr);
}

flagcxResult_t ncclAdaptorCommRegister(const flagcxHomoComm_t comm, void* buff,
size_t size, void** handle) {
return (flagcxResult_t)ncclCommRegister(comm->base, buff, size, handle);
}

flagcxResult_t ncclAdaptorCommDeregister(const flagcxHomoComm_t comm, void* handle) {
return (flagcxResult_t)ncclCommDeregister(comm->base, handle);
}

struct flagcxCCLAdaptor ncclAdaptor = {
"NCCL",
// Basic functions
Expand Down Expand Up @@ -230,12 +213,7 @@ struct flagcxCCLAdaptor ncclAdaptor = {
ncclAdaptorRecv,
// Group semantics
ncclAdaptorGroupStart,
ncclAdaptorGroupEnd,
// Memory functions
ncclAdaptorMemAlloc,
ncclAdaptorMemFree,
ncclAdaptorCommRegister,
ncclAdaptorCommDeregister
ncclAdaptorGroupEnd
};

#endif // USE_NVIDIA_ADAPTOR
44 changes: 0 additions & 44 deletions flagcx/flagcx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -424,47 +424,3 @@ flagcxResult_t flagcxGroupEnd() {
}
return flagcxHeteroGroupEnd();
}

flagcxResult_t flagcxStreamCreate(flagcxStream_t *stream) {
return deviceAdaptor->streamCreate(stream);
}

flagcxResult_t flagcxStreamSynchronize(flagcxStream_t stream) {
return deviceAdaptor->streamSynchronize(stream);
}

flagcxResult_t flagcxStreamDestroy(flagcxStream_t stream) {
return deviceAdaptor->streamDestroy(stream);
}

flagcxResult_t flagcxMemAlloc(void** ptr, size_t size) {
if (is_homo_comm()) {
return cclAdaptor->memAlloc(ptr, size);
}
// TODO: to be implemented.
return flagcxNotSupported;
}

flagcxResult_t flagcxMemFree(void *ptr) {
if (is_homo_comm()) {
return cclAdaptor->memFree(ptr);
}
// TODO: to be implemented.
return flagcxNotSupported;
}

flagcxResult_t flagcxCommRegister(const flagcxComm_t comm, void* buff, size_t size, void** handle) {
if (is_homo_comm()) {
return cclAdaptor->commRegister(comm->homo_comm, buff, size, handle);
}
// TODO: to be implemented.
return flagcxNotSupported;
}

flagcxResult_t flagcxCommDeregister(const flagcxComm_t comm, void* handle) {
if (is_homo_comm()) {
return cclAdaptor->commDeregister(comm->homo_comm, handle);
}
// TODO: to be implemented.
return flagcxNotSupported;
}
32 changes: 0 additions & 32 deletions flagcx/include/flagcx.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ flagcxResult_t flagcxHandleInit(flagcxHandlerGroup_t* handler);

flagcxResult_t flagcxHandleFree(flagcxHandlerGroup_t handler);

/* Malloc and free function for all types of FLAGCX optimizations
* (e.g. user buffer registration). The actual allocated size might
* be larger than requested due to granularity requirement. */
flagcxResult_t flagcxMemAlloc(void** ptr, size_t size);

flagcxResult_t flagcxMemFree(void *ptr);

/* Return the version of the FlagCX library in the supplied integer.
* It contains the underlying adaptor library version and FlagCX core version
*/
Expand Down Expand Up @@ -163,12 +156,6 @@ flagcxResult_t flagcxCommGetDeviceNumber(const flagcxComm_t comm, int* device);
/* Returns the user-ordered "rank" associated with the communicator. */
flagcxResult_t flagcxCommUserRank(const flagcxComm_t comm, int* rank);

/* Register device-side buffer for zero-copy operation */
flagcxResult_t flagcxCommRegister(const flagcxComm_t comm, void* buff, size_t size, void** handle);

/* Deregister device-side buffer */
flagcxResult_t flagcxCommDeregister(const flagcxComm_t comm, void* handle);

/*
* Collective communication operations
*
Expand Down Expand Up @@ -354,25 +341,6 @@ flagcxResult_t flagcxGroupStart();
*/
flagcxResult_t flagcxGroupEnd();

/*
* Stream semantics
*/

/*
* Stream Create
*/
flagcxResult_t flagcxStreamCreate(flagcxStream_t *stream);

/*
* Stream Synchronize
*/
flagcxResult_t flagcxStreamSynchronize(flagcxStream_t stream);

/*
* Stream Destroy
*/
flagcxResult_t flagcxStreamDestroy(flagcxStream_t stream);

#ifdef __cplusplus
} // end extern "C"
#endif
Expand Down

0 comments on commit 83df87f

Please sign in to comment.