[Mlir-commits] [mlir] [mlir] enable APFloatWrappers on MacOS (PR #172070)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Dec 12 11:04:50 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-execution-engine

Author: Maksim Levental (makslevental)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/172070.diff


4 Files Affected:

- (modified) mlir/lib/ExecutionEngine/CMakeLists.txt (+5-5) 
- (modified) mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation-vector.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation.mlir (+1-1) 
- (modified) mlir/test/lit.cfg.py (+2-2) 


``````````diff
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index a6153523a5e97..3ce4079f16644 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -168,8 +168,8 @@ if(LLVM_ENABLE_PIC)
   set_property(TARGET mlir_float16_utils PROPERTY CXX_STANDARD 17)
   target_compile_definitions(mlir_float16_utils PRIVATE mlir_float16_utils_EXPORTS)
 
-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-    # TODO: This support library is only used on Linux builds until we figure
+  if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+    # TODO: This support library is only used on Linux and Mac builds until we figure
     # out how to hide LLVM symbols in a way that works for all platforms.
     add_mlir_library(mlir_apfloat_wrappers
       SHARED
@@ -185,7 +185,7 @@ if(LLVM_ENABLE_PIC)
     )
     target_compile_definitions(mlir_apfloat_wrappers PRIVATE mlir_apfloat_wrappers_EXPORTS)
     # Hide LLVM symbols to avoid ODR violations.
-    target_link_options(mlir_apfloat_wrappers PRIVATE "-Wl,--exclude-libs,ALL")
+    target_link_options(mlir_apfloat_wrappers PRIVATE $<$<PLATFORM_ID:Linux>:LINKER:--exclude-libs,ALL>)
   endif()
 
   add_subdirectory(SparseTensor)
@@ -205,8 +205,8 @@ if(LLVM_ENABLE_PIC)
   set_property(TARGET mlir_c_runner_utils PROPERTY CXX_STANDARD 17)
   target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS)
 
-  # Conditionally link apfloat wrappers only on Linux.
-  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+  # Conditionally link apfloat wrappers only on Linux and Mac.
+  if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
     target_link_libraries(mlir_c_runner_utils PUBLIC mlir_apfloat_wrappers)
   endif()
 
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation-vector.mlir b/mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation-vector.mlir
index 5f8b2f4efcf24..dfd9e7c4aaa14 100644
--- a/mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation-vector.mlir
+++ b/mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation-vector.mlir
@@ -1,4 +1,4 @@
-// REQUIRES: system-linux
+// REQUIRES: system-linux || system-darwin
 // TODO: Run only on Linux until we figure out how to build
 // mlir_apfloat_wrappers in a platform-independent way.
 
diff --git a/mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation.mlir b/mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation.mlir
index 7f72dd5931488..e6c60001e5aee 100644
--- a/mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation.mlir
+++ b/mlir/test/Integration/Dialect/Arith/CPU/test-apfloat-emulation.mlir
@@ -1,4 +1,4 @@
-// REQUIRES: system-linux
+// REQUIRES: system-linux || system-darwin
 // TODO: Run only on Linux until we figure out how to build
 // mlir_apfloat_wrappers in a platform-independent way.
 
diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py
index 675ded35d98f3..9c5bee169efe0 100644
--- a/mlir/test/lit.cfg.py
+++ b/mlir/test/lit.cfg.py
@@ -214,8 +214,8 @@ def find_real_python_interpreter():
     "not",
 ]
 
-if "Linux" in config.host_os:
-    # TODO: Run only on Linux until we figure out how to build
+if "Linux" in config.host_os or "Darwin" in config.host_os:
+    # TODO: Run only on Linux and Mac until we figure out how to build
     # mlir_apfloat_wrappers in a platform-independent way.
     tools.extend([add_runtime("mlir_apfloat_wrappers")])
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/172070


More information about the Mlir-commits mailing list