Skip to content

remove flags #671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2025
Merged

remove flags #671

merged 1 commit into from
May 11, 2025

Conversation

meiravgri
Copy link
Collaborator

@meiravgri meiravgri commented May 8, 2025

This PR removes the following global compiler flags from the CMake configuration:

-march=native -mtune=native

These flags were originally introduced in [#598](#598) to enable high-performance execution of the SVS dependency by leveraging the build machine's full CPU capabilities.

However, applying -march=native and -mtune=native globally causes several issues:

  • Cross-device compatibility: hese flags enforce optimizations based on the build machine's architecture, making the resulting binaries potentially incompatible with machines of different architectures.

  • Conflicts with file-specific flags: Some files require specific architecture features. For example, ARM files using intrinsics like vdotq_s32 are explicitly compiled with -march=armv8.2-a+dotprod. Despite this, the presence of -mtune=native breaks the build. Removing it resolves the issue. This may be a bug in how GCC chains -mtune=native in combination with specific -march= overrides, as discussed here https://bugs.gentoo.org/884549.

  • Inconsistent optimization strategy: In VecSim, architecture-specific optimizations are selected dynamically at runtime using a dispatcher based on the actual CPU running the binary. This pattern is also being extended for SVS in [intel/SVS PR #113](CPUArch dispatching and unified shared library intel/ScalableVectorSearch#113).

Summary

We are removing -march=native and -mtune=native from the global CMake configuration to:

  • They lock in optimizations for the build machine’s CPU, breaking portability.
  • They interfere with files requiring explicit -march values.
  • They are incompatible with our runtime architecture selection strategy.

This change ensures that:

  • The global build remains architecture-agnostic and portable.
  • File-specific or runtime-selected optimizations can be applied safely where needed.

Copy link

codecov bot commented May 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.24%. Comparing base (98cf0a1) to head (68a37a1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #671   +/-   ##
=======================================
  Coverage   96.24%   96.24%           
=======================================
  Files         112      112           
  Lines        6278     6278           
=======================================
  Hits         6042     6042           
  Misses        236      236           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@meiravgri meiravgri requested review from alonre24 and GuyAv46 May 9, 2025 05:49
@meiravgri meiravgri enabled auto-merge May 9, 2025 05:49
@meiravgri meiravgri added this pull request to the merge queue May 11, 2025
Merged via the queue into main with commit fbff84f May 11, 2025
31 of 32 checks passed
@meiravgri meiravgri deleted the revert_cmake_flags branch May 11, 2025 08:28
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