Repository navigation
[3/12] Lower DLA indexing and fixed matrix operators - #3183
mgohil-png wants to merge 1 commit into
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@coderabbitai full review |
Action performed
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dla/onnxscript-02-layout-context #3183 +/- ##
===================================================================
Coverage ? 82.17%
===================================================================
Files ? 738
Lines ? 82483
Branches ? 0
===================================================================
Hits ? 67781
Misses ? 14702
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
7e590de to
67c172f
Compare
|
67c172f to
fd7524f
Compare
Signed-off-by: mgohil <[email protected]>
fd7524f to
e8ee717
Compare
| if indices not in self.views: | ||
| array = constant_array(indices) | ||
| self.views[indices] = ( | ||
| self.graph.add_initializer(op, array.astype(np.int32), "index_int32") |
There was a problem hiding this comment.
An out-of-bounds INT64 index can wrap back into range here. With data [10, 20], index 4294967296 wraps to 0 and returns 10. This affects both Gather and GatherElements, for constant and runtime indices. Can we preserve the bounds error when narrowing to INT32? Code
| return False | ||
| if dq is not None: | ||
| scale_shape = static_shape(dq.inputs[1]) | ||
| if dq.attributes.get_int("block_size", 0) or scale_shape is None or len(scale_shape) > 1: |
There was a problem hiding this comment.
A scalar scale or zero point can be a graph input. That passes the shape check and leaves the generated Conv kernel dependent on a runtime value. Could we require a constant scale and, when present, a constant zero point before lowering this MatMul? Code
| return False | ||
| channels = raw.shape[-2] if node.attributes.get_int("transB", 0) else raw.shape[-1] | ||
| if len(node.inputs) > 2 and node.inputs[2] is not None: | ||
| if static_shape(node.inputs[2]) != (channels,): |
There was a problem hiding this comment.
A runtime bias of shape [2] passes this check for a two-output Gemm. The rewrite then feeds that graph input directly to Conv as its bias. Could we check that the bias is constant before applying this fixed-bias rewrite? Code
What does this PR do?
Type of change: new feature
Adds private INT32 index views and fixed MatMul/Gemm lowering to pointwise Conv with the necessary layout adapters. Shared operands retain their original owners, including per-axis quantized weight chains. The read-only weight eligibility predicate is also used by preprocessing in PR 4.
Usage
Internal rules in operators/rules.py; the fixed pipeline registers them before layout. No public API or transform-selection option is added in this slice.
Testing
CI readiness check (2026-11-05): latest unit tests, code quality, and documentation workflows passed for this head. Aggregate checks still include cancelled duplicate runs. Codecov project status is still pending.
Focus: Fixed/runtime index views, shared indices, matrix ranks/orientations, quantized weight axes and non-mutating eligibility refusals.
Slice validation: 38 tests passed on this slice using
python -m pytest tests/unit/onnx/graph_surgery/dla_transforms tests/unit/onnx/graph_surgery/test_graph_utils.py -o addopts= -q -p no:cacheprovider --strict-markers.Repository checks: Ruff, formatting, license, security, whitespace and applicable repository hooks passed. Mypy reports the preexisting Windows
os.sched_getaffinityerror; it was excluded from commit hooks after confirming the same unrelated error.Added source lines against this PR's base: 328 added Python source lines; tests and documentation excluded.
Before your PR is "Ready for review"
Follow the Contributor guidelines and Security Coding Practices. Commits are signed and signed off.
CONTRIBUTING.md?: N/A - uses existing dependencies; no external source copied.Additional Information
Base: #3182. Merge after that PR; this slice builds on the preceding stack changes.
Merge order is 1 through 12. Review against the immediate base so earlier slices are excluded from this diff. Series: 1/12, 2/12, 3/12, 4/12, 5/12, 6/12, 7/12, 8/12, 9/12, 10/12, 11/12, 12/12
Runtime or unsupported matrix weights remain native rather than being treated as fixed constants.
Summary by CodeRabbit