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

[Feature Request] Support bfp8_b 1d tensor in ttnn #15540

Closed
hschoi4448 opened this issue Nov 28, 2024 · 0 comments
Closed

[Feature Request] Support bfp8_b 1d tensor in ttnn #15540

hschoi4448 opened this issue Nov 28, 2024 · 0 comments
Assignees
Labels
feature-request External feature request moreh moreh contribution

Comments

@hschoi4448
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently, when trying to create a bfp8_b type 1D tensor using from_torch in ttnn, a runtime error occurs.
However, it seems that removing the 1D runtime error doesn't cause any issues.

Describe the solution you'd like
I will remove the code that raises the runtime error.

@hschoi4448 hschoi4448 added feature-request External feature request moreh moreh contribution labels Nov 28, 2024
@hschoi4448 hschoi4448 self-assigned this Nov 28, 2024
hschoi4448 added a commit that referenced this issue Nov 28, 2024
### Ticket
#15540

### Problem description
Currently, when trying to create a bfp8_b type 1D tensor using
from_torch in ttnn, a runtime error occurs.
However, it seems that removing the 1D runtime error doesn't cause any
issues.

### What's changed
 I will remove the code that raises the runtime error.


```Python
# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc.

# SPDX-License-Identifier: Apache-2.0

import pytest

import torch

import ttnn

torch.set_printoptions(threshold=1000000, linewidth=100000000, sci_mode=False)

@pytest.mark.parametrize("ttnn_dtype, torch_dtype", [
    [ttnn.DataType.BFLOAT16, torch.bfloat16],
    [ttnn.DataType.BFLOAT8_B, torch.bfloat16],
],)
def test_support_1d(device, ttnn_dtype, torch_dtype):
    torch_x = torch.rand(20, dtype=torch_dtype)

    ttnn_x_bf16 = ttnn.from_torch(torch_x, dtype=ttnn.DataType.BFLOAT16, layout=ttnn.TILE_LAYOUT)
    ttnn_x = ttnn.from_torch(torch_x, dtype=ttnn_dtype, layout=ttnn.TILE_LAYOUT)
    torch_y = ttnn.to_torch(ttnn_x).to(dtype=torch_dtype)

    print("ttnn_dtype", ttnn_dtype)
    print("torch_dtype", torch_dtype)
    print("torch_x\n", torch_x)
    print("ttnn_x_bf16\n", ttnn_x_bf16)
    print("ttnn_x\n", ttnn_x)
    print("torch_y\n", torch_y, type(torch_y))

```

I have confirmed that the 1D `bfp8_b` tensor is created without any
issues, but I couldn't find an appropriate location to add this test.

### Checklist
- [ ] Post commit CI passes
- [ ] Blackhole Post commit (if applicable)
- [ ] Model regression CI testing passes (if applicable)
- [ ] Device performance regression CI testing passes (if applicable)
- [ ] New/Existing tests provide coverage for changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request External feature request moreh moreh contribution
Projects
None yet
Development

No branches or pull requests

1 participant