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

#8536: Allow in0 and output to be sharded on different grids for mcast 1D in0 #8614

Merged
merged 1 commit into from
May 23, 2024

Conversation

TT-BrianLiu
Copy link
Contributor

@TT-BrianLiu TT-BrianLiu commented May 17, 2024

  • Fully decouple in0 sender (ie. has in0 data) and receiver (ie. cores that produce work) grids
  • This means user can now width shard in0 K and specify per_core_N that divides output width on arbitrary number of cores
  • See tests/ttnn/sweep_tests/sweeps/sweeps/matmul/short/matmul_user_program_config_mcast_1d.py for examples

Changes:

  • Remove this assert: TT_FATAL(div_up(N, per_core_N) == input_tensor_a.shard_spec().value().grid.num_cores());
  • Separate in0 sender/recv cores into 3 kernel quadrants so all new logic is compile time
    • in0_mcast_cores_with_work_and_in_receiver_grid
    • in0_mcast_cores_without_work_and_in_receiver_grid
    • in0_mcast_cores_without_work_and_not_in_receiver_grid
  • Only load compute and writer kernels onto cores that produce output work
  • For interleaved in0, only mcast to cores with work as well; if single core, skip mcast
  • Add new short matmul sweep to test mcast 1D matmul with different in0 and output grids
  • Fork tt_eager/tt_dnn/op_library/bmm/kernels/dataflow/reader_bmm_tile_layout_in0_sender_receiver_padding_block_sharded.cpp to *width_sharded.cpp
  • TODO: Merge these kernels back once mcast 2D matmul is uplifted to support this feature

@TT-BrianLiu
Copy link
Contributor Author

TT-BrianLiu commented May 17, 2024

This is a current draft with width sharded (mcast in0) working. Remaining TODOs:
- [ ] 2d mcast needs to work since it uses same in0 sharded reader kernel (will do in separate PR)

  • Move all new logic to reader kernels to compile time
  • Clean up and add more tests

@TT-BrianLiu TT-BrianLiu changed the title #8536: Allow in0 and output to be sharded on different grids for mcast 1D in0 and mcast 2D matmuls #8536: Allow in0 and output to be sharded on different grids for mcast 1D in0 May 22, 2024
… for mcast 1D in0

- Fully decouple in0 sender (ie. has in0 data) and receiver (ie. cores that produce work) grids
- This means user can now width shard in0 K and specify per_core_N that divides output width on arbitrary number of cores
- See tests/ttnn/sweep_tests/sweeps/sweeps/matmul/short/matmul_user_program_config_mcast_1d.py for examples

Changes:
- Remove this assert: TT_FATAL(div_up(N, per_core_N) == input_tensor_a.shard_spec().value().grid.num_cores());
- Separate in0 sender/recv cores into 3 kernel quadrants so all new logic is compile time
  * in0_mcast_cores_with_work_and_in_receiver_grid
  * in0_mcast_cores_without_work_and_in_receiver_grid
  * in0_mcast_cores_without_work_and_not_in_receiver_grid
- Only load compute and writer kernels onto cores that produce output work
- For interleaved in0, only mcast to cores with work as well; if single core, skip mcast
- Add new short matmul sweep to test mcast 1D matmul with different in0 and output grids
- Fork tt_eager/tt_dnn/op_library/bmm/kernels/dataflow/reader_bmm_tile_layout_in0_sender_receiver_padding_block_sharded.cpp to *width_sharded.cpp
- TODO: Merge these kernels back once mcast 2D matmul is uplifted to support this feature
@TT-BrianLiu TT-BrianLiu merged commit 392a717 into main May 23, 2024
5 checks passed
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.

None yet

4 participants