Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,9 @@ void TileGemmComputeImpl(ck_tile::QuantGemmHostArgs& args)
ck_tile::BaseGemmPipelineAgBgCrCompV3<GemmPipelineProblem>,
ck_tile::BaseWeightPreshufflePipelineAGmemBGmemCRegV2<GemmPipelineProblem>>;

// const ck_tile::index_t K_split =
// (args.K + GemmConfig::K_Tile_v - 1) / GemmConfig::K_Tile_v * GemmConfig::K_Tile_v;
// const ck_tile::index_t num_loop = TilePartitioner::GetLoopNum(K_split);
// const bool has_hot_loop = BaseGemmPipeline::BlockHasHotloop(num_loop);
const ck_tile::index_t K_split = ck_tile::integer_least_multiple(args.K, GemmConfig::K_Tile_v);
// Each split runs its own K range, so pick the pipeline from the per-split loop count.
const ck_tile::index_t k_grain = args.k_batch * GemmConfig::K_Tile_v;
const ck_tile::index_t K_split = (args.K + k_grain - 1) / k_grain * GemmConfig::K_Tile_v;
const ck_tile::index_t num_loop = TilePartitioner::GetLoopNum(K_split);
const bool has_hot_loop = BaseGemmPipeline::BlockHasHotloop(num_loop);
const ck_tile::TailNumber tail_num = BaseGemmPipeline::GetBlockLoopTailNum(num_loop);
Expand Down
7 changes: 7 additions & 0 deletions op_tests/test_gemm_a8w8_blockscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ def test_splitk_correctness(m=4, n=2112, k=7168, dtype=dtypes.bf16, splitK=1):
f"test_splitk_correctness(m={m}, n={n}, k={k}, splitK={splitK}): "
f"ck_err={ck_err:.4g}, cktile_err={cktile_err:.4g}"
)
assert ck_err < 0.05 and cktile_err < 0.05, (
f"split-K mismatch (m={m}, n={n}, k={k}, splitK={splitK}): "
f"ck_err={ck_err:.4g}, cktile_err={cktile_err:.4g}"
)


parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -520,6 +524,9 @@ def test_splitk_correctness(m=4, n=2112, k=7168, dtype=dtypes.bf16, splitK=1):
print("\nRunning split-K correctness checks ...")
for splitK in [1, 2]:
test_splitk_correctness(m=4, n=512, k=16384, splitK=splitK)
# Two K loops per split for the default CK-Tile tile, the shortest split it runs.
for m, n, k, splitK in [(8, 256, 512, 1), (8, 256, 1024, 2), (32, 512, 2048, 3)]:
test_splitk_correctness(m=m, n=n, k=k, splitK=splitK)

# Save results from benchmarks
if args.output:
Expand Down
Loading