Repository navigation
♻️ Propagate native failures through explicit results and diagnostics - #2545
burgholzer wants to merge 12 commits into
Conversation
18f186e to
e95a1ee
Compare
c5bdf1b to
46025a6
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
f410460 to
bb0ae82
Compare
bb0ae82 to
f7553f5
Compare
0e7e58b to
501b3b9
Compare
1a125ca to
c5f0dd5
Compare
8c8deda to
f33d8d8
Compare
Will try to get through this either today or tomorrow (more likely). |
They were not supported before as well, but probably still makes sense to have that guard. |
d741493 to
45409bd
Compare
6bf57c8 to
753428e
Compare
2ed02a6 to
ab2a1e4
Compare
d9c02f6 to
97c8326
Compare
Restack the native error-handling migration above the replaceable-driver and multi-program job APIs. Keep DDSIM worker isolation in the parent change and adapt its compiler, result reconstruction, and diagnostics to FailureOr. Preserve stable-ID configuration, standard driver loading, indexed outcomes, worker cancellation, and Python exception translation. Migrate the newly merged benchmark APIs and their callers without letting callback exceptions cross exception-free native frames. Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Signed-off-by: Lukas Burgholzer <burgholzer@me.com> Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Keep diagnostic handlers in one shared runtime across DLL boundaries. Stage runtime dependencies and retain build-tree lookup for native tools, tests, and the DDSIM worker. Reject untracked DD roots before Python measurements can reach native reference-count assertions. Cover released and foreign roots in both collapsing measurement paths. Fix the 23 C++ lint findings reported after the stack merge. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Document how binding helpers translate diagnostics and adapt result APIs. Use failed(...) consistently in mqt-cc as requested during review. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 ELF RUNPATH entries do not cover transitive dependencies. Give each Core library its build RPATH so QDMI devices find the shared diagnostic runtime before installation. CMake retains the configured install RPATH. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Keep the parsed measurement strength const and place the test-only template helper in an anonymous namespace. These address all findings from the last hosted C++ lint report, including repeated template instantiations. Validation: repository lint and all 15 BenchmarkJSON tests pass. Local C++ lint remains unavailable because clang-tidy 23 is not installed. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Restore static diagnostic support and keep provider internals private. Direct C++ driver calls can copy the first failure into an optional Diagnostic output, so DLL boundaries no longer rely on a shared handler stack. QDMI C interfaces retain status codes and local logging without additional extensions. Keep FailureOr and LogicalResult: consuming LLVM Error across isolated static LLVM copies aborts in a two-library reproducer. Caller-owned diagnostic output preserves the existing types without another result framework. Validation: 3,975 native tests passed with one expected skip; 934 affected Python tests passed, followed by all 432 QDMI cases after the provider export changes. All 61 focused diagnostic, registry, and configuration checks pass. Repository lint and the installed C++ consumer pass. Local C++ lint requires unavailable clang-tidy 23; hosted validation remains pending. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Use designated fields when constructing a Diagnostic to satisfy the C++ lint check. Document the new error outputs on registration methods so Doxygen's parameter checks can build the native API reference. Validation: all four diagnostic tests, the complete Doxygen reference with warnings treated as errors, and repository lint pass. Local C++ lint remains blocked by the unavailable clang-tidy 23 executable. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Satisfy clang-tidy's readability-trailing-comma check for the designated Diagnostic initializer. The previous CI run passed all platform tests, coverage, documentation, and Python checks; this was its only lint finding. Repository lint passes. Local C++ lint remains blocked by unavailable clang-tidy 23; hosted verification will run on the updated commit. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Reject nonzero vector edges that skip qubit levels before constructing DD nodes. Malformed serialized input must fail at deserialization instead of reaching a measurement assertion and aborting Python. Matrix DDs retain their valid skipped identity levels. Cover premature terminals and skipped intermediate levels in both text and binary input, and verify Python raises ValueError for the malformed vectors. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Name the edge fields in the malformed-vector regression test to satisfy modernize-use-designated-initializers without changing test behavior. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Adapt the new sampling paths, Jeff bindings, and driver test target to explicit results. Preserve main's macOS wheel RPATH policy and concrete DD exports, and remove the obsolete public driver documentation. Record the independent audit findings without applying its proposed follow-up changes. Validate native and Python tests, generated stubs, installed consumers, whole-file C++ lint, repository lint, and docs. Assisted-by: GPT-6 via Codex
🤖 AI text below 🤖
Description
Represent recoverable native failures with MLIR/LLVM
LogicalResultandFailureOr<T>instead of exceptions crossing compiler/runtime boundaries. Scoped thread-local diagnostics retain messages, severity, error categories, and original QDMI status codes. Common boundary adapters preserve Python exception categories and C status codes.MQT::CoreSupportfollows the normal static/shared build setting. Default static builds embed private diagnostic support in the driver and devices, without a support DLL dependency. QDMI C interfaces carry status codes and keep messages in local logging; no C extensions are added. Direct C++ driver calls can copy the first error into an optional caller-ownedDiagnosticoutput. Explicitly shared Core builds retain their configured shared dependencies.Stack:
main → #2229 → #2373 → #2545. Native multi-program submission, concurrent reusable DDSIM workers, cancellation, compact DD results, and installed worker staging are provided by #2373. This PR adapts their fallible native operations and carries diagnostics over the worker transport. Worker failure affects its assigned program; completed siblings remain readable and execution is never replayed automatically.LLVM/MLIR 23.1+ is required for source builds and C++ consumers. All builds include the compiler; bundled QDMI devices remain independently selectable and opt-in for embedded consumers. Remove compiler-disabled presets/CI and reuse LLVM's SHA-256 and unreachable facilities.
Infallible operations return ordinary values or
void, including benchmark metadata, owned DD operations, measurement probabilities/deterministic collapse, and QIR state transfer/growth. Native reference decrements require balanced ownership; measurement requires a qubit present in the state. Python retains boundary checks. Benchmark evaluation shares probability calculations and typed gate paths avoid repeated arity checks.Private JSON translation units parse valid input once and contain dependency exceptions locally. Duplicate-key, schema, range, UTF-8, and source-diagnostic validation remain. GCC and Clang compile native algorithms without exception handling; MSVC retains its normal STL configuration. QIR allocation failures use explicit error-output pointers and release partial allocations; unhandled runtime failures stop execution within the existing worker boundary.
For C++ callers, use factories for fallible construction and check
failed(result)before dereferencing.ScopedDiagnosticHandlercaptures diagnostics within its library; use the optionalDiagnostic*output on driver entry points to obtain failure details across a C++ library boundary. Direct C++ consumers require a compatible C++ ABI. Successful absence remainsstd::optional<T>; borrowed results use pointers. Python signatures and QDMI status codes remain stable. Current-main Shor/W-state APIs, DD scaling/precision, structured compilation, and the replaceable-driver ownership/discovery contracts are retained.Validation
llvm::Erroracross isolated static LLVM copies aborts because their error type identities differ. The implementation retainsFailureOr/LogicalResultand copies diagnostic data at the C++ boundary instead.def3512acacross the configured platforms. Its C++ lint initializer finding and two missing Doxygen parameter descriptions are fixed in the follow-up. All four diagnostic tests, the complete Doxygen reference (warnings treated as errors), and repository lint pass locally. Hosted validation of the follow-up is pending; local C++ lint remains blocked by the unavailable clang-tidy 23 executable.AI assistance: Codex performed the migration, restack, simplification review, and validation. Human review remains required.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).