Skip to content

UCT/CUDA_IPC: cuIpcGetMemHandle pass confused addr in cuda_ipc_md.c #11724

Description

@ACEMaravilla

Describe the bug

in ucx/src/uct/cuda/cuda_ipc/cuda_ipc_md.c line: 240
when get mem IPC handle:
cuIpcGetMemHandle(&key->ph.handle.legacy, (CUdeviceptr)addr));

the second param should not ’addr‘, but ‘key->d_bptr’,
because key->d_bptr is mean allocated device memory base ptr

in document says

dptr
- Base pointer to previously allocated device memory

'addr' however may represent to baseaddr+offset ,
then cuIpcGetMemHandle return is undefined,may result to cumemcpy bug

BTW,I have a test to validate what would return when addr is base + offset

allocation base=0x7e3e4de00000 size=1048576
offset address=0x7e3e4de80000 offset=524288
cuMemGetAddressRange(offset address): base=0x7e3e4de00000 size=1048576
cuIpcGetMemHandle(base): CUDA_SUCCESS (0), no error
cuIpcGetMemHandle(base + offset): CUDA_SUCCESS (0), no error
both calls succeeded; opaque handles are identical

which mean pass base address or base + offset both will return same base handle

SO at the semantic level here should pass key->d_bptr,though now pass 'addr' may not lead to mismatch

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions