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

Convert aten.bitwise_not to ttnn.bitwise_not #236

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jdh8
Copy link
Collaborator

@jdh8 jdh8 commented Sep 19, 2024

Ticket

Depends on tenstorrent/tt-metal#12902

Problem description

ttnn.bitwise_not takes an extraneous value: int. I'm fixing this in the kernel.

E       TypeError: __call__(): incompatible function arguments. The following argument types are supported:
E           1. (self: ttnn._ttnn.operations.unary.bitwise_not_t, input_tensor: ttnn._ttnn.tensor.Tensor, value: int, *, memory_config: Optional[ttnn._ttnn.tensor.MemoryConfig] = None, output_tensor: Optional[ttnn._ttnn.tensor.Tensor] = None, queue_id: int = 0) -> ttnn._ttnn.tensor.Tensor
E       
E       Invoked with: <ttnn._ttnn.operations.unary.bitwise_not_t object at 0x7f58fc4d5530>, ttnn.Tensor([[-81.00000, 66.00000,  ...,  0.00000,  0.00000],
E                    [58.00000, -75.00000,  ...,  0.00000,  0.00000],
E                    ...,
E                    [ 0.00000,  0.00000,  ...,  0.00000,  0.00000],
E                    [ 0.00000,  0.00000,  ...,  0.00000,  0.00000]], shape=Shape([4[32], 4[32]]), dtype=DataType::BFLOAT16, layout=Layout::TILE)

../tt-metal/ttnn/ttnn/decorators.py:326: TypeError

What's changed

)
def test_bitwise_not(device, input_shape):
m = BitwiseNotModule()
input = torch.randint(-256, 256, input_shape, dtype=torch.int32)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here is a problem. I make this tensor in torch.int32, but the test complains that it gets a BFLOAT16 tensor.

E       RuntimeError: TT_FATAL @ /home/jdh8/tt-metal/ttnn/cpp/ttnn/operations/eltwise/unary/device/unary_device_operation.cpp:42: input_datatype == DataType::INT32
E       info:
E       Unsupported input data type '0' for UnaryOpType '63' (Bitwise operation).
E       backtrace:
E        --- /home/jdh8/tt-metal/ttnn/ttnn/_ttnn.so(+0x4933a9) [0x7f0db03ee3a9]
E        --- ttnn::operations::unary::UnaryDeviceOperation::validate_on_program_cache_miss(ttnn::operations::unary::operation_attributes_t const&, ttnn::operations::unary::tensor_args_t const&)

Previous error message also confirms this.

tenstorrent/tt-metal#12902 does not fix this error.

Copy link
Member

Choose a reason for hiding this comment

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

@kevinwuTT ptal

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This error still persists after merging tenstorrent/tt-metal#13579.

@jdh8 jdh8 marked this pull request as ready for review September 19, 2024 20:14
`ttnn.bitwise_not` takes an extraneous `value: int`.  I'm fixing this in the kernel.
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.

2 participants