Skip to content

Commit e95a1ee

Browse files
committed
🐛 Preserve MLIR exception diagnostics on macOS
Honor explicit RTTI requirements at the existing exception boundaries. Keep LLVM command-line option classes in a separate exception-free target so their SDK-compatible RTTI setting cannot hide standard exception types. Report ordinary benchmark CLI failures directly and preserve QDMI error messages without capturing and rethrowing exceptions. Require failure cases to return status 1 with a diagnostic instead of accepting aborts. Assisted-by: GPT-6 via Codex
1 parent bb5ec85 commit e95a1ee

10 files changed

Lines changed: 307 additions & 133 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ releases may include breaking changes.
1010

1111
## [Unreleased]
1212

13+
- 🐛 Preserve QDMI error details and report benchmark CLI failures without
14+
aborting when using an LLVM SDK without RTTI on macOS. ([#2545])
15+
([**@burgholzer**])
16+
1317
- ✨ Optimize constant two-qubit blocks before placement and during native
1418
synthesis. Remove cancelled interactions before routing and preserve cheaper
1519
native operations in both target compilation and synthesis. Avoid redundant
@@ -1121,6 +1125,7 @@ for previous changelogs._
11211125

11221126
[#2538]: https://github.com/munich-quantum-toolkit/core/pull/2538
11231127
[#2537]: https://github.com/munich-quantum-toolkit/core/pull/2537
1128+
[#2545]: https://github.com/munich-quantum-toolkit/core/pull/2545
11241129
[#2535]: https://github.com/munich-quantum-toolkit/core/pull/2535
11251130
[#2531]: https://github.com/munich-quantum-toolkit/core/pull/2531
11261131
[#2526]: https://github.com/munich-quantum-toolkit/core/pull/2526

‎cmake/SetupMLIR.cmake‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function(mqt_llvm_target_disable_rtti target_name)
5555
if(NOT TARGET ${target_name})
5656
message(FATAL_ERROR "Cannot configure RTTI for missing target ${target_name}.")
5757
endif()
58-
if(NOT LLVM_ENABLE_RTTI)
58+
if(NOT (LLVM_ENABLE_RTTI OR LLVM_REQUIRES_RTTI))
5959
target_compile_options(${target_name}
6060
PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${LLVM_CXXFLAGS_RTTI_DISABLE}>)
6161
endif()

‎mlir/bench/CMakeLists.txt‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,29 @@ add_subdirectory(programs)
1212
add_library(MQTBenchmarkGenerate STATIC Generate.cpp)
1313
add_library(MQT::CoreBenchGenerate ALIAS MQTBenchmarkGenerate)
1414
target_link_libraries(MQTBenchmarkGenerate PUBLIC MQTBenchmarkPrograms MQTCompilerPipeline)
15+
# The existing JSON parser APIs can throw through this target.
16+
set(LLVM_REQUIRES_EH ON)
17+
set(LLVM_REQUIRES_RTTI ON)
1518
mqt_mlir_target_use_project_options(MQTBenchmarkGenerate)
19+
unset(LLVM_REQUIRES_EH)
20+
unset(LLVM_REQUIRES_RTTI)
1621

17-
# The executable that generates and evaluates configured benchmarks.
22+
# The executable that generates and evaluates configured benchmarks. LLVM option classes use the
23+
# SDK's RTTI setting; exception handlers need RTTI on macOS.
24+
add_library(MQTBenchmarkCommandLine OBJECT Main.cpp)
25+
mqt_mlir_target_use_project_options(MQTBenchmarkCommandLine)
1826
add_executable(mqt-core-bench MQTCoreBench.cpp)
1927
if(WIN32)
2028
# Keep the executable import library distinct from the benchmark library.
2129
set_target_properties(mqt-core-bench PROPERTIES ARCHIVE_OUTPUT_NAME mqt-core-bench-executable)
2230
endif()
23-
target_link_libraries(mqt-core-bench PRIVATE MQT::CoreBenchGenerate MLIRSupport)
31+
target_link_libraries(mqt-core-bench PRIVATE MQTBenchmarkCommandLine MQT::CoreBenchGenerate
32+
MLIRSupport)
2433
set(LLVM_REQUIRES_EH ON)
34+
set(LLVM_REQUIRES_RTTI ON)
2535
mqt_mlir_target_use_project_options(mqt-core-bench)
2636
unset(LLVM_REQUIRES_EH)
37+
unset(LLVM_REQUIRES_RTTI)
2738
mlir_check_all_link_libraries(mqt-core-bench)
2839

2940
if(MQT_CORE_INSTALL)

0 commit comments

Comments
 (0)