Skip to content

refactor: cmake use target_compile_flags - #7857

Merged
timosachsenberg merged 7 commits into
developfrom
target_compile_flags
Mar 19, 2025
Merged

timosachsenberg merged 7 commits into
developfrom
target_compile_flags

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Feb 26, 2025 •

Copy link
Copy Markdown
Contributor

Description

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

⚠️ Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).

Summary by CodeRabbit

  • New Features

    • Introduced new functions for managing compiler flags in a modular way for libraries and executables.
    • Applied specific compiler flags to test executables and tools, enhancing build configurations.
  • Refactor

    • Centralized and modularized compiler flag management across libraries, executables, and tests. This update creates a consistent, reliable build environment and simplifies future configuration adjustments.
  • Chores

    • Removed outdated and redundant flag settings to streamline the build process. These refinements reduce complexity and enhance overall maintainability for a smoother developer experience.

Comment thread CMakeLists.txt Resolved
@jpfeuffer

Copy link
Copy Markdown
Contributor

Probably that weird NNLS code that was copied from the internet somewhere

@jpfeuffer

jpfeuffer commented Feb 26, 2025 •

Copy link
Copy Markdown
Contributor

Had to fix quite some things here: https://github.com/OpenMS/OpenMS/pull/7298/files

Not sure how compiler flags might help here though.
Maybe some inheritance vtable things?

@jpfeuffer

Copy link
Copy Markdown
Contributor

You are probably not adding the flags to the tests, or are you?
Do you add them to regular executables?

@timosachsenberg timosachsenberg changed the title test target_compile_flags refactor: cmake use target_compile_flags Feb 27, 2025
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

I got it to compile and tests pass.

I would highly appreciate it if our cmake gurus @jpfeuffer and @cbielow can take a close look.

@jpfeuffer

jpfeuffer commented Feb 27, 2025 •

Copy link
Copy Markdown
Contributor

We should really check why those flags are necessary. By the way, if downstream executables actually need those flags to run, when using OpenMS, the flags actually should be public, such that they show up in the CMake config for our exported targets.

Comment thread cmake/compiler_flags.cmake Resolved
@coderabbitai

coderabbitai Bot commented Mar 4, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request refactors the project's CMake configuration to simplify and centralize compiler flag management. It removes the obsolete CF_OPENMS_ADDCXX_FLAGS variable and its usage, replaces direct GCC-specific flag assignments with calls to new helper functions, and restructures the compiler flags handling into modular functions. Additionally, new function calls are added in test and tool executable CMakeLists to appropriately apply the updated compiler flags.

Changes

File(s) Change Summary
CMakeLists.txt Removed declaration of CF_OPENMS_ADDCXX_FLAGS and its appending to CMAKE_CXX_FLAGS.
cmake/add_library_macros.cmake Removed GCC-specific conditional flags and replaced them with a call to openms_add_library_compiler_flags.
cmake/compiler_flags.cmake Restructured flag management by introducing modular functions: openms_add_compiler_flags, openms_add_library_compiler_flags, and openms_add_executable_compiler_flags with updated handling for custom flags, SIMD, and warnings.
src/tests/class_tests/openms/CMakeLists.txt, src/tests/class_tests/openms_gui/CMakeLists.txt Added openms_add_executable_compiler_flags within loops to apply compiler flags to test executables.
src/topp/CMakeLists.txt Inserted openms_add_executable_compiler_flags after each add_executable call in both non-GUI and GUI executable loops.

Sequence Diagram(s)

sequenceDiagram
    participant EXE as Executable Target
    participant CSL as CMakeLists Loop
    participant FLAG as openms_add_executable_compiler_flags
    EXE->>CSL: add_executable(...)
    CSL->>EXE: target_link_libraries(...)
    CSL->>FLAG: call openms_add_executable_compiler_flags(target)
    FLAG-->>EXE: Apply compiler flags
Loading
sequenceDiagram
    participant LIB as Library Target
    participant AM as add_library_macros.cmake
    participant FLAG as openms_add_library_compiler_flags
    LIB->>AM: Define library target
    AM->>FLAG: call openms_add_library_compiler_flags(target)
    FLAG-->>LIB: Apply compiler flags
Loading

Poem

I'm a rabbit who's hopping with cheer,
Cleaning up CMake far and near.
Old flags out, new functions in sight,
Streamlined builds that feel just right.
With each line updated, my joy won't cease—
Hopping on through changes with delightful peace!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
cmake/compiler_flags.cmake (5)

43-45: Consider validating custom user flags.

Currently, user-defined flags are simply appended. If a user-supplied flag clashes with or negates essential project-wide flags, it could silently degrade functionality. Adding a validation or conflict-resolution step can help maintain consistent builds.


56-71: Add Intel-specific flags if needed.

Currently, Intel detection only sets an internal variable without adding relevant flags. If the project requires Intel optimizations or warnings, consider extending this section to ensure consistent behavior across compilers.


82-85: Consider extending conversion checks to more compilers.

At the moment, CXX_WARN_CONVERSION only applies to GCC. If you intend to standardize conversion warnings, you could introduce similar logic for other compilers (e.g., Clang’s -Wconversion).


112-116: Re-examine forcing AVX/SSSE3 by default.

Setting /arch:AVX on MSVC and -mssse3 on non-MSVC compilers is effective for performance but may break compatibility with older x64 hardware lacking these instructions. A runtime feature check or fallback might be safer if broad compatibility is required.


90-199: Consider modularizing the large function.

While this is a clean, centralized approach, the function covers many distinct compiler paths and warning sets for different compilers. Extracting smaller helper functions or grouping them by compiler could simplify maintenance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 265b701 and 4c53a80.

📒 Files selected for processing (6)
  • CMakeLists.txt (0 hunks)
  • cmake/add_library_macros.cmake (1 hunks)
  • cmake/compiler_flags.cmake (1 hunks)
  • src/tests/class_tests/openms/CMakeLists.txt (1 hunks)
  • src/tests/class_tests/openms_gui/CMakeLists.txt (1 hunks)
  • src/topp/CMakeLists.txt (2 hunks)
💤 Files with no reviewable changes (1)
  • CMakeLists.txt
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (windows-2022, cl.exe, default)
  • GitHub Check: cppcheck-test
🔇 Additional comments (10)
src/tests/class_tests/openms_gui/CMakeLists.txt (1)

66-66: Properly applied compiler flags to GUI test executables

This addition ensures that all Visual test executables receive consistent compiler flags through the centralized openms_add_executable_compiler_flags function, aligning with the project's strategy to use target-specific compiler flags.

src/tests/class_tests/openms/CMakeLists.txt (1)

68-68: Properly applied compiler flags to test executables

The addition of openms_add_executable_compiler_flags(${_class_test}) ensures that all test executables receive consistent compiler flags through the centralized function, improving maintainability.

src/topp/CMakeLists.txt (2)

43-43: Applied target-specific compiler flags to TOPP executables

Good use of the new openms_add_executable_compiler_flags function to ensure consistent compiler flags for non-GUI TOPP executables.


58-58: Applied target-specific compiler flags to GUI TOPP executables

Correctly applies the centralized compiler flags to GUI TOPP executables. Note that the call to openms_add_executable_compiler_flags is placed before the install_tool call and after the executable definition, maintaining the proper order of operations.

cmake/add_library_macros.cmake (1)

164-165:

Details

❓ Verification inconclusive

Improved compiler flag management with centralized helper function

Replacing direct compiler flag assignments with a call to the new helper function openms_add_library_compiler_flags is a good modernization of the CMake configuration. This centralizes compiler flag management and follows modern CMake best practices of using target-specific properties.

Per jpfeuffer's concern in the PR comments, verify that these flags are made appropriately visible to downstream executables if they're required for correct operation with OpenMS libraries.


🏁 Script executed:

#!/bin/bash
# Find the implementation of the helper functions to understand what flags are being set
# and whether they're properly exported to downstream targets

# Look for the compiler_flags.cmake or similar files that would define these functions
fd "compiler_flags.cmake" --type f

# Examine how the function is defined
rg -A 15 "function\(openms_add_library_compiler_flags" 

# Check how INTERFACE or PUBLIC flags are handled for downstream targets
rg "target_compile_options.*INTERFACE|PUBLIC" --include="*.cmake"

Length of output: 1541


Action Required: Confirm proper flag propagation for downstream dependencies

The changes in cmake/add_library_macros.cmake (lines 164–165) replace direct compiler flag assignments with a call to the centralized helper function openms_add_library_compiler_flags, which aligns with modern CMake best practices. However, after verifying the implementation in cmake/compiler_flags.cmake, it appears that the helper function applies compiler flags (such as -Wno-non-virtual-dtor for GNUC++ and address sanitizer options) using the PRIVATE scope. Please confirm that this is intentional. If downstream executables require these flags for correct operation with the OpenMS libraries, you may need to adjust the implementation to export the flags via PUBLIC or INTERFACE scopes.

  • Verify if the PRIVATE flag setting correctly meets your dependency propagation requirements.
  • Consider updating the scope to PUBLIC/INTERFACE for targets that need to inherit these flags.
cmake/compiler_flags.cmake (5)

37-41: No functional impact detected here.

These added lines mainly provide documentation and structure, which looks fine.


48-48: Clear ARM handling is appreciated.

The explanatory comments for ARM processors and references to SIMDe help future maintainers understand why no special flags are needed. This clarity is beneficial.

Also applies to: 52-55


72-81: Position-independent code logic is appropriate.

Conditionally enabling -fPIC for non-Windows platforms aligns with standard conventions and avoids linker conflicts on shared libraries.


201-215: Verify whether library flags should be public.

The library-specific flags (e.g., -Wno-non-virtual-dtor) are set to PRIVATE here. If external linking depends on certain flags or definitions, ensure these are declared as PUBLIC.


217-228: Executable flags are neatly encapsulated.

Separating these from library flags is good practice. Consider whether any essential definitions or warnings should also be public to propagate into downstream executables.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
cmake/compiler_flags.cmake (2)

123-180: Consider warning configuration effect on contributors.

The warning configuration is comprehensive and well-organized by compiler. However, disabling too many warnings (especially in Clang) might hide potential issues that contributors could fix. Consider documenting the rationale for disabling specific warnings, particularly the numerous ones disabled for Clang.

  elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    target_compile_options(${target_name} PRIVATE
      -ffp-contract=off
      -Wall -Wextra
+      # Disable warnings that are not applicable or too strict for our codebase:
      -Wno-sign-conversion
      -Wno-global-constructors
      -Wno-exit-time-destructors

205-207: Consider documenting address sanitizer integration.

The function add_asan_to_target is called but not defined in this file. Consider adding a comment to indicate where this function is defined, or ensure it's properly documented elsewhere for anyone reading this file.

  # Address sanitizer (PRIVATE)
  if(ADDRESS_SANITIZER)
+    # add_asan_to_target is defined in cmake/AddressSanitizer.cmake
    add_asan_to_target(${target_name})
  endif()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c53a80 and 550767d.

📒 Files selected for processing (1)
  • cmake/compiler_flags.cmake (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (windows-2022, cl.exe, default)
  • GitHub Check: cppcheck-test
🔇 Additional comments (7)
cmake/compiler_flags.cmake (7)

35-42: Well-structured organization enhances maintainability.

The addition of clear section headers and comments significantly improves the organization and readability of this file, making it easier to navigate and understand.


90-192: Good implementation of modular compiler flag application with PUBLIC/PRIVATE distinction.

The new openms_add_compiler_flags function properly distinguishes between PUBLIC flags (that should propagate to dependent targets) and PRIVATE flags (that should not). This addresses the concerns raised in previous reviews about flag visibility and propagation.

Key strengths of this implementation:

  • Clear separation between PUBLIC and PRIVATE flags
  • Properly propagating SIMD flags (essential for binary compatibility)
  • Applying position-independent code flag correctly
  • Comprehensive handling of compiler-specific options

This approach aligns well with modern CMake best practices by using target-specific properties rather than global settings.


211-221: Consider whether executable-specific flags are needed.

The openms_add_executable_compiler_flags function currently doesn't add any specific flags beyond what's already in the base function. If there are no executable-specific flags needed, this is fine, but it might be worth adding a comment explaining that this function exists for future extensibility or consistency with the library function.

This aligns with the past review comment where jpfeuffer asked about different flags for executables vs. libraries, and timosachsenberg confirmed that the -Wno-non-virtual-dtor flag is the only difference.

# Function to add executable-specific compiler flags
function(openms_add_executable_compiler_flags target_name)
  # Add common flags first (both PUBLIC and PRIVATE)
  openms_add_compiler_flags(${target_name})
  
-  # Executable-specific PRIVATE flags can be added here
+  # Executable-specific PRIVATE flags can be added here
+  # Currently, there are no executable-specific flags needed beyond what's in the base function.
+  # This function exists for consistency with the library function and potential future extensions.
  
  # Address sanitizer (PRIVATE)
  if(ADDRESS_SANITIZER)
    add_asan_to_target(${target_name})
  endif()
endfunction()

188-191:

Details

❓ Verification inconclusive

Consider sanitizing MY_CXX_FLAGS for better security.

While the implementation to handle custom flags is good, there might be security implications if users can inject malicious flags. Consider adding a validation step to sanitize the input or document the potential security implications of this feature.


🏁 Script executed:

#!/bin/bash
# Description: Check if MY_CXX_FLAGS is used in any CI/CD workflows or automated scripts

echo "Checking for uses of MY_CXX_FLAGS in CI/CD configurations..."
rg "MY_CXX_FLAGS" .github/ .ci/ .gitlab-ci.yml

echo "Checking for validation of MY_CXX_FLAGS in CMake files..."
rg "MY_CXX_FLAGS.*validate|validate.*MY_CXX_FLAGS" cmake/

Length of output: 462


Security: Validate and Document MY_CXX_FLAGS Input

  • In cmake/compiler_flags.cmake (lines 188–191), the custom flags from MY_CXX_FLAGS are split and passed directly to target_compile_options without any sanitization.
  • No evidence was found—via automated searches—of any existing validation for these flags.
  • Please consider either adding a validation step to sanitize MY_CXX_FLAGS (to prevent potential injection or misuse of compiler options) or, at minimum, document the potential security implications of accepting arbitrary flag inputs.

96-98:

Details

❓ Verification inconclusive

Verify C++20 standard compatibility with all supported platforms and compilers.

Setting C++20 as a required feature might cause issues on platforms with older compilers. Ensure that all supported platforms have compilers capable of C++20 support.


🏁 Script executed:

#!/bin/bash
# Description: Check minimum compiler versions required for C++20 support and compare with documentation

echo "Checking for minimum compiler version requirements in documentation..."
rg -i "compiler.*version|version.*compiler" doc/ README.md

echo "Commonly required compiler versions for C++20 support:"
echo "GCC: 10.0 or later"
echo "Clang: 10.0 or later"
echo "MSVC: Visual Studio 2019 16.11 or later"

echo "Checking for compiler version checks in CMake files..."
rg "CMAKE_CXX_COMPILER_VERSION" cmake/

Length of output: 3463


Action: Confirm C++20 Compatibility Across All Platforms

The current flag

target_compile_features(${target_name} PUBLIC cxx_std_20)

enforces C++20 features but does not perform explicit checks to ensure that all supported platforms use compilers with proper C++20 support. Based on our documentation and common requirements (GCC 10.0+, Clang 10.0+, MSVC Visual Studio 2019 16.11+), please:

  • Verify that every target platform uses a compiler meeting these minimum versions.
  • Consider adding or expanding explicit compiler version checks (similar to the check in cmake/add_library_macros.cmake) to guard against using outdated compilers.
  • If the requirements are met by existing constraints or documented elsewhere, add inline comments to clarify how C++20 compatibility is guaranteed.

195-208:

Details

❓ Verification inconclusive

Verify if the -Wno-non-virtual-dtor flag should be PUBLIC.

The current implementation marks -Wno-non-virtual-dtor as PRIVATE, which means it won't be propagated to dependent targets. If this warning suppression is necessary for downstream consumers of the library (i.e., if they might encounter warnings when using OpenMS classes with non-virtual destructors), consider making it PUBLIC.


🏁 Script executed:

#!/bin/bash
# Check if there are non-virtual destructors in public headers that might affect downstream consumers

# Search for class declarations in header files that might have non-virtual destructors
echo "Searching for potential classes with non-virtual destructors in public headers..."
rg -l "class.*\s+\{" --type cpp --type hpp include/ | xargs rg -l "~\w+\(\)" --type cpp --type hpp | xargs rg -L "virtual\s+~" --type cpp --type hpp

echo "Checking if any of these classes are exported..."
rg -l "class.*\s+\{" --type cpp --type hpp include/ | xargs rg -l "~\w+\(\)" --type cpp --type hpp | xargs rg -L "virtual\s+~" --type cpp --type hpp | xargs rg -l "OPENMS_DLLAPI" --type cpp --type hpp

Length of output: 827


Manual Verification Required: Evaluate Visibility for Non-Virtual Destructor Warning Suppression

The initial automated search was inconclusive because the file type “hpp” wasn’t recognized. Please manually verify whether any exported OpenMS classes (especially those marked with OPENMS_DLLAPI) in public headers have non-virtual destructors that might trigger warnings downstream. If such cases exist, the -Wno-non-virtual-dtor flag should be made PUBLIC to propagate the warning suppression. Otherwise, leaving it as PRIVATE might be acceptable.

  • Action Items:
    • Inspect the public header files in the include/ directory for classes with non-virtual destructors.
    • Verify if these classes are exported (look for OPENMS_DLLAPI or similar markers).
    • Confirm whether downstream consumers could receive warnings due to non-virtual destructors.
    • Consider changing the flag’s scope to PUBLIC if the warning suppression is deemed necessary for consumers.

112-116:

Details

❓ Verification inconclusive

Verify the SIMD extensions configuration is comprehensive.

The SIMD configuration correctly marks these flags as PUBLIC (essential for binary compatibility), but you should verify:

  1. Whether -mssse3 is sufficient for all required SIMD operations
  2. Whether additional processor-specific optimizations should be conditionally applied
  3. If there are any ARM-specific optimizations that could be beneficial despite the comment about SIMDe handling ARM automatically

This is especially important since these flags directly affect performance and binary compatibility.


🏁 Script executed:

#!/bin/bash
# Description: Look for SIMD usage in the codebase

echo "Searching for SIMD-related includes in the codebase..."
rg -l "#include.*<(xmmintrin|emmintrin|pmmintrin|tmmintrin|smmintrin|nmmintrin|immintrin|arm_neon|simde)" --type cpp --type hpp

echo "Checking for SIMDe-related includes..."
rg -l "#include.*simde" --type cpp --type hpp

echo "Looking for explicit SIMD-related functions or macros..."
rg "_mm[_a-z0-9]*" --type cpp --type hpp

Length of output: 633


Below is a revised plan for further verification. The original review comment remains largely valid, but our initial script ran into issues with the use of the "hpp" file type. We need to re-run the SIMD search queries using glob filters rather than file type arguments. This will help us determine whether additional SIMD includes or usages exist in the codebase that might affect the decisions made in the compiler flags.

Next Steps – Please Run the Following Script for Manual Verification:

Action Items:

  • Please run the above script and check if any SIMD-related includes or macros are present.
  • Verify if the -mssse3 flag is indeed sufficient or if more processor-specific optimizations are required.
  • Consider if there are relevant ARM-specific optimizations (even though SIMDe is cited as handling ARM automatically).

Once you’ve confirmed these details from the output, you can determine if any further changes are needed.


🏁 Script executed:

#!/bin/bash
# Re-run SIMD-related searches with explicit glob patterns for .cpp and .hpp files

echo "Searching for SIMD-related includes (.cpp and .hpp files)..."
rg -l -g "*.cpp" -g "*.hpp" '#include.*<(xmmintrin|emmintrin|pmmintrin|tmmintrin|smmintrin|nmmintrin|immintrin|arm_neon|simde)'

echo "Searching for SIMDe-related includes (.cpp and .hpp files)..."
rg -l -g "*.cpp" -g "*.hpp" '#include.*simde'

echo "Searching for explicit SIMD functions/macros (.cpp and .hpp files)..."
rg -l -g "*.cpp" -g "*.hpp" '_mm[_a-z0-9]*'

Length of output: 1226


SIMD extension configuration: Verify optimization sufficiency

The current configuration correctly marks the SIMD flags as PUBLIC. However, please verify the following:

  • Non-MSVC builds: Confirm that using -mssse3 on x64 is sufficient for all SIMD operations used across the codebase (e.g., see usage in src/openms/source/SYSTEM/BuildInfo.cpp and other files where SIMD macros appear). Consider whether supporting newer extensions like AVX2 might be beneficial.
  • MSVC builds: Ensure that /arch:AVX aligns with the SIMD requirements observed in the source, and that it provides consistent performance and compatibility.
  • ARM optimizations: Although SIMDe is employed (as evidenced by its inclusion in BuildInfo.cpp), double-check if there are any opportunities for ARM-specific optimizations that could boost performance even further.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

how about now?

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

tested TestExternalCode and worked

@timosachsenberg
timosachsenberg merged commit 43d72ba into develop Mar 19, 2025
@timosachsenberg
timosachsenberg deleted the target_compile_flags branch March 19, 2025 20:04
timosachsenberg added a commit that referenced this pull request Mar 19, 2025
* switch to target compile flags

* cleanup

* add to tests

* split into private and public flags

* attempt to remove some outdated compile flags
timosachsenberg added a commit that referenced this pull request Mar 19, 2025
* remove old mascot adapter

* remove test files

* update tests

* fix doc

* add some docs to internal classes (#7916)

add some citation information

* refactor: cmake use target_compile_flags (#7857)

* switch to target compile flags

* cleanup

* add to tests

* split into private and public flags

* attempt to remove some outdated compile flags

---------

Co-authored-by: Chris Bielow <[email protected]>
pjones added a commit that referenced this pull request Apr 7, 2025
@coderabbitai coderabbitai Bot mentioned this pull request May 4, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants