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

Add support for resharding width-sharded tensors to/from DRAM #15526

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

Conversation

esmalTT
Copy link
Contributor

@esmalTT esmalTT commented Nov 28, 2024

Problem description

Resharding a width-sharded tensor from L1 → DRAM is currently not supported.

For context, this type of reshard is required for UNet Shallow's trace+2CQ implementation because the output tensor cannot be persistent in L1 due to size limitations.

The inverse operation (DRAM to L1) will be required for the UNet input tensor preprocessing once ttnn.convert_to_hwc is implemented.

What's changed

  • Implemented a new width shard → width shard reshard kernel that follows a similar design to the special case for height-sharded tensors.
    • Resharding from L1→L1, L1→DRAM, and DRAM→L1 is supported
    • Only row major tensors are supported for now. Future work should add support for TILE layout.
    • We will fallback to generalized reshard (even though it is broken with bad PCC for most width sharded I tested) if these conditions aren't met.
  • Added unit tests covering the new kernel
    • Added test cases for L1-to-L1 in test_reshard.py::test_reshard
    • Added test cases for L1/DRAM in test_reshard.py::test_dram_reshard
    • Added previously missing test for DRAM resharding + program cache in test_reshard.py::test_dram_reshard_with_program_cache
  • Re-formatted touched files (new stuff is here: link, rest is formatting or tests)

Checklist

  • Post commit CI passes (link)
  • New/Existing tests provide coverage for changes (added in tests/tt_eager/python_api_testing/unit_testing/misc/test_reshard.py)

@esmalTT esmalTT self-assigned this Nov 28, 2024
@esmalTT esmalTT changed the title Add support for L1-to-DRAM reshard with width-sharded tensors Add support for resharding width-sharded tensors to/from DRAM Nov 28, 2024
@esmalTT esmalTT force-pushed the esmal/reshard-width-sharding branch 2 times, most recently from 0021bcd to 2440b50 Compare November 28, 2024 14:23
This commit introduces a new width-shard to width-shard reshard kernel,
modeled after the height-sharded tensor reshard special case implemented
in `reshard_multi_core_same_width`.

Supported operations include:

- L1 to L1
- L1 to DRAM
- DRAM to L1

Currently, only row-major tensors are supported. For unsupported cases,
we fall back to the generalized reshard implementation.

Unit tests have been added to validate the new kernel functionality.
@esmalTT esmalTT marked this pull request as ready for review November 28, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant