Fix NVSHMEM IBGDA duplicate-definition in host builds#581
Open
Gregory-Pereira wants to merge 1 commit intodeepseek-ai:mainfrom
Open
Fix NVSHMEM IBGDA duplicate-definition in host builds#581Gregory-Pereira wants to merge 1 commit intodeepseek-ai:mainfrom
Gregory-Pereira wants to merge 1 commit intodeepseek-ai:mainfrom
Conversation
…ymbol Signed-off-by: greg pereira <grpereir@redhat.com>
Author
|
I see #574 has a better full implementation, if that gets accepted I will drop this minimal patch in favor of that |
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.
Fix NVSHMEM IBGDA duplicate-definition in host builds
Summary
This PR fixes a linker error that occurs when building the DeepEP Python extension with NVSHMEM enabled.
Problem
csrc/kernels/configs.cuh includes NVSHMEM’s internal header:
That header conditionally defines the global symbol:
When the header is included from a host-compiled translation unit (e.g. deep_ep.cpp built with g++), the symbol is emitted as a definition. Since DeepEP also links against libnvshmem_device.a, which defines the same symbol, the build fails at link time with:
This can be reproduced when building DeepEP against newer NVSHMEM releases (e.g. v3.5.19) in environments where configs.cuh is included by both CUDA (.cu) and host (.cpp) sources.
Solution
Restrict inclusion of nvshmem_common_ibgda.h to NVCC compilation contexts only:
This ensures:
a duplicate definition of nvshmemi_ibgda_device_state_d
Why this approach
When included from host-compiled code, nvshmem_common_ibgda.h can emit a
definition of nvshmemi_ibgda_device_state_d, which collides with the definition
provided by libnvshmem_device.a at link time.
Restricting the include to NVCC compilation avoids this duplicate-definition
path and makes the build more robust across NVSHMEM versions and build
environments.
The change is minimal and does not alter existing CUDA behavior.
My build log hitting this
cc @tlrmchlsmth @smarterclayton