[cmake] drop CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES injection on device sources#547
Merged
Merged
Conversation
…ce sources
Forwarding the host compiler's implicit include directories as
per-source `INCLUDE_DIRECTORIES` causes CMake to emit them as `-I`
flags, which:
- duplicates paths the host compiler discovers implicitly (no benefit);
- on `btas_um_tensor.cpp` (a CPU .cpp that ends up in the device list)
re-passes `/usr/include/c++/13` etc. as user-include paths, which
breaks libstdc++'s `#include_next <stdlib.h>` from `<cstdlib>` under
gcc-13: the search never reaches the system `/usr/include` because
it's been shadowed by the user-include re-entries.
nvcc with `-ccbin=g++-N` already picks up host paths via the host
driver, so the injection is unnecessary on modern toolchains.
Failure observed in CI with gcc-13 + CUDA 12.x:
/usr/include/c++/13/cstdlib:79:15: fatal error: stdlib.h: No such file or directory
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.
Summary
Drop the per-device-source
INCLUDE_DIRECTORIES = ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}injection added in commit68b87342c(Aug 2023) as a Cray-wrapper workaround.Forwarding the host compiler's implicit include directories as per-source
INCLUDE_DIRECTORIEScauses CMake to emit them as-Iflags, which:btas_um_tensor.cpp(a CPU.cppthat ends up in the device list) re-passes/usr/include/c++/13etc. as user-include paths, which breaks libstdc++'s#include_next <stdlib.h>from<cstdlib>under gcc-13: the search never reaches the system/usr/includebecause it's been shadowed by the user-include re-entries.nvcc with `-ccbin=g++-N` already picks up host paths via the host driver, so the injection is unnecessary on modern toolchains.
Failure observed in CI (MPQC) with gcc-13 + CUDA 12.x:
```
/usr/include/c++/13/cstdlib:79:15: fatal error: stdlib.h: No such file or directory
79 | #include_next <stdlib.h>
```
Test plan