Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

op function body not to allow default opset version #5908

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

liqunfu
Copy link
Contributor

@liqunfu liqunfu commented Feb 6, 2024

Description

OpSchema::FunctionBody, OpSchema::SetContextDependentFunctionBodyBuilder, and OpSchema::BuildContextDependentFunction used to have since_version as the default opset_version. This poses an issue for custom ops. Make opset version a required argument so that there is no ambiguity.

Motivation and Context

to enhance validity of function bodies. Need to validate with Ort before merge. It PR will be merged after 1.16.0 release.

Signed-off-by: Liqun Fu <liqfu@microsoft.com>
@liqunfu liqunfu requested review from a team as code owners February 6, 2024 06:19
@liqunfu liqunfu marked this pull request as draft February 6, 2024 06:24
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.81%. Comparing base (fd744fa) to head (229c200).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5908   +/-   ##
=======================================
  Coverage   56.81%   56.81%           
=======================================
  Files         506      506           
  Lines       30370    30370           
  Branches     4592     4592           
=======================================
  Hits        17256    17256           
  Misses      12285    12285           
  Partials      829      829           

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


bool BuildContextDependentFunction(
const FunctionBodyBuildContext& ctx,
FunctionProto& function_proto,
int requested_opset_version = OpSchema::kUninitializedSinceVersion) const;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering: is OpSchema::kUninitializedSinceVersion used anywhere else, or can it be removed?

@@ -699,21 +699,14 @@ void OpSchema::ParseAndSetTypes(
OpSchema& OpSchema::SetContextDependentFunctionBodyBuilder(
ContextDependentFunctionBodyBuilder functionBuilder,
int opset_version) {
if (opset_version == OpSchema::kUninitializedSinceVersion && since_version_ != OpSchema::kUninitializedSinceVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I wonder if we should have an assert to ensure that opset_verion is > 0 (that is, not equal to OpSchema::kUninitializedSinceVersion)? Just to catch it if user passes that value?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good question - we had a similar discussion in #5906 (comment) as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants