feat: update dcu adaptor#499
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the DU (DUCUDA) device adaptor to expose additional PAL capabilities expected by the FlagCX device abstraction layer, including DMA capability hooks, stream value synchronization primitives, event elapsed-time queries, and a first pass at symmetric-memory (VMM) support with safer multicast stubs.
Changes:
- Add DU DMA-buffer capability callbacks (
dmaSupport,getHandleForAddressRange) and register them in the adaptor table. - Implement stream wait/write value64 and event elapsed-time queries with DUCUDA/CUDA APIs and basic argument validation.
- Implement symmetric-memory VMM mapping/unmapping and adjust multicast APIs to remain “unsupported” while making teardown/free paths safe.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+304
to
+309
| flagcxResult_t | ||
| ducudaAdaptorMemGetHandleForAddressRange(void *handleOut, void *buffer, | ||
| size_t size, unsigned long long flags) { | ||
| //unsupportted on dcu | ||
| return flagcxNotSupported; | ||
| } |
| @@ -355,36 +393,146 @@ flagcxResult_t ducudaAdaptorHostUnregister(void *ptr) { | |||
| } | |||
|
|
|||
| // Symmetric memory VMM stubs (not supported) | |||
Comment on lines
+403
to
+426
| CUmemGenericAllocationHandle *cuHandle = | ||
| (CUmemGenericAllocationHandle *)malloc( | ||
| sizeof(CUmemGenericAllocationHandle)); | ||
| if (cuHandle == NULL) | ||
| return flagcxSystemError; | ||
|
|
||
| // Retain the physical allocation handle from the VMM-backed pointer | ||
| DEVCHECK(cuMemRetainAllocationHandle(cuHandle, ptr)); | ||
|
|
||
| // Discover actual physical allocation size (already granularity-aligned) | ||
| size_t actualAllocSize = 0; | ||
| DEVCHECK(cuMemGetAddressRange(NULL, &actualAllocSize, (CUdeviceptr)ptr)); | ||
| *allocSize = actualAllocSize; | ||
|
|
||
| // Export as POSIX fd for IPC sharing | ||
| if (*handleSize < sizeof(int)) { | ||
| free(cuHandle); | ||
| return flagcxInvalidArgument; | ||
| } | ||
| DEVCHECK(cuMemExportToShareableHandle( | ||
| shareableHandle, *cuHandle, CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR, 0)); | ||
| *handleSize = sizeof(int); // POSIX fd is an int | ||
| *physHandle = cuHandle; | ||
| return flagcxSuccess; |
Comment on lines
+409
to
+414
| // Retain the physical allocation handle from the VMM-backed pointer | ||
| DEVCHECK(cuMemRetainAllocationHandle(cuHandle, ptr)); | ||
|
|
||
| // Discover actual physical allocation size (already granularity-aligned) | ||
| size_t actualAllocSize = 0; | ||
| DEVCHECK(cuMemGetAddressRange(NULL, &actualAllocSize, (CUdeviceptr)ptr)); |
Comment on lines
493
to
501
| flagcxResult_t ducudaAdaptorSymMulticastSupported(int *supported) { | ||
| // not supported on dcu | ||
| if (supported == NULL) | ||
| return flagcxInvalidArgument; | ||
|
|
||
| if (supported) | ||
| *supported = 0; | ||
| return flagcxSuccess; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
PAL (Portable Abstraction Layer)
PR Types
New Features
PR Description
This PR updates the DU device adaptor implementation and improves its compatibility with the FlagCX device abstraction layer.
Main changes include:
Add DU DMA capability query interfaces:
ducudaAdaptorDmaSupport, returning unsupported for DU.ducudaAdaptorMemGetHandleForAddressRange, returningflagcxNotSupported.Implement stream value synchronization support:
ducudaAdaptorStreamWaitValue64usingcuStreamWaitValue64.ducudaAdaptorStreamWriteValue64usingcuStreamWriteValue64.Implement event elapsed time query:
ducudaAdaptorEventElapsedTimeusingcudaEventElapsedTime.cudaErrorNotReadytoflagcxInProgress.Add symmetric memory VMM support for DU:
cuMemRetainAllocationHandle.cuMemAddressReserve,cuMemMap, andcuMemSetAccess.Improve unsupported multicast handling:
Register the new DMA-related callbacks in
ducudaAdaptor.