tenstorrent / pytorch2.0_ttnn

⭐️ TTNN Compiler for PyTorch 2.0 ⭐️ It enables running PyTorch2.0 models on Tenstorrent hardware
https://tenstorrent.github.io/tt-metal/latest/ttnn/
16 stars 5 forks source link

Convert `aten.masked_fill.Scalar` to `ttnn.where` #164

Open jdh8 opened 1 week ago

jdh8 commented 1 week ago

Ticket

None but related to #147

Problem description

Convert aten.masked_fill.Scalar(self, mask, value) to ttnn.where(mask, self, value)

What's changed

Error messages

There is an issue while converting value: float to a singleton tensor in ttnn. I also tried converting the value tensor to tile layout, but it did not work either.

E       RuntimeError: TT_FATAL @ ../tt_metal/impl/buffers/buffer.cpp:31: size != 0 and page_size != 0
E       info:
E       Buffer size and page size should be larger than 0 bytes!
E       backtrace:
E        --- tt::tt_metal::validate_buffer_size_and_page_size(unsigned long, unsigned long, tt::tt_metal::BufferType const&, tt::tt_metal::TensorMemoryLayout const&, std::__1::optional<tt::tt_metal::ShardSpecBuffer> const&)
E        --- tt::tt_metal::Buffer::Buffer(tt::tt_metal::Device*, unsigned long, unsigned long, tt::tt_metal::BufferType, tt::tt_metal::TensorMemoryLayout, std::__1::optional<tt::tt_metal::ShardSpecBuffer> const&, std::__1::optional<bool>, bool)
E        --- /home/ubuntu/tt-metal/ttnn/ttnn/_ttnn.so(+0xe2ebbe) [0x7f2606cb7bbe]
E        --- tt::tt_metal::tensor_impl::allocate_buffer_on_device(unsigned int, tt::tt_metal::Device*, tt::tt_metal::Shape const&, tt::tt_metal::DataType, tt::tt_metal::Layout, tt::tt_metal::MemoryConfig const&, std::__1::optional<tt::tt_metal::ShardSpecBuffer> const&)
E        --- /home/ubuntu/tt-metal/ttnn/ttnn/_ttnn.so(_ZN2tt8tt_metal11tensor_impl25initialize_data_on_deviceI8bfloat16NS0_15borrowed_buffer6BufferEEENSt3__110shared_ptrINS0_6BufferEEERT0_IT_EPNS0_6DeviceERKNS0_5ShapeENS0_8DataTypeENS0_6LayoutERKNS0_12MemoryConfigERKNS6_8optionalINS0_15ShardSpecBufferEEENSO_INS6_17reference_wrapperINS0_12CommandQueueEEEEE+0x2a) [0x7f2606cb893a]
E        --- /home/ubuntu/tt-metal/ttnn/ttnn/_ttnn.so(+0xe2f8f7) [0x7f2606cb88f7]
E        --- /home/ubuntu/tt-metal/ttnn/ttnn/_ttnn.so(+0xe2f639) [0x7f2606cb8639]
ayerofieiev-tt commented 6 days ago

@jdh8 , I am not clear on this part of the PR description

There is an issue while converting value: float to a singleton tensor in ttnn. I also tried converting the value tensor to tile layout, but it did not work either.

Does it mean this PR is not ready? I don't see any checks in the conversion code or tests marked with xfail

jdh8 commented 5 days ago

I marked the failing test with its reason. It should be clear now.