-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#13127: Add full support for creating tensors with logical sharding f…
…rom python #13127: Add support for ROW_MAJOR block/width sharding with partial shards along width - Changes to pytensor: * Integrate encode_tensor_data converter into create_owned_tensor * Integrate decode_tensor_data data converter into create_row_major_owned_buffer ** Update converters to also handle tilize and untilize if needed ** Update converters to also handle interleaved tensors with equivalent sharding specs * Switch to query logical shape when converting tt tensor to pytorch and numpy tensors ** This adds readback support for logically sharded tensors ** For pytorch, fork new functionality into tensor.to_torch_with_logical_shape() ** Maintain old tensor.to_torch() behaviour which returns data based on padded shape *** TODO: This is incorrect and need to fix tests that use tensor.to_torch() *** TODO: Then, we can deprecate old tensor.to_torch() and use new one * Update enable_borrow logic to account for padding needed for logical sharding * Add check for shard spec to have value for sharded memory configs - Other infra changes/fixes: * Integrate tensor APIs into ttnn.from_torch() and ttnn.to_torch() to support logical sharding * Update create_default_alignment for ROW_MAJOR logically sharded tensors * Add TT_FATAL check to make sure raw data bytes matches expected device buffer size before sharding * Add pybind for creating logical shard spec with logical and physical shard shapes * Fix bug with reshape view hardcoding tile sizes - Add test cases for logical sharding to tests/ttnn/unit_tests/tensor/test_tensor_creation.py * Tests tensor creation with ttnn.Tensor(...) and ttnn.from_torch(...) * Tests tensor readback with tensor.to_torch_with_logical_shape(...) and ttnn.to_torch(...) * Tests API parity between tensor and functional ttnn APIs - Clean up tests/ttnn/unit_tests/gtests/tensor/test_sharding_with_alignment.cpp * Move important converters and helper functions into tensor_impl and tensor_utils * Convert expected/output data to TILE/ROW_MAJOR layout for ease of testing ** Needed since converters now tilize/untilize to match required Layout * Change CoreRangeSet to proper 2D grid for BLOCK sharded cases * Change EXPECT_EQ to ASSERT_EQ for ShardWithAlignmentTests * Fix formatting for test cases
- Loading branch information
1 parent
5058b8f
commit 212be31
Showing
11 changed files
with
705 additions
and
350 deletions.
There are no files selected for viewing
475 changes: 187 additions & 288 deletions
475
tests/ttnn/unit_tests/gtests/tensor/test_sharding_with_alignment.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.