Skip to content

Add missing algorithm header to jit_compiler.cpp for Linux builds #2460

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
Aug 4, 2025

Conversation

zamderax
Copy link
Contributor

@zamderax zamderax commented Aug 4, 2025

Summary

This PR fixes issue #2459 by adding the missing algorithm header to mlx/backend/cpu/jit_compiler.cpp.

Problem

The file uses std::find_if on line 121 but wasn't including the algorithm header that defines it. While this might work on some platforms where algorithm is transitively included through other headers, it's not guaranteed by the C++ standard. On Linux with GCC/Clang, the transitive inclusion doesn't happen, causing build failures.

Solution

Added include algorithm to the includes section of jit_compiler.cpp to explicitly include the header that defines std::find_if.

Testing

  • Built successfully on macOS with Clang
  • All existing tests pass (225 test cases, 3290 assertions)
  • The change is minimal and safe - only adds a required header

Related Issues

Fixes #2459

Fixes compilation error on Linux where std::find_if is used on line 121
but the <algorithm> header was not included. While this might work on
some platforms due to transitive includes, it's not guaranteed by the
C++ standard.

Resolves issue ml-explore#2459
Copy link
Member

@awni awni left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@awni awni merged commit 737dd6d into ml-explore:main Aug 4, 2025
7 checks passed
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.

Add #include <algorithm> to jit_compiler.cpp for Linux builds
2 participants