Skip to content

Conversation

@amd-khushbu
Copy link
Collaborator

Proposed changes

This PR introduces Preshuffle Quant for group size N = (1, 8, 16, 32, 64) for both prefill and decode shapes for 2d block scale Gemm.
Changes include:

  1. Shuffled host data to align it to warp size per block level level.
  2. Preparing data to read from DRAM
  3. Updating the Thread data mapping for fine, medium and coarse grained sizes.
  4. Updating the block level code to read data acc to updated thread data mapping.

Checklist

Please put an x into the boxes that apply. You can also fill these out after creating the PR. If you're not sure, please don't hesitate to ask.

  • I have added tests relevant to the introduced functionality, and the unit tests are passing locally
  • I have added the test to REGRESSION_TESTS list defined at the top of CMakeLists.txt in tests/CMakeLists.txt, IF the test takes more than 30 seconds to run.
  • I have added inline documentation which enables the maintainers with understanding the motivation
  • I have removed the stale documentation which is no longer relevant after this pull request
  • (If this change is user-facing) I have added release notes which provide the end users with a brief summary of the improvement from this pull request
  • I have run clang-format on all changed files
  • Any dependent changes have been merged

Discussion

If this is a relatively large or complex change, feel free to start a discussion by explaining why you chose the solution you did and what alternatives you considered

Copy link
Contributor

@ThomasNing ThomasNing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments. Please also add the tests and next step I believe to integrate that with the preshuffled.

if constexpr(NPerQ <= WarpGemm::kN)
{
constexpr auto N1 = BlockGemmShape::kK / KPerQ;
constexpr auto N0 = WarpGemm::kN / NPerQ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the variable naming here with N1 = Kvalues and k0 = nwarps will cause confusion. Could we restructure the variable names and add the comments?

constexpr auto K0 = KPerTile / K1;
constexpr auto KR = 1;

return make_static_tile_distribution(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add the partition reasoning of the different condition of tile distribution?

ck_tile::integer_least_multiple(warp_n * bqk_per_block, get_warp_size());
constexpr auto tile_window_height = block_n / warp_n;
auto block_n_idx = i_n / block_n;
constexpr auto tile_window_height =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I understand the reason of this condition?

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.

4 participants