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

fix: change floordiv to divmod for //tests/core/lowering:test_remove_unnecessary_casts #3223

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

zewenli98
Copy link
Collaborator

Description

An error was reported on NVBug:

[  FAILED  ] 2 tests, listed below:
[  FAILED  ] LoweringPasses.RemoveSingleUse0DTensorsFloorDivIntCorrectly
[  FAILED  ] LoweringPasses.RemoveSingleUse0DTensorsFloorDivFloatCorrectly

With log:
unknown file: Failure
C++ exception with description "
Schema not found for node. File a bug report.
Node: %7 : int = aten::floor_divide(%6, %0)

Input types:int, int
candidates were:
  aten::floor_divide(Tensor self, Tensor other) -> Tensor
  aten::floor_divide.Scalar(Tensor self, Scalar other) -> Tensor
  aten::floor_divide.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
  aten::floor_divide.Scalar_out(Tensor self, Scalar other, *, Tensor(a!) out) -> Tensor(a!)
within the graph:
graph(%0 : int):
  %6 : int = prim::Constant[value=7]()
  %7 : int = aten::floor_divide(%6, %0)
  %4 : int = aten::Int(%7)
  return (%4)

:
" thrown in the test body.

The error is because Pytorch changed the schema of aten::floor_divide. Previously it supported two ints/floats as inputs, but the new schema requires the first input to be Tensor, while the lowering pass RemoveSingleUse0DTensors lowers two inputs to int/float.

Type of change

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

Checklist:

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

@zewenli98 zewenli98 requested a review from narendasan October 8, 2024 23:00
@zewenli98 zewenli98 self-assigned this Oct 8, 2024
@github-actions github-actions bot added the component: tests Issues re: Tests label Oct 8, 2024
@narendasan
Copy link
Collaborator

Do these C++ tests pass? Doesnt divmod return two outputs?

@github-actions github-actions bot added component: lowering Issues re: The lowering / preprocessing passes component: core Issues re: The core compiler and removed component: tests Issues re: Tests labels Oct 14, 2024
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

@zewenli98 zewenli98 merged commit 0bf1231 into main Oct 17, 2024
67 checks passed
@zewenli98 zewenli98 deleted the fix_nvbugs branch October 17, 2024 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed component: core Issues re: The core compiler component: lowering Issues re: The lowering / preprocessing passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants