Repository navigation
onnx: say when a session fails for a missing integer-op kernel in the pinned ORT, and which exports are next to it - #1437
Conversation
… pinned ORT, and which exports are next to it (#1436) A public int8 ONNX export (Hugging Face Optimum / Xenova model_int8.onnx) uses ONNX's own integer ops, not Q/DQ, and the pinned ONNX Runtime 1.23.2 has no CPU kernel for most of their type combinations. Measured with one-node graphs (activation x weight): ConvInteger u8 x u8 runs; u8 x i8, i8 x u8, i8 x i8 no kernel MatMulInteger u8 x u8, u8 x i8, i8 x i8 run; i8 x u8 no kernel DynamicQuantizeLinear always gives uint8 and these exports carry int8 weights (Xenova/yolov8n-pose: all 73 ConvInteger weights INT8), so the session cannot be created, and the board read that as "model fails". ort_run now adds, after "Could not find an implementation for <Op>(N)": that it is the runtime's kernel coverage (not the model or an EP), what the pin carries for ConvInteger / MatMulInteger, and the other .onnx files in the model's directory. docs/onnx.md gets the two-flavour and kernel tables. onnx/tests/ort_run_generic.sh rows 6: u8 x i8 ConvInteger refused with those lines; u8 x u8 runs and equals a numpy convolution. main: 3 FAIL (the explanation lines) branch: 17 ok, 0 failures; ctest -R ort_run_generic passed Real model: model_int8.onnx refused with the new lines, naming model.onnx; model.onnx runs, 65.98 ms. Fixes #1436 Co-authored-by: bong-water-water-bong <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
ready for review at f52c38b |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at f52c38bc6a8ed86bedd7288dd1f56c887a1194d9
This meets #1436's acceptance as written ("runs, or says in one line that the pinned runtime has no kernel for it and which export does run"), and the kernel table answers the issue's option 2 with measurements rather than a guess.
At this head (base 880c9ae, on main; my -DONEBIT_ORT=ON build against libonnxruntime 1.23.2, thermal-run.sh):
ort_run,ort_infoand theonebit_ep*targets build clean, with no warning inort_run.cpp;ctestinonnx/passes 7/7, includingort_run_genericwith its new row 6;tools/copyright.py --checkis rc 0.
The code:
explain_missing_kerneladds lines only after a failedCreateSession, and only when ORT's own "Could not find an implementation for " is in the message. TheFAIL create sessionline is unchanged.- The op name is cut at
(, soConvInteger(10)→ConvInteger. - The sibling scan is the model's own directory,
.onnxonly, with the failing file excluded and the list sorted.
One wording nit, not blocking: the sibling line ends "(a float or QDQ export uses no integer ops)". Placed right after the list, it reads as a statement about the listed files. In the Xenova layout this example comes from, a model directory typically also holds model_uint8.onnx and model_quantized.onnx (integer ops; the uint8 one would actually load) and model_q4.onnx or model_bnb4.onnx. Either soften it to "(try a float or QDQ one: those use no integer ops)", or, cheaply and more useful, list a sibling first if its name contains fp32, fp16, or no quant suffix at all.
I didn't refetch the yolov8n-pose files; the two runs and their hashes are yours.
…w nit on #1437) (#1436) The parenthetical read as a claim about the listed files; a Xenova directory also holds model_uint8.onnx / model_quantized.onnx, which use integer ops. Co-authored-by: bong-water-water-bong <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Took the wording nit: ort_run.cpp and in the docs/onnx.md example. A Xenova directory also holds model_uint8.onnx / model_quantized.onnx, so the old text read as a claim about the listed files. Re-run at this head: ort_run_generic.sh 0 failures (row 6's grep matches the list, not the parenthetical), real model_int8.onnx prints the new line, copyright exit 0. The three -Wunused-result warnings in ort_run.cpp that a default build shows are pre-existing (main's lines 649/688/701, shifted by +41), not this PR's.
ready for review at ac61ee8 |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at ac61ee808c7b33c65b93e16f9865ff4d57d718b4
ac61ee8 takes my nit exactly: the sibling line now reads "… (not checked; a float or QDQ one uses no integer ops)" in ort_run.cpp, and docs/onnx.md says the files are listed "without checking them". It's a one-string change, and the doc's sample output matches it.
At this head ort_run rebuilds clean in my -DONEBIT_ORT=ON tree, and ctest -R ort_run_generic passes 1/1 (the test matches on the refusal's other lines, so the parenthetical change can't break it). Everything else is as I reviewed it READY at f52c38bc.
|
What fails on
Why this isn't the PR's code:
To do: re-run the failed jobs ( |
|
Re-ran the failed |
|
Closing my duplicate rather than letting two fixes race — I opened #1442 for #1436 before noticing this one existed (yours is Two small things from mine that you may or may not want, offered rather than pushed:
If either is worth having, I am happy to send it as a small follow-up on top of #1437 after it merges — I'd rather that than a second PR against the same file now. One factual point worth keeping from mine, since our two messages disagree in wording: I reproduced the failure with a 139-byte synthetic graph (one |
|
Resolved the one open review thread (CodeQL "Suspicious add with sizeof" at |
Fixes #1436
The acceptance, met
ort-runon the issue's own file now prints:The files match the issue's byte counts: 3,755,740 B (sha256
1eb23649...) and 13,484,153 B (sha25604f6d241...). Both were fetched for measurement only; this PR does not include them.Option 2 answered: what the pin carries
The issue asked whether 1.23.2 has
ConvIntegerfor int8 at all, or only uint8. One-node graphs throughort-runagainst the pinnedlibonnxruntime.so.1.23.2(activation x weight):ConvIntegerMatMulIntegerThe export's 73
ConvIntegernodes all have INT8 weights, read from the initializers.DynamicQuantizeLinearalways outputs uint8, so u8 x i8 is the combination it needs, and the pin has no kernel for it. Building ORT with that kernel would change the pin (docs/onnx.md"The pin"), so I left it out.Change
onnx/ort_run.cpp(+41):CreateSessionwhose message is "Could not find an implementation for (N)", say that the runtime's kernel coverage is the cause;ConvInteger/MatMulInteger, give the measured kernel rows;.onnxfiles in the model's directory.FAIL create sessionline itself is unchanged.docs/onnx.md: a new "Integer-op exports" section with the two-flavour table, the kernel table, the YOLOv8-pose example and the refusal text.onnx/tests/ort_run_generic.sh, row 6:ConvIntegergraph is refused with the three lines, including the sibling list;Proof (strixhalo, CPU,
ONEBIT_ORT=ONbuild ofort_run, under thermal-run)Not in this PR
GPNPU-PARITY.md,ONNX-VISION-OOB.md) already record both exports separately, per the issue.ConvIntegeris a convolution, and the EP's seam isMatMul.🤖 Generated with Claude Code