Skip to content

Conversation

@justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Oct 9, 2025

This PR implements #2580 by combining all overloads in torchlib and remove the ability to register new ones. It is done in a BC compatible fashion and should work with released versions of PyTorch.

From now on all logic for a single aten OpOverload should be implemented by a single torchlib function to ensure 1-to-1 mapping.

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@justinchuby justinchuby added the module: torchlib Related to the torch/aten function lib in development label Oct 9, 2025
@justinchuby justinchuby added this to the 0.5.4 milestone Oct 9, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR consolidates overloaded functions in the torch_lib by removing the concept of private functions and preventing new overloads from being created for the same operation name. The changes focus on simplifying the registration system and merging boolean indexing operations with their regular counterparts.

  • Removes the private parameter and functionality from the registration system
  • Consolidates boolean and regular index operations into unified functions
  • Adds validation to prevent duplicate overload registrations

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
onnxscript/function_libs/torch_lib/registration.py Removes private function support and adds overload duplication prevention
onnxscript/function_libs/torch_lib/ops/core.py Consolidates index and index_put functions to handle both boolean and integer indexing
tests/function_libs/torch_lib/ops_test_data.py Removes separate boolean index test entries and duplicates
onnxscript/function_libs/torch_lib/ops/nn.py Removes outdated comment about private functions
onnxscript/function_libs/tools/torch_lib/deduce_type_constraints_test.py Updates to exclude removed private functions from iteration

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@justinchuby justinchuby changed the title Consolidate all overloads and prevent new ones from being created [torchlib] Consolidate all overloads and prevent new ones from being created Oct 9, 2025
Copy link
Contributor

@titaiwangms titaiwangms left a comment

Choose a reason for hiding this comment

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

CI is failing

@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 86.20690% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.38%. Comparing base (32a61f4) to head (eb9ea10).

Files with missing lines Patch % Lines
onnxscript/function_libs/torch_lib/registration.py 66.66% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2621      +/-   ##
==========================================
- Coverage   70.39%   70.38%   -0.01%     
==========================================
  Files         222      222              
  Lines       26275    26287      +12     
  Branches     2629     2637       +8     
==========================================
+ Hits        18496    18503       +7     
- Misses       6859     6862       +3     
- Partials      920      922       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@justinchuby justinchuby added the do not merge Do not merge this PR label Oct 10, 2025
@justinchuby justinchuby modified the milestones: 0.5.4, 0.5.5 Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Do not merge this PR module: torchlib Related to the torch/aten function lib in development

Projects

Development

Successfully merging this pull request may close these issues.

2 participants