Skip to content

fix: Repair invalid schema arising from lowering pass #1786

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

gs-olive
Copy link
Collaborator

Description

  • When remove_unnecessary_casts replaces both tensors in an aten::div call with the corresponding scalars, and the rounding mode (third argument) is specified, the schema becomes invalid
  • To avoid this, we intercept the call and split the result based on what the third argument in the input was, either delegating the result to aten::Int(aten::div(...)), for "trunc" or aten::floordiv(...) for "floor"
  • Update lowering pass to incorporate the above change, with appropriate documentation
  • Add testing to verify catching and correctly handling these edge cases

Fixes #1780

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [ x ] My code follows the style guidelines of this project (You can use the linters)
  • [ x ] I have performed a self-review of my own code
  • [ x ] I have commented my code, particularly in hard-to-understand areas and hacks
  • [ x ] I have made corresponding changes to the documentation
  • [ x ] I have added tests to verify my fix or my feature
  • [ x ] New and existing unit tests pass locally with my changes
  • [ x ] I have added the relevant labels to my PR in so that relevant reviewers are notified

- When `remove_unnecessary_casts` replaces both tensors in an
`aten::div` call with the corresponding scalars, and the rounding mode
(third argument) is specified, the schema becomes invalid
- To avoid this, we intercept the call and split the result based on
what the third argument in the input was, either delegating the result
to `aten::Int(aten::div(...))`, for "trunc" or `aten::floordiv(...)` for
"floor"
- Update lowering pass to incorporate the above change, with appropriate
documentation
- Add testing to verify catching and correctly handling these edge cases
@gs-olive gs-olive self-assigned this Mar 30, 2023
@github-actions github-actions bot added component: core Issues re: The core compiler component: lowering Issues re: The lowering / preprocessing passes component: tests Issues re: Tests labels Mar 30, 2023
@github-actions github-actions bot requested a review from narendasan March 30, 2023 16:47
Copy link
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

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

LGTM

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
cla signed component: core Issues re: The core compiler component: lowering Issues re: The lowering / preprocessing passes component: tests Issues re: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [Bug] Schema issue encountered when compiling Waveglow model
3 participants