Skip to content

♻️ Use LLVM streams for DD input and output - #2840

Merged
burgholzer merged 2 commits into
mainfrom
codex/dd-llvm-io
Oct 25, 2026
Merged

burgholzer merged 2 commits into
mainfrom
codex/dd-llvm-io

Conversation

@burgholzer

@burgholzer burgholzer commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Replace DD iostreams with LLVM output streams and borrowed byte input. Python serialization and worker state transport no longer copy payloads into input stringstreams. File input uses LLVM buffers, and Graphviz launching uses LLVM's process API instead of platform-specific code.

Preserve the existing throwing parsing/file APIs and exception/RTTI build policy. Borrowed output streams remain the caller's responsibility; file overloads check writes and close their descriptors, including during unwinding. Binary data keeps its native representation. Text serialization preserves the existing grammar and uses locale-independent decimal conversion, including finite subnormal values.

C++ callers must replace std::ostream sinks with llvm::raw_ostream and pass byte ranges to Package::deserialize; filenames use Package::deserializeFile. Python signatures remain unchanged. Installed MQT::CoreDD propagates its LLVM include and link requirements.

This is the DD I/O extraction from #2545, based on main after #2839 merged. The broader owned-error APIs and exception/RTTI changes remain in #2545.

Validation

Rebased on main dedaa13f5f, retaining its exportToDot rename throughout the LLVM export implementation, bindings, and tests. The range-diff contains only the corresponding rename and formatting adaptations.

  • Clang 23, LLVM/MLIR 23.1, ThinLTO and mold: 4,102 native tests passed; installed Python DD tests passed 64/64.
  • Six saved binary payloads reserialize byte for byte, including embedded and trailing NULs; binary/text decoding matches independently specified numerical inputs. Binary layout remains architecture-dependent.
  • Targeted mutations fail for broadened text grammar, subnormal rejection, partial trailing binary records and locale-sensitive decimal parsing.
  • An independent allocation-failure probe passes 256 file-output cases. Removing unwind cleanup reproduces descriptor leaks and a fatal buffered write error.
  • Installed CMake consumer, stub generation, repository lint and whole-file C++ lint passed. Independent Ponytail review findings are incorporated.
  • Complete executable Sphinx/Doxygen documentation and generated-link checks pass locally; the precision parameter is documented and the rendered API entry was inspected in Chrome.

Local validation is on Linux. Windows/macOS execution and hosted CI are unverified; no performance claim is made.

AI assistance: Codex implemented, independently reviewed and locally validated this extraction. Human review remains required.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

@burgholzer burgholzer self-assigned this Oct 25, 2026
@burgholzer burgholzer added c++ Anything related to C++ code DD Anything related to the DD package refactor Anything related to code refactoring labels Oct 25, 2026
Base automatically changed from codex/qdmi-llvm-config-io to main October 25, 2026 12:56
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.93939% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
include/mqt-core/dd/Export.hpp 81.1% 10 Missing ⚠️
src/dd/ComplexValue.cpp 93.1% 2 Missing ⚠️
src/dd/Export.cpp 97.7% 2 Missing ⚠️
src/dd/RealNumberUniqueTable.cpp 83.3% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@burgholzer burgholzer added this to the v4.2.0 - SC26 milestone Oct 25, 2026
@burgholzer burgholzer mentioned this pull request Oct 25, 2026
10 tasks done

@burgholzer burgholzer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denialhaag @simon1hofmann FYI: also extracted from #2545. I love to see all the standard library iostream stuff gone and replaced by cleaner and faster stream APIs from LLVM. There may be even more places where we could make such a change.
C++'s iostreams are notorious for causing a substantial amount of build time and general slowness.

@burgholzer
burgholzer enabled stacked auto-merge (squash) October 25, 2026 13:16
@burgholzer
burgholzer disabled stacked auto-merge October 25, 2026 14:26
@burgholzer
burgholzer added this pull request to stack #2847 October 25, 2026 14:26
@mergify mergify Bot added the conflict label Oct 25, 2026
burgholzer and others added 2 commits October 25, 2026 15:47
Replace DD iostreams with LLVM output streams and borrowed byte input.
Use LLVM file and process facilities for serialization and Graphviz,
and update Python and worker consumers without intermediate stream copies.

Preserve direct throwing I/O contracts and existing exception/RTTI policy.
Keep the native binary representation and text grammar, including finite
subnormal weights, and clean up output descriptors during unwinding.

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
Describe the new precision argument on printFormatted so Doxygen's
parameter check passes. Use the same documented defaults on toString.

Reproduce the RTD warning locally and validate the complete executable
Sphinx/Doxygen documentation, generated links and rendered API entry.

Signed-off-by: Lukas Burgholzer <burgholzer@me.com>
Assisted-by: GPT-6 via Codex
@mergify mergify Bot removed the conflict label Oct 25, 2026
@burgholzer
burgholzer enabled stacked auto-merge (squash) October 25, 2026 16:00
@burgholzer
burgholzer merged commit b971fbb into main Oct 25, 2026
30 checks passed
@burgholzer
burgholzer deleted the codex/dd-llvm-io branch October 25, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code DD Anything related to the DD package refactor Anything related to code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant