Repository navigation
Integration of the small-M decode GEMM kernels as the policy - #9075
vedenev-amd wants to merge 2 commits into
Conversation
…of the FlyDSL hgemm dispatch, because the review of #4114 asked for one dispatch path and one tuning space instead of a separate decode pipeline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
DRAFT — evaluation pausedPR Self-ReviewRevision This pull request is a draft, so readiness evaluation is paused and no verdict applies. Evaluation resumes when it is marked ready for review and the required CI completes. |
…m, so they share the one FlyDSL dispatch path and tuning space instead of a separate decode pipeline, as the review of #4114 asked. The hgemm kernel name keeps its fields and gains five optional ones that only these policies use: _eu (waves per EU), _rbp (ds_bpermute lane reduction), _ct (scalar or packed FP32 contraction), _lds (A staged in LDS) and _pn (persistent over N). A tuned small-M row applies only at its exact M. Outputs are bitwise equal to the #4114 kernels on all 72 gfx950 rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| import functools | ||
| from dataclasses import dataclass | ||
|
|
||
| import flydsl.compiler as flyc | ||
| import flydsl.expr as fx | ||
| from flydsl.expr import const_expr, gpu, range_constexpr | ||
| from flydsl.expr.typing import Int32 | ||
|
|
||
| from .gemm_a16w16_small_m_common import ( | ||
| MFMA_K, | ||
| WAVE_SIZE, | ||
| ActivationSource, | ||
| BlockMfmaDecodeConfig, | ||
| bf16x4_slice, | ||
| block_mfma_persistent_grid, | ||
| block_mfma_staged_k, | ||
| convert_bf16, | ||
| gemm_decode_kernel_name, | ||
| k_element, | ||
| load_scalar, | ||
| load_vector, | ||
| make_buffer_matrix, | ||
| make_buffer_vector, | ||
| make_vector_view, | ||
| masked_bf16_vector, | ||
| mfma_4x4x4_bf16, | ||
| padded_row_coordinates, | ||
| reduce_mfma_scalar, | ||
| wave_lane_coordinates, | ||
| ) | ||
| from .tensor_shim import _run_compiled | ||
| from .gemm_a16w16_small_m_common import unused_tensor_arg | ||
|
|
||
|
|
||
| def _ceil_div(value: int, divisor: int) -> int: |
There was a problem hiding this comment.
Import block is un-sorted or un-formatted
| import functools | |
| from dataclasses import dataclass | |
| import flydsl.compiler as flyc | |
| import flydsl.expr as fx | |
| from flydsl.expr import const_expr, gpu, range_constexpr | |
| from flydsl.expr.typing import Int32 | |
| from .gemm_a16w16_small_m_common import ( | |
| MFMA_K, | |
| WAVE_SIZE, | |
| ActivationSource, | |
| BlockMfmaDecodeConfig, | |
| bf16x4_slice, | |
| block_mfma_persistent_grid, | |
| block_mfma_staged_k, | |
| convert_bf16, | |
| gemm_decode_kernel_name, | |
| k_element, | |
| load_scalar, | |
| load_vector, | |
| make_buffer_matrix, | |
| make_buffer_vector, | |
| make_vector_view, | |
| masked_bf16_vector, | |
| mfma_4x4x4_bf16, | |
| padded_row_coordinates, | |
| reduce_mfma_scalar, | |
| wave_lane_coordinates, | |
| ) | |
| from .tensor_shim import _run_compiled | |
| from .gemm_a16w16_small_m_common import unused_tensor_arg | |
| def _ceil_div(value: int, divisor: int) -> int: | |
| import functools | |
| from dataclasses import dataclass | |
| import flydsl.compiler as flyc | |
| import flydsl.expr as fx | |
| from flydsl.expr import const_expr, gpu, range_constexpr | |
| from flydsl.expr.typing import Int32 | |
| from .gemm_a16w16_small_m_common import ( | |
| MFMA_K, | |
| WAVE_SIZE, | |
| ActivationSource, | |
| BlockMfmaDecodeConfig, | |
| bf16x4_slice, | |
| block_mfma_persistent_grid, | |
| block_mfma_staged_k, | |
| convert_bf16, | |
| gemm_decode_kernel_name, | |
| k_element, | |
| load_scalar, | |
| load_vector, | |
| make_buffer_matrix, | |
| make_buffer_vector, | |
| make_vector_view, | |
| masked_bf16_vector, | |
| mfma_4x4x4_bf16, | |
| padded_row_coordinates, | |
| reduce_mfma_scalar, | |
| unused_tensor_arg, | |
| wave_lane_coordinates, | |
| ) | |
| from .tensor_shim import _run_compiled | |
| def _ceil_div(value: int, divisor: int) -> int: |
| from __future__ import annotations | ||
|
|
||
| import functools | ||
|
|
||
| import flydsl.compiler as flyc | ||
| import flydsl.expr as fx | ||
| from flydsl.expr import const_expr, gpu, range_constexpr | ||
|
|
||
| from .gemm_a16w16_small_m_common import ( | ||
| ReductionMode, | ||
| WaveDecodeConfig, | ||
| contract_pair, | ||
| gemm_decode_kernel_name, | ||
| k_element, | ||
| load_vector, | ||
| make_buffer_matrix, | ||
| make_buffer_vector, | ||
| masked_bf16_vector, | ||
| pack_bf16x2, | ||
| prepare_pair, | ||
| reduce_wave_accumulator, | ||
| store_bf16, | ||
| wave_lane_coordinates, | ||
| zero_wave_accumulator, | ||
| ) | ||
| from .tensor_shim import _run_compiled | ||
| from .gemm_a16w16_small_m_common import unused_tensor_arg | ||
|
|
||
|
|
||
| def _accumulate_vectors( |
There was a problem hiding this comment.
Import block is un-sorted or un-formatted
| from __future__ import annotations | |
| import functools | |
| import flydsl.compiler as flyc | |
| import flydsl.expr as fx | |
| from flydsl.expr import const_expr, gpu, range_constexpr | |
| from .gemm_a16w16_small_m_common import ( | |
| ReductionMode, | |
| WaveDecodeConfig, | |
| contract_pair, | |
| gemm_decode_kernel_name, | |
| k_element, | |
| load_vector, | |
| make_buffer_matrix, | |
| make_buffer_vector, | |
| masked_bf16_vector, | |
| pack_bf16x2, | |
| prepare_pair, | |
| reduce_wave_accumulator, | |
| store_bf16, | |
| wave_lane_coordinates, | |
| zero_wave_accumulator, | |
| ) | |
| from .tensor_shim import _run_compiled | |
| from .gemm_a16w16_small_m_common import unused_tensor_arg | |
| def _accumulate_vectors( | |
| from __future__ import annotations | |
| import functools | |
| import flydsl.compiler as flyc | |
| import flydsl.expr as fx | |
| from flydsl.expr import const_expr, gpu, range_constexpr | |
| from .gemm_a16w16_small_m_common import ( | |
| ReductionMode, | |
| WaveDecodeConfig, | |
| contract_pair, | |
| gemm_decode_kernel_name, | |
| k_element, | |
| load_vector, | |
| make_buffer_matrix, | |
| make_buffer_vector, | |
| masked_bf16_vector, | |
| pack_bf16x2, | |
| prepare_pair, | |
| reduce_wave_accumulator, | |
| store_bf16, | |
| unused_tensor_arg, | |
| wave_lane_coordinates, | |
| zero_wave_accumulator, | |
| ) | |
| from .tensor_shim import _run_compiled | |
| def _accumulate_vectors( |
There was a problem hiding this comment.
Import block is un-sorted or un-formatted
aiter/aiter/ops/flydsl/gemm_a16w16_policy.py
Lines 6 to 24 in 0a5e8d7
There was a problem hiding this comment.
Import block is un-sorted or un-formatted
aiter/aiter/ops/flydsl/gemm_kernels.py
Lines 6 to 37 in 0a5e8d7
…of the FlyDSL hgemm dispatch, because the review of #4114 asked for one dispatch path and one tuning space instead of a separate decode pipeline.
Summary
Motivation
Changes
Performance (if applicable)
Testing
Documentation
Dependencies
Breaking Changes
PR Self-Review
Reviewed revision
Behavior and intent
Validation and unverified scope
PR-specific question
Changed op tests