Skip to content

[LLVMCPU] Add missing f64 musl builtins for ONNX operations - #24953

Open
Prajit-Rahul wants to merge 2 commits into
iree-org:mainfrom
Prajit-Rahul:fix/llvmcpu-f64-math-builtins
Open

Prajit-Rahul wants to merge 2 commits into
iree-org:mainfrom
Prajit-Rahul:fix/llvmcpu-f64-math-builtins

Conversation

@Prajit-Rahul

@Prajit-Rahul Prajit-Rahul commented Sep 21, 2026

Copy link
Copy Markdown

LLVMCPU executable linking fails with undefined references when generated code calls exp, floor, log, or round. This is because their f64 implementations and dependencies are missing from IREE's embedded musl bitcode.

Added the missing sources and dependencies to wasm32 and wasm64 musl Makefiles and regenerated the bitcode libraries. During embedded linking, LLVMCPU uses the generic wasm32 and wasm64 bitcode libraries to provide C math functions to 32-bit and 64-bit targets.

Removed the twelve now-passing ONNX cases from O0 and O2 expected-compilation-failure list.

Progress on #24378.

Assisted-by: Codex

@github-actions

Copy link
Copy Markdown

Hello @Prajit-Rahul 👋

Thank you for submitting a Pull Request to IREE! It looks like this is your first one. We have one ask, and you can also find some general tips below.


Action required: acknowledge IREE project policies

IREE is a Linux Foundation project. All participants are expected to follow the LF Projects Code of Conduct.

All contributions to IREE must follow our IREE AI Tool Use Policy. In particular:

  • Contributors must fully understand, and vouch for, all submitted changes and the intent behind them.
  • Substantial use of LLM/generative AI tools must be noted in the PR description, e.g. via Assisted-by: tool-name or Co-authored-by: tool-name tool@email trailers.
  • Contributors must write PR descriptions themselves. There must always be a human in the loop: contributors must respond to reviews and questions by themselves.
    If a response includes LLM-assisted segments (e.g. reproducers, LLM agent analysis excerpts), the segment should be clearly marked as "assisted", same as for PR contents.
  • GitHub issues labeled as "Good first issue" are explicitly designated as learning opportunities for newcomers to the project. With exceptions for boilerplate edits, AI tool usage for resolutions to such issues is forbidden.

We kindly ask you to reply to this message and confirm that you understand and accept the cited policies, particularly the AI Tool Use Policy.


General guidance

Our general Contributing guide contains information and links to detailed guides on code quality, testing, commit summaries and our CI system.

A common point for new PRs: if a DCO signing check fails for you, check out the section on Developer Certificate of Origin.
In these cases, it should suffice to amend your commit signature(s) per the guide and force-push the PR branch.

If you have any questions, feel free to leave a comment here, or ask away on IREE Discord.

Thank you,
The IREE Community

@Prajit-Rahul Prajit-Rahul changed the title [LLVMCPU] Add f64 exp, log, and round musl builtins [LLVMCPU] Add missing musl math builtins for ONNX math operations Sep 21, 2026
@Prajit-Rahul Prajit-Rahul changed the title [LLVMCPU] Add missing musl math builtins for ONNX math operations [LLVMCPU] Complete generic musl math builtins for LLVM libcalls Sep 21, 2026
@Prajit-Rahul

Copy link
Copy Markdown
Author

I have read and understand the IREE project policies, including the AI Tool Use Policy, and agree to follow them. I understand and can vouch for all changes submitted in this PR.

@Prajit-Rahul Prajit-Rahul changed the title [LLVMCPU] Complete generic musl math builtins for LLVM libcalls [LLVMCPU] Add missing f64 musl builtins for mixed-type ONNX Pow Sep 21, 2026
@Prajit-Rahul
Prajit-Rahul force-pushed the fix/llvmcpu-f64-math-builtins branch from d9c1fd2 to 0926684 Compare September 21, 2026 20:30
@Prajit-Rahul
Prajit-Rahul marked this pull request as ready for review September 21, 2026 20:37
Signed-off-by: Prajit-Rahul <prajitrahul05@gmail.com>
@Prajit-Rahul
Prajit-Rahul force-pushed the fix/llvmcpu-f64-math-builtins branch from 0926684 to c501fb7 Compare September 21, 2026 22:08
@Prajit-Rahul Prajit-Rahul changed the title [LLVMCPU] Add missing f64 musl builtins for mixed-type ONNX Pow [LLVMCPU] Add missing f64 musl builtins for ONNX operations Sep 21, 2026
@AGindinson

AGindinson commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

@Prajit-Rahul, thanks for the PR! A couple asks:

  • Please rewrite the PR description yourself, as per the accepted policy. The current LLM-written description makes the change harder to understand (e.g. the "Testing" section is completely unnecessary, and without looking at the code, it's unclear how WASM and CPU targets relate to one another in this scope)
  • Please note the CI failures in the ONNX ops suite

Signed-off-by: Prajit-Rahul <prajitrahul05@gmail.com>
@Prajit-Rahul
Prajit-Rahul force-pushed the fix/llvmcpu-f64-math-builtins branch from 31ddd82 to b278070 Compare September 22, 2026 20:12
@Prajit-Rahul

Copy link
Copy Markdown
Author

@Prajit-Rahul, thanks for the PR! A couple asks:

  • Please rewrite the PR description yourself, as per the accepted policy. The current LLM-written description makes the change harder to understand (e.g. the "Testing" section is completely unnecessary, and without looking at the code, it's unclear how WASM and CPU targets relate to one another in this scope)
  • Please note the CI failures in the ONNX ops suite

Thanks for the feedback. I’ve revised the description to clarify that LLVMCPU uses the generic wasm32/wasm64 musl bitcode libraries to supply math functions for native CPU targets and removed the Testing section.

The ONNX O0 and O2 jobs failed because six tests still listed as expected compilation failures now compile and run successfully. I have also removed those six entries from both expected-failure lists in the follow-up commit. I’ll check the O0 and O2 results when the new CI jobs run.

This branch has not been deployed

No deployments
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