Skip to content

Conversation

@lialan
Copy link
Contributor

@lialan lialan commented Dec 8, 2025

llvm/llvm-project#168622 changed how frem is lowered.
Instead of calling fmodf directly, it now expands frem using frexpf, ldexpf, and rintf.

  • added those files in the Makefiles.
  • re-compiled bytecodes with latest llvm binary: 65dd29b335ce6

@lialan lialan requested a review from benvanik as a code owner December 8, 2025 22:33
@lialan
Copy link
Contributor Author

lialan commented Dec 8, 2025

This is needed to remove the revert in the integration #22856

@bangtianliu
Copy link
Contributor

This PR can fix the error I came across during LLVM integration as shown below:

cd /home/bangtliu/megabump/work/iree-build/tests/e2e/stablehlo_ops && /home/bangtliu/megabump/work/iree-build/tools/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --iree-hal-target-backends=llvm-cpu --iree-input-demote-f64-to-f32 --iree-llvmcpu-target-cpu=generic /home/bangtliu/megabump/work/iree/tests/e2e/stablehlo_ops/remainder.mlir -o check_llvm-cpu_local-task_remainder.mlir_module.vmfb --iree-hal-executable-object-search-path=\"/home/bangtliu/megabump/work/iree-build\" --iree-llvmcpu-embedded-linker-path=\"/home/bangtliu/megabump/work/iree-build/llvm-project/bin/lld\" --iree-llvmcpu-wasm-linker-path=\"/home/bangtliu/megabump/work/iree-build/llvm-project/bin/lld\"
lld: error: undefined symbol: frexpf
> referenced by remainder.mlir:4
> >>>               /tmp/remainder_linked-e94d1e.o:(_scalar_dispatch_0_elementwise)
> >>> referenced by remainder.mlir:4
> >>>               /tmp/remainder_linked-e94d1e.o:(_scalar_dispatch_0_elementwise)
> >>> referenced by remainder.mlir:12
> >>>               /tmp/remainder_linked-e94d1e.o:(_tensor_dispatch_0_elementwise_3_f32)
> >>> referenced 5 more times
> 
> lld: error: undefined symbol: ldexpf
> >>> referenced by remainder.mlir:4
> >>>               /tmp/remainder_linked-e94d1e.o:(_scalar_dispatch_0_elementwise)
> >>> referenced by remainder.mlir:4
> >>>               /tmp/remainder_linked-e94d1e.o:(_scalar_dispatch_0_elementwise)
> >>> referenced by remainder.mlir:4
> >>>               /tmp/remainder_linked-e94d1e.o:(_scalar_dispatch_0_elementwise)
> >>> referenced 17 more times
> 
> lld: error: undefined symbol: rintf
> >>> referenced by remainder.mlir:4
> >>>               /tmp/remainder_linked-e94d1e.o:(_scalar_dispatch_0_elementwise)
> >>> referenced by remainder.mlir:4
> >>>               /tmp/remainder_linked-e94d1e.o:(_scalar_dispatch_0_elementwise)
> >>> referenced by remainder.mlir:12
> >>>               /tmp/remainder_linked-e94d1e.o:(_tensor_dispatch_0_elementwise_3_f32)
> >>> referenced 5 more times
> Linking failed; escaped command line returned exit code 256:

With the change from this PR, we can drop the revert of llvm/llvm-project#168622 in the next LLVM integration.

@lialan lialan merged commit 6ccb336 into main Dec 9, 2025
49 of 51 checks passed
@lialan lialan deleted the users/lialan/fix_libcall branch December 9, 2025 12:35
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.

3 participants