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

Lower aten.linalg_vector_norm to ttnn.moreh_norm #686

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jdh8
Copy link
Contributor

@jdh8 jdh8 commented Dec 27, 2024

Ticket

Problem description

Compile aten.linalg_vector_norm to ttnn.moreh_norm, the PyTorch FX wrapper for ttnn.operations.moreh.norm.

I consistently observe PCC errors for reduction along non-last dimension. I am reporting this as a kernel issue:

FAILED tests/lowering/reduction/test_vector_norm.py::test_vector_norm[input_shape1-2-2] - AssertionError: 0.9976093101814988
FAILED tests/lowering/reduction/test_vector_norm.py::test_vector_norm[input_shape2-2-1] - AssertionError: 0.8991108908766973

What's changed

  • Data movement
  • Conversion algorithm
  • Unit testing
    • Pass graph correctness tests
    • Pass PCC/accuracy tests

I consistently observe PCC errors for reduction along non-last dimension
```
FAILED tests/lowering/reduction/test_vector_norm.py::test_vector_norm[input_shape1-2-2] - AssertionError: 0.9976093101814988
FAILED tests/lowering/reduction/test_vector_norm.py::test_vector_norm[input_shape2-2-1] - AssertionError: 0.8991108908766973
```
@jdh8 jdh8 self-assigned this Dec 27, 2024
try:
ndims = len(x.meta["val"].size())
dim = [d if d >= 0 else d + ndims for d in dim]
except:
Copy link
Member

Choose a reason for hiding this comment

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

what exception does this cause?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the shape of x is not known at compile time, x.meta["val"].size() fails.

Copy link
Member

Choose a reason for hiding this comment

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

maybe then better to handle inside the target wrapper where values are already known?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I change it to more graceful get_shape

@ayerofieiev-tt
Copy link
Member

ayerofieiev-tt commented Dec 27, 2024

I am reporting this as a kernel issue.

Is there a ticket?

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

Successfully merging this pull request may close these issues.

aten.linalg_vector_norm.default
2 participants