Make sure FlagCX can be compiled on non-NVIDIA platforms#479
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix a build failure on non-NVIDIA platforms by ensuring flagcxInnerWindow has a concrete definition available when the NVIDIA adaptor headers are not present.
Changes:
- Add a fallback
struct flagcxInnerWindow { int winFlags; }definition insym_heap.hbehind aFLAGCX_INNER_WINDOW_DEFINEDmacro guard. - Define
FLAGCX_INNER_WINDOW_DEFINEDinnvidia_adaptor.hto prevent the fallback definition from being used when building with the NVIDIA adaptor.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| flagcx/core/include/sym_heap.h | Adds a guarded fallback definition of flagcxInnerWindow for non-vendor/non-NVIDIA builds. |
| flagcx/adaptor/include/nvidia_adaptor.h | Defines a macro intended to suppress the fallback flagcxInnerWindow definition when NVIDIA adaptor types are used. |
Comments suppressed due to low confidence (1)
flagcx/adaptor/include/nvidia_adaptor.h:32
FLAGCX_INNER_WINDOW_DEFINEDis defined unconditionally here, but the actualflagcxInnerWindowlayout differs from the fallback definition added insym_heap.hwhenNCCL_VERSION_CODE > 2.27(this header placesbasebeforewinFlags). Any TU that sees the fallback definition (because it includedsym_heap.hbefore this header, or never includes this header) but later receives avendorBaseallocated with the NVIDIA layout will misinterpretwinFlags.
Consider making winFlags the first member in the NVIDIA flagcxInnerWindow as well (so generic code can safely access it), and/or guarding the macro/struct definition so the type cannot be defined inconsistently depending on include order.
#define FLAGCX_INNER_WINDOW_DEFINED
#if NCCL_VERSION_CODE > NCCL_VERSION(2, 27, 0)
struct flagcxInnerWindow {
ncclWindow_t base;
int winFlags;
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| struct flagcxInnerWindow { | ||
| int winFlags; | ||
| }; |
|
Please rebase the code |
|
Please refer to #488, I've created a new PR to fix this issue |
PR Category
Others
PR Types
Bug Fix
PR Description
When compiling FlagCX on non-NVIDIA platforms, there is an error about the
flagcxInnerWindownot defined. This PR fixes the problem.