feat(onnx-to-hip): stamp Slice params before constant externalization - #607
Open
amd-mounikk wants to merge 13 commits into
Open
feat(onnx-to-hip): stamp Slice params before constant externalization#607amd-mounikk wants to merge 13 commits into
amd-mounikk wants to merge 13 commits into
Conversation
Add end-to-end ReduceL2 lowering from onnx.ReduceL2 through hip.reduce_l2, HipToLLVM runtime dispatch, and a HIP kernel. Includes mock runtime support, LIT conversion/e2e tests, and numeric coverage in test_reduce.py.
Fix lintrunner/clang-format alignment in ReduceL2Conversion.cpp and wrap_reduce_l2 declaration in hipdnn_ep_runtime.h.
Port ReduceProd-style axes extraction and buildReduceL2Init so dynamic input dims lower correctly; add LIT and numeric coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Align mock wrap_reduce_l2 with the 11-arg ABI, harden the noop memcpy path, and clear stale HIP errors before hip_reduce_l2 kernel launch. Co-authored-by: Cursor <cursoragent@cursor.com>
Add SliceShapeFold pre-lowering pass to capture compile-time starts, ends, axes, and steps onto onnx.Slice as hipdnn.slice_* attributes before lowerOnnxConstants externalizes the operand constants. Update SliceDecompose to prefer these stamped attributes so slices decompose to tensor.extract_slice instead of falling through to the hip.slice runtime stub. Add LIT coverage for SwinV2 window and downsample stride slice patterns. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Thanks for opening a PR! This project follows LLVM's incremental-development and AI-tool-use Before requesting review, please check that:
Reviewers are assigned through |
Probe legacy onnx-hipdnn-ep asset paths on the self-hosted GPU runner when runner.workspace/model is missing after the hip-ep rename. Also make perf-result publishing non-fatal for fork PRs that cannot post comments with GITHUB_TOKEN. Co-authored-by: Cursor <cursoragent@cursor.com>
amd-mounikk
marked this pull request as ready for review
July 31, 2026 05:34
amd-mounikk
requested review from
amd-mingw,
edelaye,
fhanuman,
qianglin-amd and
wcy123
as code owners
July 31, 2026 05:34
Mirror the perf publish step: fork PRs cannot post comments with GITHUB_TOKEN, so write results to the step summary and exit cleanly. Co-authored-by: Cursor <cursoragent@cursor.com>
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
SliceShapeFoldpre-lowering pass to stamp compile-timeonnx.Slicestarts/ends/axes/steps onto the op ashipdnn.slice_*attributes beforelowerOnnxConstantsexternalizes operand constants.SliceDecomposeto prefer stamped attributes so slices rewrite totensor.extract_sliceinstead of falling through to thehip.sliceruntime stub.Motivation
Production builds externalize even small 1-element i64 Slice param constants into
memref.globalentries. Without stamping params before externalization,SliceDecomposecannot read compile-time values and every slice falls through to the stub runtime op. This blocks models like SwinV2 that rely on window/partition slices.Test plan
pre-commit run --all-filesctest --test-dir ../build/hip-ep_20260724 -C Release -R MorphizenMLIRLitTests --verbosetensor.extract_slice(nohip.slicestub)