Fix CMake link ordering for tests and SW math libraries#7288
Open
A-006 wants to merge 5 commits intodeepmodeling:developfrom
Open
Fix CMake link ordering for tests and SW math libraries#7288A-006 wants to merge 5 commits intodeepmodeling:developfrom
A-006 wants to merge 5 commits intodeepmodeling:developfrom
Conversation
added 3 commits
April 27, 2026 17:10
There was a problem hiding this comment.
Pull request overview
This PR updates the CMake-based build/test linkage to be more link-order-friendly (notably for static math libraries and SW builds), and adjusts a utility function intended to avoid floating underflow in SW-specific code paths.
Changes:
- Reorders
AddTest(LIBS ...)arguments so project libraries are listed before${math_libs}for several unit test targets. - Consolidates SW FFT/BLAS/LAPACK/ScaLAPACK libraries into the
math_libslist and adds an SW compile option (-mieee). - Adds a
truncated_underflow(const FPTYPE&)overload (currently implemented viaconst_castforwarding).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
source/source_lcao/module_rt/test/CMakeLists.txt |
Reorders test link libraries so ${math_libs} is last. |
source/source_hsolver/test/CMakeLists.txt |
Reorders ${math_libs} to the end for some HSOLVER tests. |
source/source_base/truncated_func.h |
Adds truncated_underflow(const&) overload forwarding to the mutating implementation. |
source/source_base/module_container/ATen/kernels/test/CMakeLists.txt |
Moves container/base/device dependencies into AddTest(LIBS ...) (and keeps ${math_libs} last). |
CMakeLists.txt |
Adds SW -mieee compile option and appends SW math libs into math_libs; removes later per-lib SW link lines. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
${math_libs}AddTest(LIBS ...)for ATen kernel tests-mieeeand include SW FFT/BLAS/LAPACK/ScaLAPACK libraries inmath_libstruncated_underflow(const FPTYPE&)overload to support const inputs by forwarding to the mutable implementationNotes
The latest commits currently contain unresolved conflict markers in
CMakeLists.txt:CMakeLists.txt:353CMakeLists.txt:818CMakeLists.txt:819CMakeLists.txt:822