Standalone PIR parser — decouple from libpaddle.so - #1651
Open
PlumBlossomMaid wants to merge 12 commits into
Open
Standalone PIR parser — decouple from libpaddle.so#1651PlumBlossomMaid wants to merge 12 commits into
PlumBlossomMaid wants to merge 12 commits into
Conversation
- New standalone PIR IR types (paddle2onnx/pir/): - pir_program.h/cc: JSON-backed Operation, Value, Attribute, Type, Program - No dependency on libpaddle.so or any Paddle framework headers - DialectIdMap with version-aware op name decompression - Full value graph resolution (defining_op back-references) - Modified pir_parser.h/cc to use standalone PIR types: - Removed #include "paddle/" dependencies - Replaced pi::ReadModule() with JSON parser - Replaced OpNameNormalizer/OpYamlInfoParser with simplified lookups - Replaced phi::DataType with local pir::DataType - Simplified GetOpAttr with Attribute::isa/dyn_cast - CMakeLists.txt: removed libpaddle.so link, added nlohmann/json - YAML files: extracted ops.yaml + op_compat.yaml for v2.6, v3.0-v3.4 - Ready for version-aware op info lookup - Pre-generated C++ mappings can replace runtime YAML parsing - third_party/nlohmann/json.hpp: header-only JSON parser Tested via Python simulation - all PIR JSON parsing, value graph resolution, attribute extraction verified.
- Remove #include "paddle/" from exporter.cc, builtin_combine.cc, while.cc - Replace PADDLE_ENFORCE with std::runtime_error in set_value.h - Replace op->dyn_cast<paddle::dialect::WhileOp>() with name-based access - Replace op->dyn_cast<paddle::dialect::IfOp>() with name-based access - Replace pir::SplitOp / pir::CombineOp with name checks + num_operands() - All 6 mapper files now free of paddle framework symbols - Add GetWhileInputValuesAndArgsMappings for standalone PIR types - Remove protobuf from git tracking (build artifact) Paddle2ONNX now has ZERO direct dependency on libpaddle.so for PIR parsing.
…teration, impl() removal
…_auto_scan_linear)
- Type::Parse: guard j["#"] and j["TT"] with is_string() before get<std::string>() - ParseOp: guard op_j["#"] and op_j["op_type"] with is_string() - Also apply clang-format to all touched files
- Remove paddlepaddle from pyproject.toml build-system requires - Add conditional BUILD_PADDLE2ONNX_PYTHON in setup.py (ON if paddle importable) - Fix manylinux entrypoint: use system protobuf (yum/dnf), remove paddle PIP_EXTRA_INDEX_URL - Remove auditwheel --exclude libpaddle.so (no longer needed) - Update manylinux Python version from 3.8 (unsupported) to 3.10
…/PADDLE_LIB refs - CMakeLists.txt: remove pir_patch target, PADDLE_INCLUDE_DIR include path, PADDLE_LIB/COMMON_LIB link deps from cpp2py_export - setup.py: revert to unconditional BUILD_PADDLE2ONNX_PYTHON=ON (no paddle needed at build time) - pyproject.toml: no paddle build dependency (already done) - entrypoint.sh: no paddle install, system protobuf, rm auditwheel exclude - build_and_test.yml: Python 3.8 → 3.10 for manylinux_2_28 compat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Decouple PaddlePaddle PIR model parser from libpaddle.so. PIR JSON format is entirely self-describing, so there is no need to link against the full framework.
Changes
New:
paddle2onnx/pir/pir_program.h/cc) — Operation/Value/Attribute/Type/Program, zero paddle dependencypir_op_info.h/cc+ auto-generatedpir_op_info_generated.h) — 529 ops with full input/output name-to-index mappinggen_op_info.pyto regenerate from versioned YAML dataModified:
paddle2onnx/parser/pir_parser.h/cc#include "paddle/"with standalone typesnlohmann/jsonfor model deserialization instead ofpir::ReadModuleOpYamlInfoParser+OpNameNormalizerfrom generated YAML tablesModified: 6 mapper files
exporter.cc,while.cc,builtin_combine.cc,builtin_split.cc,set_value.h#include "paddle/"andPADDLE_ENFORCEmacrosBuild
CMakeLists.txt: removedlibpaddle.solink, addednlohmann/jsonthird_party[100%] Built target paddle2onnx