Skip to content

Add a MacOS builder #269

Open
Open

Description

@rengolin

After #267 Lighthouse is supposed to run on MacOS, but we need a CI builder to make sure it works consistently and doesn't regress.

I've added macos-26 to the matrix in https://github.com/llvm/lighthouse/tree/macos, but the error in Torch means we'll have to also update the toml file somehow.

error: Distribution `torch==2.13.0+cpu @ registry+[https://download.pytorch.org/whl`](https://download.pytorch.org/whl%60) can't be installed because it doesn't have a source distribution or wheel for the current platform
hint: You're on macOS (`macosx_26_0_arm64`), but `torch` (v2.13.0+cpu) only has wheels for the following platforms: `manylinux_2_28_aarch64`, `manylinux_2_28_x86_64`, `linux_s390x`, `win_amd64`, `win_arm64`; consider adding "sys_platform == 'darwin' and platform_machine == 'arm64'" to `tool.uv.required-environments` to ensure uv resolves to a version with compatible wheels
Error: Process completed with exit code 2.

Torch-MLIR also doesn't have support for MacOS (only manylinux and win), so that's another thing that we'll need to fix before we can officially claim to support MacOS.

Activity

  1. FedericoBruzzone commented on Aug 26, 2026

    @FedericoBruzzone
    Member

    Hi @rengolin, thanks for iterating on this🙏

    I'm able to reproduce it locally. In my first setup, I deliberately skipped: uv sync --extra ingress-torch-cpu --extra runtime_mpich.
    However, while for Torch, it's actually a simple fix since the +cpu postfix (within the toml file) is not needed on Darwin, for torch-mlir we don't have the macOS support right now (see here), as you pointed out :(

    So, the torch-mlir-release README explicitly say:

    At the moment only Linux (x86_64 + AArch64) and Windows (x86_64) builds are published. If you are interested in other configurations, please send a PR.

    What do you suggest we do?

  2. rengolin commented on Aug 26, 2026

    @rengolin
    MemberAuthor

    What do you suggest we do?

    Send a PR? 😄

    Now seriously, it should be simple to do get macOS on the matrix, but getting all the tests to pass is a whole different matter. I think it would be an interesting conversation at the very least. Starting with an issue, and perhaps a mock PR that shows what crashes would be a good start.

  3. FedericoBruzzone commented on Aug 27, 2026

    @FedericoBruzzone
    Member

    Send a PR? 😄

    I hadn't thought about that, you know? :'D

    Now seriously, it should be simple to do get macOS on the matrix, but getting all the tests to pass is a whole different matter. I think it would be an interesting conversation at the very least. Starting with an issue, and perhaps a mock PR that shows what crashes would be a good start.

    I'm working on this. I'll send a PR ASAP. Thank you!
    I have an AI-assisted commit in which I'm running the GH action against (it works locally).

  4. aeft commented on Nov 14, 2026

    @aeft
    Member

    I ran the CI steps from the macos branch locally on an Apple M2 Pro (macOS 26.5), on main (d753671). Two changes get it most of the way:

    1. pyproject.toml: there is no +cpu torch wheel for macOS, so use a platform marker:
      "torch==v2.13.0+cpu ; sys_platform != 'darwin'",
      "torch==v2.13.0 ; sys_platform == 'darwin'",
      torch-mlir 20261001, mpich and mpi4py already have macOS arm64 wheels.
    2. tools/kernel-bench hardcodes libmlir_c_runner_utils.so (.dylib on macOS). Runner already adds this library with the right suffix, so kernel-bench doesn't need to pass it.

    With both, lit gives 87 passed / 6 failed / 2 unsupported. The 6 failures (test/transform/test_subgraph_tiling.py and five examples/xegpu/llama-bench_1B_* tests) all segfault at prepare_subgraphs.py:112 on every run, while the same commit passes on Linux CI. I'm looking into it.

    @FedericoBruzzone are you still working on this? If not, I'm happy to send a PR against main for 1 and 2 (without the CI change for now, since it would hit the segfault).

  5. FedericoBruzzone commented on Nov 14, 2026

    @FedericoBruzzone
    Member

    Thank you for the report. Due to the current backlog upstream and my research, no.
    Unfortunately, I don't have the time I'd like to have for Lighthouse :(

    Before starting this, I'd wait for @rengolin to know the current status of MacOS support and/or Torch-MLIR release migration and so on.

  6. rengolin commented on Nov 14, 2026

    @rengolin
    MemberAuthor

    know the current status of MacOS support and/or Torch-MLIR release migration

    Torch-MLIR has support for MacOS: https://pypi.org/project/torch-mlir/#files
    And so does MLIR Python Bindings: https://github.com/llvm/eudsl/releases/tag/mlir-python-bindings
    We should be fine on that front.

    The main constraint is lighthouse itself (#283). @tkarna how are we doing on this front?

    1. pyproject.toml: there is no +cpu torch wheel for macOS,

    This should be fine. @FedericoBruzzone is this something you did on your tests, too?

    The 6 failures (test/transform/test_subgraph_tiling.py and five examples/xegpu/llama-bench_1B_* tests) all segfault at prepare_subgraphs.py:112 on every run, while the same commit passes on Linux CI. I'm looking into it.

    XeGPU example should not need to run on MacOS. Though, that tests is just a PyTorch scaled attention, so it should not be a problem.

  7. FedericoBruzzone commented on Nov 14, 2026

    @FedericoBruzzone
    Member

    This should be fine. @FedericoBruzzone is this something you did on your tests, too?

    Yup, exactly. I don't recall why I didn't open the PR (may I was convinced that I had), but I do have a branch with this diff:

    diff --git a/pyproject.toml b/pyproject.toml
    index bf3ce5f..abedc61 100644
    --- a/pyproject.toml
    +++ b/pyproject.toml
    @@ -23,13 +23,14 @@ dev = [
    
     [project.optional-dependencies]
     ingress_torch_mlir = [
    -    "torch-mlir==20260805.836",
    +    "torch-mlir==20260805.836 ; sys_platform != 'darwin'",
         "ml_dtypes",
         "transformers",
     ]
     # Additional "targets" which pull in optional dependencies -- use `uv sync --extra TARGET`
     ingress_torch_cpu = [
    -    "torch==v2.13.0+cpu",
    +    "torch==2.13.0+cpu ; sys_platform != 'darwin'",
    +    "torch==2.13.0 ; sys_platform == 'darwin'",
         "lighthouse[ingress_torch_mlir]"
     ]
     ingress_torch_nvidia = [
    @@ -68,8 +69,12 @@ conflicts = [
     [tool.uv.sources]
     # Bind packages to particular package repositories
     mlir_python_bindings = { index = "eudsl" }
    -torch = { index = "pytorch" }
    -torch_mlir = { index = "torch_mlir" }
    +torch = [
    +    { index = "pytorch", marker = "sys_platform != 'darwin'" },
    +]
    +torch_mlir = [
    +    { index = "torch_mlir", marker = "sys_platform != 'darwin'" },
    +]
    
     # The following are the different non-Pypi package repositories we depend on
     [[tool.uv.index]]

    I hope this helps, folks :D

  8. aeft commented on Nov 14, 2026

    @aeft
    Member

    @rengolin @FedericoBruzzone #322 and #323 fix the issues I found. With both, plus the CI change from the macos branch, all three Pre-Commit jobs pass on my fork, and macOS gives 93 passed / 2 unsupported, same as Linux: https://github.com/aeft/lighthouse/actions/runs/43635619040

    Once both PRs land, the CI change should be the last step. Happy to send it as a PR against main, or leave it to you.

  9. rengolin commented on Nov 14, 2026

    @rengolin
    MemberAuthor

    Nice! Both were good fixes, I merged them, thanks! Now we just need to add the workflow for macos.

  10. FedericoBruzzone commented on Nov 15, 2026

    @FedericoBruzzone
    Member

    Thank you :D

    Happy to send it as a PR against main, or leave it to you.

    This aspect is tracked under #283.
    Overall, I'd wait for @tkarna.

  11. aeft commented on Nov 15, 2026

    @aeft
    Member

    @FedericoBruzzone Thanks! I think #283 is already covered by #302 (torch-mlir now comes from PyPI), and the fork run above installs it from there on macOS.

    @rengolin would you like to push your macos branch as a PR, or should I open one with your commit? cc @tkarna in case anything in #283 is still missing.

  12. rengolin commented on Nov 15, 2026

    @rengolin
    MemberAuthor

    That's an old branch. Feel free to cheery pick and open a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions