-
Notifications
You must be signed in to change notification settings - Fork 90
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
#13204: adjust matmul program config selection for some sharded output scenarios #13819
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! One suggesion about in0_block_w
in create_simple_matmul_program_config
// MatmulMultiCoreProgramConfig does not support sharded output. | ||
// Reduce in0_block_w if necessary to choose other configs. | ||
if (mem_config.is_sharded() and Kt % in0_block_w != 0) { | ||
in0_block_w = 1; | ||
} | ||
|
||
if (num_blocks_x * num_blocks_y <= num_cores_x * num_cores_y and Kt % in0_block_w == 0) { | ||
CoreCoord core_range = get_core_range(num_blocks_y, num_blocks_x, num_cores_y, num_cores_x); | ||
if (core_range.y == 1) { | ||
bool use_mcast_config = mem_config.is_sharded() and core_range.y == 0; | ||
if (core_range.y == 1 or (use_mcast_config and mem_config.memory_layout == TensorMemoryLayout::WIDTH_SHARDED)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to do something like this for in0_block_w
:
uint32_t in0_block_w = (Kt % 2 == 0) ? 2 : 1;
and remove the code from lines 366-371 and the check for Kt % in0_block_w == 0
on line 372?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it would. Unfortunately, that would require updating the PCCs for models/tests. I'm hoping to refactor this code, and will look at it then.
4cc5332
to
fe55daf
Compare
…arded output scenarios (tenstorrent#13819) * tenstorrent#13204: adjust matmul program config selection for some sharded output scenarios * tenstorrent#13204: adjust matmul program config selection for some height/block sharded output scenarios * tenstorrent#13204: add interleaved input sharded output matmul test
Workaround introduced in #894 is not needed anymore. The issue was fixed in metal tenstorrent/tt-metal#13819. Closes #891 FYI @odjuricicTT
Workaround introduced in #894 is not needed anymore. The issue was fixed in metal tenstorrent/tt-metal#13819. Closes #891 FYI @odjuricicTT
Workaround introduced in #894 is not needed anymore. The issue was fixed in metal tenstorrent/tt-metal#13819. Closes #891 FYI @odjuricicTT
Workaround introduced in #894 is not needed anymore. The issue was fixed in metal tenstorrent/tt-metal#13819. Closes #891 FYI @odjuricicTT
Ticket
Link to Github Issue #13204
Problem description
The matmul program config selection for a single core where Kt is not a multiple of 2 and output is sharded leads to choosing a program config that cannot handle sharded outputs
What's changed
Add checks for if the output is sharded, and choose an appropriate in0_block_w and mcast config
Checklist
T3k frequent tests passes https://github.com/tenstorrent/tt-metal/actions/runs/11351278842