Skip to content

Support dynamic input values for range op#4591

Open
klin2024 wants to merge 6 commits intodevelopfrom
range_op_support_dynamic_shape
Open

Support dynamic input values for range op#4591
klin2024 wants to merge 6 commits intodevelopfrom
range_op_support_dynamic_shape

Conversation

@klin2024
Copy link

@klin2024 klin2024 commented Feb 4, 2026

Motivation

Enable dynamic value support for the Range operator, as MIGraphX currently fails when running SSDMobileNetV2_int8 due to a limitation in this node.

auto start_arg = args[0]->eval();
check_arg_empty(start_arg, "PARSE_RANGE: start arg dynamic shape is not supported");
auto limit_arg = args[1]->eval();
check_arg_empty(limit_arg, "PARSE_RANGE: limit arg dynamic shape is not supported");
auto delta_arg = args[2]->eval();
check_arg_empty(delta_arg, "PARSE_RANGE: delta arg dynamic shape is not supported");

Technical Details

Follow https://onnx.ai/onnx/operators/onnx__Range.html spec Implemented Range parsing and logic in range.hpp,parse_range.cpp.
Use hip_copy_to_gpu_alloc in lowering.cpp because allocates memory based on the runtime-determined should better than pre-allocating the maximum possible size.

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/include/migraphx/op/dynamic_range.hpp 95.65% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4591      +/-   ##
===========================================
+ Coverage    92.21%   92.22%   +0.01%     
===========================================
  Files          567      568       +1     
  Lines        27897    27932      +35     
===========================================
+ Hits         25724    25760      +36     
+ Misses        2173     2172       -1     
Files with missing lines Coverage Δ
src/onnx/parse_range.cpp 95.83% <100.00%> (-0.17%) ⬇️
src/include/migraphx/op/dynamic_range.hpp 95.65% <95.65%> (ø)

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@klin2024 klin2024 marked this pull request as ready for review February 12, 2026 06:39
@klin2024 klin2024 requested a review from causten as a code owner February 12, 2026 06:39
@klin2024 klin2024 force-pushed the range_op_support_dynamic_shape branch from bd45b8c to 5a98fd8 Compare February 12, 2026 09:35
@klin2024 klin2024 changed the title range op support dynamic shape Support dynamic input values for range op Feb 12, 2026
}
argument compute(context& ctx, const shape&, const std::vector<argument>& args) const
{
argument result = allocate_gpu(args.front().get_shape());
Copy link
Collaborator

@pfultz2 pfultz2 Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not hide an allocation in another operator as memory coloring cant handle this allocation, which will make this extremely slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants