Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
99e75f8
Make benchmarks work properly with OpRegistry
Krzmbrzl Aug 22, 2026
6ecb2c8
Update tracked dependency versions
Krzmbrzl Aug 22, 2026
30ad401
Support restricting benchmarks to a 'quick' subset
Krzmbrzl Aug 22, 2026
620b3fb
Run benchmarks as part of CI
Krzmbrzl Aug 22, 2026
34f95f9
Also skip running the benchmarks in builds with sanitizers
Krzmbrzl Aug 22, 2026
231ede5
Update used action images
Krzmbrzl Aug 22, 2026
687609a
Ensure we build tests with normal warning settings
Krzmbrzl Aug 22, 2026
e2d9e0c
Enable use of LTO
Krzmbrzl Aug 22, 2026
2d3cafd
fix formatting
Krzmbrzl Aug 22, 2026
ea7b3bc
Fix warning about discarded return value
Krzmbrzl Aug 22, 2026
b2ddf35
Fix target names
Krzmbrzl Aug 22, 2026
02b08f9
Explicit check for validity of fat-lto option
Krzmbrzl Aug 22, 2026
52c34cb
Specify language
Krzmbrzl Aug 22, 2026
20ad7f1
Fix warning about missing field initializers
Krzmbrzl Aug 22, 2026
ab7b2aa
Revamp LTO handling
Krzmbrzl Aug 24, 2026
cec4f13
Fix warning about unused variable
Krzmbrzl Aug 24, 2026
5a6165b
Also set optimization flags on SeQuant::bliss
Krzmbrzl Aug 24, 2026
a1f1340
Make LTO check more robust by skipping linking
Krzmbrzl Aug 24, 2026
6886e8d
Document SEQUANT_LTO
Krzmbrzl Aug 24, 2026
7460c7e
Use correct CMake variable
Krzmbrzl Aug 24, 2026
803ac19
Add optimization flags to more targets
Krzmbrzl Aug 24, 2026
73ca17f
Prefix cache variables with SEQUANT_
Krzmbrzl Aug 24, 2026
e976a19
Move ctx setup to main
Krzmbrzl Aug 24, 2026
192a150
Don't completely overwrite ctx
Krzmbrzl Aug 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/benchmark_compare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
steps:
- name: Get PR details
id: pr
uses: actions/github-script@v8
uses: actions/github-script@v9
with:
script: |
const pullRequestNumber = context.eventName === 'workflow_dispatch'
Expand All @@ -60,7 +60,7 @@ jobs:
};

- name: Create status check
uses: actions/github-script@v8
uses: actions/github-script@v9
with:
script: |
const prData = ${{ steps.pr.outputs.result }};
Expand All @@ -75,7 +75,7 @@ jobs:
});

- name: Checkout base repository
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
fetch-depth: 0

Expand All @@ -96,7 +96,7 @@ jobs:
echo "timestamp=$(date -u +'%Y-%m-%d-%H;%M;%S')" >> $GITHUB_OUTPUT

- name: Setup ccache cache files
uses: actions/cache@v5
uses: actions/cache@v6
with:
path: ${{github.workspace}}/build/.ccache
key: benchmark-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
Expand All @@ -114,7 +114,7 @@ jobs:

- name: Upload Results
if: always()
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v7
with:
name: benchmark-data-${{ github.run_id }}
path: |
Expand All @@ -125,7 +125,7 @@ jobs:

- name: Post Results
if: success()
uses: actions/github-script@v8
uses: actions/github-script@v9
with:
script: |
const fs = require('fs');
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:

- name: Update status check - Success
if: success()
uses: actions/github-script@v8
uses: actions/github-script@v9
with:
script: |
const prData = ${{ steps.pr.outputs.result }};
Expand All @@ -172,7 +172,7 @@ jobs:

- name: Notify on Failure
if: failure()
uses: actions/github-script@v8
uses: actions/github-script@v9
with:
script: |
const prData = ${{ steps.pr.outputs.result }};
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ jobs:
-DSEQUANT_PYTHON=${{ !matrix.valgrind && !matrix.sanitize }}
-DSEQUANT_ASSERT_BEHAVIOR=${{ matrix.valgrind && 'IGNORE' || 'THROW' }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: free up disk space on Ubuntu runner
if: ${{ matrix.os == 'ubuntu-24.04' }}
uses: jlumbroso/free-disk-space@main

- name: Setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: '3.x'

Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
run: echo "timestamp=$(date -u +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_OUTPUT

- name: Setup ccache cache files
uses: actions/cache@v5
uses: actions/cache@v6
with:
path: ${{github.workspace}}/build/.ccache
key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
Expand All @@ -121,7 +121,7 @@ jobs:
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG -DSEQUANT_QUICK_BENCHMARKS=ON


- name: Build
Expand All @@ -136,6 +136,12 @@ jobs:
shell: bash
run: ctest --output-on-failure -R "^sequant"

- name: Ensure benchmarks not broken
if: ${{ !matrix.valgrind && !matrix.sanitize }}
working-directory: ${{github.workspace}}/build
shell: bash
run: ./benchmarks/sequant_benchmarks --benchmark_dry_run=true

- name: Test (+ Valgrind)
if: ${{ matrix.valgrind }}
working-directory: ${{github.workspace}}/build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
-DSEQUANT_BUILD_DOCS=ON
-DSEQUANT_BUILD_DOCS_API_BREATHEEXHALE=ON
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '>=3.9' # Breathe needs 3.9 or later
cache: 'pip'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/formatting_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: "Check formatting"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: Install clang-format-17
run: |
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ macro(sequant_add_library _module)
get_target_property(_type SeQuant-${_module} TYPE)
if (NOT _type STREQUAL "INTERFACE_LIBRARY")
target_set_warning_flags(SeQuant-${_module})
target_set_optimization_flags(SeQuant-${_module})
endif()
endmacro()

Expand Down Expand Up @@ -272,6 +273,7 @@ add_library(SeQuant-bliss
set_target_properties(SeQuant-bliss PROPERTIES EXPORT_NAME bliss)
set_target_properties(SeQuant-bliss PROPERTIES CXX_SCAN_FOR_MODULES OFF)
add_library(SeQuant::bliss ALIAS SeQuant-bliss)
target_set_optimization_flags(SeQuant-bliss)
target_link_libraries(SeQuant-bliss PUBLIC range-v3::range-v3 Boost::headers)
if (SEQUANT_USE_SYSTEM_BOOST_HASH)
target_compile_definitions(SeQuant-bliss PUBLIC SEQUANT_USE_SYSTEM_BOOST_HASH=1)
Expand Down
3 changes: 2 additions & 1 deletion SeQuant/core/eval/eval.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,8 @@ ResultPtr evaluate(Node const& node, //
bool checked;
Stage stage = Stage::Enter;
bool store_after = false;
ResultPtr left, right;
ResultPtr left = {};
ResultPtr right = {};
};

// Finalize a freshly computed Phase-B result: if this Checked node needs
Expand Down
4 changes: 2 additions & 2 deletions SeQuant/domain/mbpt/op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,14 +580,14 @@ ExprPtr OpMaker<S>::operator()(
if (!dep && csv) {
if (opclass == OpClass::Ex) {
if constexpr (assert_enabled()) {
for (auto&& s : cre_spaces_) {
for ([[maybe_unused]] const auto& s : cre_spaces_) {
SEQUANT_ASSERT(isr->contains_unoccupied(s));
}
}
dep = UseDepIdx::Bra;
} else if (opclass == OpClass::Deex) {
if constexpr (assert_enabled()) {
for (auto&& s : ann_spaces_) {
for ([[maybe_unused]] const auto& s : ann_spaces_) {
SEQUANT_ASSERT(isr->contains_unoccupied(s));
}
}
Expand Down
15 changes: 15 additions & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,23 @@ add_executable(sequant_benchmarks
"wick.cpp"
)

target_set_warning_flags(sequant_benchmarks)
target_set_optimization_flags(sequant_benchmarks)

set_target_properties(sequant_benchmarks PROPERTIES CXX_SCAN_FOR_MODULES OFF)

option(SEQUANT_QUICK_BENCHMARKS "Whether to exclude computational expensive benchmarks" OFF)

# Running benchmarks in Debug mode doesn't make a lot of sense but in case someone does,
# we at least want to exclude benchmarks that are likely to take forever in this setup
if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR SEQUANT_QUICK_BENCHMARKS)
target_compile_definitions(sequant_benchmarks
PRIVATE
SEQUANT_BENCH_MAX_CC_RANK=3
SEQUANT_BENCH_MAX_WICK_INPUTS=2
)
endif()

# The benchmark implementations contain a bunch of same-name symbol definition that
# ought to be local to the individual translation unit. Hence, we must not combine
# all of them into a single translation unit.
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/coupled_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

#include <SeQuant/domain/mbpt/models/cc.hpp>

#ifdef SEQUANT_BENCH_MAX_CC_RANK
static constexpr std::size_t maxRank = SEQUANT_BENCH_MAX_CC_RANK;
#else
static constexpr std::size_t maxRank = 10;
Comment thread
Krzmbrzl marked this conversation as resolved.
#endif

using namespace sequant;
using namespace sequant::mbpt;
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <SeQuant/core/context.hpp>
#include <SeQuant/core/runtime.hpp>
#include <SeQuant/domain/mbpt/context.hpp>
#include <SeQuant/domain/mbpt/convention.hpp>

using namespace sequant;
Expand All @@ -17,6 +18,9 @@ int main(int argc, char *argv[]) {
.vacuum = Vacuum::SingleProduct});
set_default_context(fermi_ctx);

mbpt::Context mbpt_ctx({.op_registry_ptr = mbpt::make_minimal_registry()});
mbpt::set_default_mbpt_context(std::move(mbpt_ctx));

Context bose_einstein_ctx = Context(
{.index_space_registry_shared_ptr = idxreg, .vacuum = Vacuum::Physical});

Expand Down
9 changes: 7 additions & 2 deletions benchmarks/wick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
using namespace sequant;
using namespace sequant::mbpt;

#ifdef SEQUANT_BENCH_MAX_WICK_INPUTS
static constexpr std::size_t nInputs = SEQUANT_BENCH_MAX_WICK_INPUTS;
Comment thread
Krzmbrzl marked this conversation as resolved.
#else
static constexpr std::size_t nInputs = 5;
#endif

template <Statistics stats>
ExprPtr get_op_sequence(std::size_t i) {
Expand Down Expand Up @@ -147,8 +151,9 @@ VacAvPair get_mbpt_expr(std::size_t i) {
}

static void mbpt_vac_av(benchmark::State &state, bool csv) {
auto ctx = sequant::mbpt::set_scoped_default_mbpt_context(
mbpt::Context({.csv = csv ? CSV::Yes : CSV::No}));
auto base = mbpt::get_default_mbpt_context();
base.set(csv ? CSV::Yes : CSV::No);
auto ctx = sequant::mbpt::set_scoped_default_mbpt_context(base);

VacAvPair input = get_mbpt_expr(state.range(0));

Expand Down
63 changes: 63 additions & 0 deletions cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,66 @@ function(target_set_warning_flags TARGET)
target_compile_options("${TARGET}" PRIVATE "-Wno-unused-lambda-capture")
endif()
endfunction()



function(target_set_optimization_flags TARGET)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[3 — medium] The CMAKE_BUILD_TYPE STREQUAL "Debug" guard is a no-op under multi-config generators.

With Ninja Multi-Config, Xcode, or Visual Studio, CMAKE_BUILD_TYPE is empty, so this early return never fires and -flto=auto is applied unconditionally to every config, including Debug — slowing Debug builds substantially and degrading debuggability.

The identical guard at benchmarks/CMakeLists.txt:23 has the same problem in reverse: under a multi-config generator, SEQUANT_BENCH_MAX_CC_RANK / SEQUANT_BENCH_MAX_WICK_INPUTS are never defined for the Debug config, so the "don't let Debug benchmarks take forever" protection silently disappears.

Fix: use a $<CONFIG:Debug> generator expression for the flags (e.g. wrap the options in $<$<NOT:$<CONFIG:Debug>>:...>) rather than testing CMAKE_BUILD_TYPE at configure time.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct though I don't think the added complexity is really worth the hassle. This can be dealt with once someone actually uses Windows to do SeQuant developing.

return()
endif()

get_target_property(TARGET_TYPE "${TARGET}" TYPE)

if (TARGET_TYPE STREQUAL "INTERFACE_LIBRARY")
message(WARNING "target_set_optimization_flags is not intended to be used on interface targets")
return()
endif()

include(CheckCXXCompilerFlag)
include(CheckIPOSupported)

check_ipo_supported(RESULT CMAKE_SUPPORTS_COMPILER_LTO LANGUAGES CXX)
Comment thread
Krzmbrzl marked this conversation as resolved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[B — low] check_ipo_supported re-runs a full nested try_compile on every call, and it is now called 30-40 times per configure.

CheckIPOSupported.cmake deliberately does not cache — it ends with unset(_IPO_LANGUAGE_CHECK_RESULT CACHE) — so each invocation configures and builds a throwaway CMake project. This PR takes the call count from 0 to 20 literal call sites plus the loop bodies in utilities/CMakeLists.txt and tests/integration/CMakeLists.txt.

Measured on an M-series mac with this branch's compiler.cmake verbatim, same project, only the number of target_set_optimization_flags calls varying:

 1 call  -> 1.60 s total configure
30 calls -> 14.35 s total configure     (~0.44 s per extra call)

That is roughly 13-18 s added to every cmake run, for a result that cannot change between calls. The check_cxx_compiler_flag probes below are fine — those do cache.

Fix: wrap all four checks in a one-shot guard, e.g. if (NOT DEFINED SEQUANT_IPO_SUPPORTED) ... set(SEQUANT_IPO_SUPPORTED ${...} CACHE INTERNAL "") , or hoist them to a single call site at include time.


set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
check_cxx_compiler_flag("-flto" SEQUANT_LTO_FLAG_SUPPORTED)
check_cxx_compiler_flag("-flto=auto" SEQUANT_LTO_AUTO_SUPPORTED)
check_cxx_compiler_flag("-flto;-ffat-lto-objects" SEQUANT_FAT_LTO_FLAG_SUPPORTED)

if (DEFINED SEQUANT_LTO)
# Always honor explicit user choice
set(ENABLE_LTO ${SEQUANT_LTO})
elseif(TARGET_TYPE STREQUAL "STATIC_LIBRARY" OR TARGET_TYPE STREQUAL "OBJECT_LIBRARY")
# For static/object libraries we only want to enable LTO by default, if we can create
# "fat" object files. Those can still be linked without LTO and hence shouldn't
# break any downstream use.
set(ENABLE_LTO ${SEQUANT_FAT_LTO_FLAG_SUPPORTED})
elseif(SEQUANT_LTO_FLAG_SUPPORTED OR CMAKE_SUPPORTS_COMPILER_LTO)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[A — medium-low] LTO link options are enabled by a probe that never links.

a1f1340 added set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") at line 83, which makes all three check_cxx_compiler_flag probes compile-only — the commit message states the assumption outright ("under the assumption that if the compiler supports the flag, we will encounter a linker that can handle LTO").

This line then enables LTO on SEQUANT_LTO_FLAG_SUPPORTED OR CMAKE_SUPPORTS_COMPILER_LTO, and lines 108/112 put -flto=auto / -flto into target_link_options. So the decision to hand LTO flags to the linker is made by a probe that never invoked the linker, and the one check that does link (check_ipo_supported, line 81) is OR'd away.

Scenario: GCC or Clang paired with a GNU ld that has no LTO plugin — a GCC built against plugin-less binutils, or Clang defaulting to bfd ld with no LLVMgold.so. -flto compiles fine, so the probe passes, and then every SeQuant executable / shared / module target fails to link in Release with plugin needed to handle lto object or a wall of undefined symbols. Nothing in the configure output hints at the cause.

Fix: AND on CMAKE_SUPPORTS_COMPILER_LTO here, or restore an EXECUTABLE try-compile target type for the plain -flto probe (keeping STATIC_LIBRARY only for the fat-objects probe, where no link is involved anyway).

# Anything but static/object libraries is also linked by us and
# hence enabling LTO doesn't affect downstream compatibility
set(ENABLE_LTO ON)
endif()

if (ENABLE_LTO)
if (SEQUANT_LTO_FLAG_SUPPORTED)
# We prefer to manually set the LTO flag(s) rather than CMake doing it for us
# due to https://gitlab.kitware.com/cmake/cmake/-/work_items/23136
# On some compilers, the thin LTO type requested by CMake is incompatible
# with explicitly asking for fat LTO object files.
# Besides, it seems like full LTO achieves quite a bit better optimizations
# with Clang.
if (SEQUANT_LTO_AUTO_SUPPORTED)
target_compile_options("${TARGET}" PRIVATE -flto=auto)
target_link_options("${TARGET}" PRIVATE -flto=auto)
else()
target_compile_options("${TARGET}" PRIVATE -flto)
target_link_options("${TARGET}" PRIVATE -flto)
endif()

if (SEQUANT_FAT_LTO_FLAG_SUPPORTED)
target_compile_options("${TARGET}" PRIVATE -ffat-lto-objects)
endif()
else()
set_target_properties("${TARGET}" PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON)
Comment thread
Krzmbrzl marked this conversation as resolved.
endif()
endif()
endfunction()
3 changes: 3 additions & 0 deletions doc/user/getting_started/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ Useful CMake Variables
- ``ABORT`` in ``Debug`` mode, ``IGNORE`` otherwise
- Controls how assertions within SeQuant's code are handled. Valid options are ``ABORT``, ``THROW`` and ``IGNORE``. The latter disables
assertions, whereas the former keep them active and either abort the program or throw an exception on violation respectively.
* - SEQUANT_LTO

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[D — low] The documented default does not match the code, and SEQUANT_LTO is not actually a cache option.

Three things in this new row:

  1. "ON if the compiler supportes "fat" LTO objects" is only true for STATIC/OBJECT targets (compiler.cmake:95). For executables, shared libraries and module libraries, compiler.cmake:96 turns LTO on whenever plain -flto works, regardless of fat-object support. Directly observed in a repro on Apple clang 17: SEQUANT_FAT_LTO_FLAG_SUPPORTED failed, yet the executable still got -flto=auto on both compile and link.
  2. SEQUANT_LTO is never declared with option() or set(... CACHE ...) anywhere in the tree — compiler.cmake:88 only tests if (DEFINED SEQUANT_LTO). So a documented user-facing switch never appears in cmake -LH, ccmake, or the GUI; a user has to know the name from this table.
  3. Typo: "supportes" -> "supports".

- `ON` if the compiler supportes "fat" LTO objects, `OFF` otherwise
- Controls whether SeQuant will be built with link-time optimizations (LTO)


Configuring and Building
Expand Down
12 changes: 6 additions & 6 deletions external/versions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ set(SEQUANT_TRACKED_LIBPERM_TAG cada3e185549896203cf4d0c7f26ea22c7de428f)

set(SEQUANT_TRACKED_POLYMORPHICVARIANT_TAG 010c69786104c07c5faccffe0e99f99de5a69fd8)

set(SEQUANT_TRACKED_UTFCPP_TAG v4.0.6)
set(SEQUANT_TRACKED_UTFCPP_TAG v4.1.1)

set(SEQUANT_TRACKED_CLI11_TAG v2.5.0)
set(SEQUANT_TRACKED_CLI11_TAG v2.7.2)
set(SEQUANT_OLDEST_CLI11_VERSION 2)

set(SEQUANT_TRACKED_SPDLOG_TAG v1.15.3)
set(SEQUANT_TRACKED_SPDLOG_TAG v1.17.0)

set(SEQUANT_TRACKED_JSON_TAG v3.12.0)
set(SEQUANT_OLDEST_JSON_VERSION 3)
Expand All @@ -27,13 +27,13 @@ set(SEQUANT_OLDEST_JSON_VERSION 3)
# Recent stdlibs have removed this class when using C++17 (e.g. Apple Clang 15)
set(SEQUANT_OLDEST_BOOST_VERSION 1.81)

set(SEQUANT_TRACKED_CATCH2_TAG v3.9.1)
set(SEQUANT_TRACKED_CATCH2_TAG v3.15.3)
set(SEQUANT_OLDEST_CATCH2_VERSION 3.3)

set(SEQUANT_TRACKED_GOOGLEBENCHMARK_TAG v1.9.4)
set(SEQUANT_TRACKED_GOOGLEBENCHMARK_TAG v1.9.5)
set(SEQUANT_OLDEST_GOOGLEBENCHMARK_VERSION 1.9.3)

set(SEQUANT_TRACKED_PYBIND11_TAG v3.0.1)
set(SEQUANT_TRACKED_PYBIND11_TAG v3.1.0)
set(SEQUANT_OLDEST_PYBIND11_VERSION 3)

# oldest Doxygen we can tolerate ... doxygen-awesome-css requires doxygen 1.9.1 - 1.9.4 or 1.9.6 - 1.14.0, so just use 1.9.6 as the minimum
Expand Down
1 change: 1 addition & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ endif()
pybind11_add_module(python-sequant MODULE src/sequant/_sequant.cc)

target_link_libraries(python-sequant PRIVATE SeQuant)
target_set_optimization_flags(python-sequant)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[C — low] This line is my fault, and it should be dropped.

I asked for it in finding 2 of the previous review without checking that pybind11 already handles LTO for this target. It does: pybind11_add_module does target_link_libraries(${target_name} PRIVATE pybind11::lto) (pybind11NewTools.cmake:324) unless NO_EXTRAS, and pybind11::lto carries INTERFACE_COMPILE_OPTIONS / INTERFACE_LINK_OPTIONS of -flto[=thin|=auto] plus -fno-fat-lto-objects on GCC (pybind11Common.cmake:332-421), already guarded by a not-Debug generator expression.

Concrete effect of adding ours on top: on GCC the compile line for _sequant.cc ends up with both -ffat-lto-objects (ours, PRIVATE) and -fno-fat-lto-objects (pybind11's, appended after as an interface option), plus two differently-spelled -flto variants. Last-one-wins makes it benign today, but it is duplicate machinery that will silently fight pybind11's the moment either side changes its spelling — and pybind11 is the side that knows what a Python extension module needs.

Recommend reverting this one line. Sorry for the churn.

target_include_directories(python-sequant PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")

set_target_properties(
Expand Down
1 change: 1 addition & 0 deletions tests/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ foreach(current IN LISTS TEST_CASES)
endif()

target_set_warning_flags("${test_name}")
target_set_optimization_flags("${test_name}")
Comment thread
Krzmbrzl marked this conversation as resolved.

set(variant_names "")

Expand Down
Loading
Loading