[BUG] The pass "adjust_slice_and_matmul" causes crash (malloc_error_break)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 834
- Forks
- 109
- Avg merge
- 6h 55m
- Merged PRs (30d)
- 2
Description
[BUG] The pass "adjust_slice_and_matmul" causes crash (malloc_error_break)
Issue
Running the single pass adjust_slice_and_matmul with onnxoptimizer 0.4.2 may cause crash. Details are provided to reproduce the issue with oracle inputs.
Environment
- Ubuntu 20.04
- Python 3.10
- onnx==1.19.0
- onnxruntime==1.23.2
- onnxoptimizer==0.4.2 (latest)
Repro steps (run from this folder)
- Download and unzip the attached archive, then
cdinto the extracted directory
tar -xzvf adjust_slice_and_matmul_repro.tar.gz
cd adjust_slice_and_matmul_repro
- Create a Python environment (Python 3.10) and install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
- Optimize a case with only
adjust_slice_and_matmul(writesmodel.opt.onnxnext tomodel.onnx):
python optimize_model.py --case ./case_02937_seed43509122
- Differential test original vs optimized outputs using stored oracle inputs:
python diff_test.py --case ./case_02937_seed43509122
Observed results
Crash : case_02937_seed43509122 (malloc error during diff run; see notes below).
Expected
adjust_slice_and_matmul should be semantics-preserving and should not cause crash when optimizing models.
Differential Test Output Details
- case_02937_seed43509122: diff test aborted with malloc checksum error after, no comparison result produced.
Python(21317,0x1f992e0c0) malloc: Incorrect checksum for freed object 0x127037200: probably modified after being freed.
Corrupt value: 0x42b444884512460f
Python(21317,0x1f992e0c0) malloc: *** set a breakpoint in malloc_error_break to debug
Attachments
README.mdrequirements.txtoptimize_model.py(runs onlyadjust_slice_and_matmuland savesmodel.opt.onnx)diff_test.py(runs original and optimized with same oracle inputs)case_02937_seed43509122/(original model and oracle inputs)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading README.md and running optimize_model.py followed by diff_test.py for case_02937_seed43509122 using requirements.txt. Compare the original and optimized model behavior and investigate the crash around the adjust_slice_and_matmul pass. Done means the case completes without malloc corruption and the pass remains semantics-preserving.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- machine-learning, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100