heir
heir copied to clipboard
Fully support MacOS Github CI
A few problems remaining with the current workflow runner:
- The jit errors we see internally for mlir-runner are also showing up on macos
- OpenFHE compilation in the frontend JIT is failing, likely because the include paths are not set up properly.
- polynomial approximation unit tests are failing (!) with differences of actual values.
The build succeeds, but those tests fail, so I'm setting the workflow to run daily with the tests restricted to running //tests/Dialect/...:all
Example failures:
mlir-runner
******************** TEST 'heir :: Dialect/Polynomial/Conversions/heir_polynomial_to_llvm/lower_ntt_runner.mlir' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
heir-opt /private/var/tmp/_bazel_runner/31b3ff210e07fc40bb7ba4b62e323c0a/sandbox/darwin-sandbox/10596/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/tests/Dialect/Polynomial/Conversions/heir_polynomial_to_llvm/lower_ntt_runner.mlir.test.runfiles/_main/tests/Dialect/Polynomial/Conversions/heir_polynomial_to_llvm/lower_ntt_runner.mlir --heir-polynomial-to-llvm | mlir-runner -e test_poly_ntt -entry-point-result=void ...
# .---command stderr------------
# | JIT session error: Symbols not found: [ __mlir_ciface_printMemrefI32 ]
# | Error: Failed to materialize symbols: { (main, { __mlir_printMemrefI32, __mlir_test_poly_ntt, _test_poly_ntt }) }
# `-----------------------------
# error: command failed with exit status: 1
--
poly approximation
******************** TEST 'heir :: Transforms/polynomial_approximation/poylnomial_approximation.mlir' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
heir-opt --polynomial-approximation /private/var/tmp/_bazel_runner/31b3ff210e07fc40bb7ba4b62e323c0a/sandbox/darwin-sandbox/10298/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir.test.runfiles/_main/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir | FileCheck /private/var/tmp/_bazel_runner/31b3ff210e07fc40bb7ba4b62e323c0a/sandbox/darwin-sandbox/10298/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir.test.runfiles/_main/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir
# executed command: heir-opt --polynomial-approximation /private/var/tmp/_bazel_runner/31b3ff210e07fc40bb7ba4b62e323c0a/sandbox/darwin-sandbox/10298/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir.test.runfiles/_main/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir
# executed command: FileCheck /private/var/tmp/_bazel_runner/31b3ff210e07fc40bb7ba4b62e323c0a/sandbox/darwin-sandbox/10298/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir.test.runfiles/_main/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir
# .---command stderr------------
# | /private/var/tmp/_bazel_runner/31b3ff210e07fc40bb7ba4b62e323c0a/sandbox/darwin-sandbox/10298/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir.test.runfiles/_main/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir:6:17: error: CHECK-SAME: expected string not found in input
# | // CHECK-SAME: 0.99458116404270657 + 0.99565537253615788x + 0.54297028147256321x**2 + 0.17954582110873779x**3
# | ^
# | <stdin>:5:22: note: scanning from here
# | %0 = polynomial.eval #polynomial<typed_float_polynomial <0.99458116404270657 + 0.99565537253615766x + 0.54297028147256321x**2 + 0.17954582110873807x**3> : !poly>, %arg0 : f32
# | ^
# | <stdin>:5:59: note: possible intended match here
# | %0 = polynomial.eval #polynomial<typed_float_polynomial <0.99458116404270657 + 0.99565537253615766x + 0.54297028147256321x**2 + 0.17954582110873807x**3> : !poly>, %arg0 : f32
# | ^
# |
# | Input file: <stdin>
# | Check file: /private/var/tmp/_bazel_runner/31b3ff210e07fc40bb7ba4b62e323c0a/sandbox/darwin-sandbox/10298/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir.test.runfiles/_main/tests/Transforms/polynomial_approximation/poylnomial_approximation.mlir
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | 1: #ring_f64_ = #polynomial.ring<coefficientType = f64>
# | 2: !poly = !polynomial.polynomial<ring = #ring_f64_>
# | 3: module {
# | 4: func.func @test_exp(%arg0: f32) -> f32 {
# | 5: %0 = polynomial.eval #polynomial<typed_float_polynomial <0.99458116404270657 + 0.99565537253615766x + 0.54297028147256321x**2 + 0.17954582110873807x**3> : !poly>, %arg0 : f32
# | same:6'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | same:6'1 ? possible intended match
# | 6: return %0 : f32
# | same:6'0 ~~~~~~~~~~~~~~~~~
# | 7: }
# | same:6'0 ~~~
# | 8: func.func @test_sin_default_params(%arg0: f32) -> f32 {
# | same:6'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 9: %0 = polynomial.eval #polynomial<typed_float_polynomial <1.0000447503083003 + 1.000038346414684x + 0.499196982585003x**2 + 0.16642465621910582x**3 + 0.043793696409965249x**4 + 0.0087381910100117806x**5> : !poly>, %arg0 : f32
# | 10: return %0 : f32
# | 11: }
# | 12: }
# | 13:
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
Openfhe platform issues in frontend
Undefined symbols for architecture arm64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
bool std::__1::operator==[abi:ne180100]<char, std::__1::char_traits<char>, std::__1::allocator<char>>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, char const*) in libcore.a[2](constants-lattice-impl.o)
"std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char>>::str() const", referenced from:
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char>>::str[abi:ne180100]() const in libpke.a[4](cryptocontext.o)
"std::__1::__shared_weak_count::__get_deleter(std::type_info const&) const", referenced from:
vtable for std::__1::__shared_ptr_emplace<lbcrypto::CoefPackedEncoding, std::__1::allocator<lbcrypto::CoefPackedEncoding>> in foo-e06a74.o
vtable for std::__1::__shar
...
polynomial approximation unit tests
1 FAILED TEST
================================================================================
FAIL: //lib/Utils/Approximation:CaratheodoryFejerTest (Exit 1) (see /private/var/tmp/_bazel_runner/31b3ff210e07fc40bb7ba4b62e323c0a/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/lib/Utils/Approximation/CaratheodoryFejerTest/test.log)
INFO: From Testing //lib/Utils/Approximation:CaratheodoryFejerTest:
==================== Test output for //lib/Utils/Approximation:CaratheodoryFejerTest:
Running main() from gmock_main.cc
[==========] Running 3 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 3 tests from CaratheodoryFejerTest
[ RUN ] CaratheodoryFejerTest.ApproximateExpDegree3
lib/Utils/Approximation/CaratheodoryFejerTest.cpp:30: Failure
Expected equality of these values:
actual
Which is: 72-byte object <F8-D7 27-05 01-00 00-00 D0-44 70-5A 01-00 00-00 04-00 00-00 07-00 00-00 08-D7 27-05 01-00 00-00 E8-68 24-05 01-00 00-00 40-7E D9-BD CE-41 14-00 00-00 00-00 02-00 00-00 00-00 00-00 00-00 00-00 40-00 00-00 01-00 00-00>
expected
Which is: 72-byte object <F8-D7 27-05 01-00 00-00 C0-C0 A4-03 00-[60](https://github.com/google/heir/actions/runs/13658927529/job/38185215613?pr=1516#step:5:61) 00-00 04-00 00-00 04-00 00-00 00-60 EB-6A 01-00 00-00 3C-0D 02-05 01-00 00-00 40-83 44-03 00-60 00-00 E8-C0 D4-00 00-60 00-00 70-5E EB-6A 01-00 00-00 CC-0A 02-05 01-00 00-00>
[ FAILED ] CaratheodoryFejerTest.ApproximateExpDegree3 (4 ms)
I was able to pass the tests with mlir-runner on a macOS machine by adding alwayslink = True to both the _mlir_c_runner_utils and _mlir_runner_utils library targets in the BUILD.bazel file within mlir.
cc_library(
name = "_mlir_runner_utils",
srcs = ["lib/ExecutionEngine/RunnerUtils.cpp"],
hdrs = ["include/mlir/ExecutionEngine/RunnerUtils.h"],
includes = ["include"],
deps = [
":mlir_c_runner_utils",
":mlir_float16_utils",
],
alwayslink = True,
)
Thank you!! I should be able to upstream this next week.