Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
727dd89
flydsl implementation of a16w16 gemm, WIP
omuhamma Apr 13, 2026
aa50b0e
Code styling and unit test fixes
omuhamma Apr 20, 2026
eb82c24
UT update
omuhamma Apr 20, 2026
d8ebec7
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Apr 20, 2026
0166ffe
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Apr 28, 2026
6e04e37
code updates, best runs
Boss2002n Jul 11, 2026
a356320
Kernel updates,split k for smaller configs and unroll variable
omuhamma Jul 16, 2026
c61cee8
Update shuffle.py
omuhamma Jul 20, 2026
9095aeb
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 20, 2026
3ae9e68
Added compute bound variant + black/ruff
Boss2002n Jul 20, 2026
367e648
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 24, 2026
56f7c17
black/ruff
omuhamma Jul 24, 2026
3244365
black/ruff
omuhamma Jul 24, 2026
6560453
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 27, 2026
b453d37
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 27, 2026
3dfa6ee
new api
omuhamma Jul 27, 2026
a856bb8
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 27, 2026
48b36d0
Cleanup pt2
omuhamma Jul 29, 2026
233428d
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 30, 2026
39b1f0a
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 30, 2026
23d7598
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 30, 2026
3fa14fe
Reverting UT changes that existed for AM
omuhamma Jul 30, 2026
5f4d6de
Revert prev commit
omuhamma Jul 30, 2026
f4650e4
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 30, 2026
0cdcc43
small refactor
omuhamma Jul 30, 2026
7ab8dc3
Splitting up kernel / wrapper
omuhamma Jul 30, 2026
d8e2bdb
black/ruff
omuhamma Jul 30, 2026
4a2a743
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Jul 31, 2026
6c0fdf1
refactor with claude skill
omuhamma Jul 31, 2026
eb94193
black/ruff
omuhamma Jul 31, 2026
d46e403
kernel updates based off comments
omuhamma Aug 5, 2026
91ae387
black/ruff
omuhamma Aug 5, 2026
c0dafbc
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Aug 5, 2026
da29bb5
Update gemm_a16w16_gfx1250.py
omuhamma Aug 7, 2026
7062dbf
oob edge cases
omuhamma Aug 7, 2026
f52a1aa
Revert "Update gemm_a16w16_gfx1250.py"
omuhamma Aug 7, 2026
cbfa910
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Aug 7, 2026
a981b56
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Aug 13, 2026
dcad896
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Aug 18, 2026
5b04d43
e2e testing and fixes
omuhamma Aug 19, 2026
da64d0a
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Aug 19, 2026
e57a7b6
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Aug 19, 2026
069f72d
Wire flydsl_gfx1250 a16w16 dispatch into tuned_gemm solMap
omuhamma Aug 20, 2026
71db74d
Update aiter/tuned_gemm.py
omuhamma Aug 20, 2026
7338bfb
Address review nits: fx-native LDS pointer, single typed casts
omuhamma Aug 20, 2026
9917e56
Support FlyDSL >=0.3.1: version-gate raw buffer op aux argument
omuhamma Aug 20, 2026
be0a22a
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Aug 20, 2026
449ba4f
resolving comments
omuhamma Aug 21, 2026
68bd91a
Merge branch 'main' into omuhamma/fly_a16w16
coderfeli Aug 25, 2026
cfbb2c5
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Aug 31, 2026
a94e851
removing bad copies, and unncessary padding
omuhamma Aug 31, 2026
ceed330
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Aug 31, 2026
e659da7
config picker, refactor, kernel change to prevent copies with split k
omuhamma Sep 8, 2026
3fcfd9b
Merge branch 'main' into omuhamma/fly_a16w16
coderfeli Sep 9, 2026
c56625e
Fix ruff I001 and drop deleted is_flydsl_available import
coderfeli Sep 9, 2026
44296e3
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Sep 9, 2026
8d828df
Addressing comments
omuhamma Sep 10, 2026
8256d65
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Sep 10, 2026
8adc7ac
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Sep 10, 2026
2101f4b
CI fix
omuhamma Sep 11, 2026
f83cde9
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Sep 11, 2026
f6f0dc9
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Sep 11, 2026
eea9470
Merge branch 'main' into omuhamma/fly_a16w16
omuhamma Sep 13, 2026
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
117 changes: 115 additions & 2 deletions aiter/aot/flydsl/gemm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

Supported kernel families:
- ``flydsl_hgemm_*`` gfx950 A16W16 GEMM kernels
- ``flydsl_hgemm_*_gfx1250`` gfx1250 A16W16 GEMM kernels
- ``flydsl_bpreshuflle_*`` a8w8 preshuffle GEMM kernels
- ``flydsl_bpreshuffle_8w_*`` gfx950 8-wave a8w8 ptpc GEMM kernels
- ``flydsl_bpreshuffle_wmma_*`` gfx1250 a8w8 ptpc GEMM kernels
Expand Down Expand Up @@ -71,8 +72,12 @@
gemm_a16w16_gfx950,
make_gemm_a16w16_param_and_validate,
)
from aiter.ops.flydsl.kernels.gemm_a16w16_kernel_gfx1250 import (
compile_gemm_a16w16 as compile_gemm_a16w16_gfx1250,
)
from aiter.ops.flydsl.kernels.kernels_common import run_cached
from aiter.ops.flydsl.kernels.preshuffle_gemm import compile_preshuffle_gemm
from aiter.ops.flydsl.kernels.tensor_shim import ptr_arg
from aiter.ops.flydsl.mxfp8_128_bpreshuffle_gemm_gfx1250 import (
BLOCK_K as SCALE_BLOCK_SIZE,
)
Expand Down Expand Up @@ -209,7 +214,11 @@ def parse_csv(csv_path: str):
params = get_flydsl_hgemm_kernel_params(kernel_name)
if params is not None:
params = dict(params)
params["kind"] = "hgemm"
params["kind"] = (
"a16w16_gfx1250"
if params["target_gfx"] == "gfx1250"
else "hgemm"
)
else:
params = None

Expand Down Expand Up @@ -376,6 +385,104 @@ def _compile_hgemm_to_cache(
)


def _compile_a16w16_gfx1250_to_cache(
*,
m: int,
n: int,
k: int,
dtype: str,
out_dtype: str,
block_m: int,
block_n: int,
block_k: int,
stages: int,
split_k: int,
m_waves: int,
n_waves: int,
k_waves: int,
group_m: int,
use_half_tile_interleaved: bool,
has_bias: bool,
target_gfx: str,
**kwargs,
):
del kwargs, group_m

import torch

if target_gfx != "gfx1250":
raise ValueError(
f"The FlyDSL gfx1250 A16W16 kernel only supports gfx1250, got {target_gfx}"
)
if k_waves != 1:
raise ValueError(
f"The FlyDSL gfx1250 A16W16 kernel only supports k_waves=1, got {k_waves}"
)

torch_dtype = _torch_dtype_for_kernel(dtype)
torch_out_dtype = _torch_dtype_for_kernel(out_dtype)
if torch_out_dtype not in (torch_dtype, torch.float32):
raise ValueError(
f"Unsupported output dtype {out_dtype!r} for input dtype {dtype!r}"
)
in_dtype_str = "fp16" if torch_dtype == torch.float16 else "bf16"
out_dtype_str = {torch.float16: "f16", torch.bfloat16: "bf16"}.get(
torch_out_dtype, "f32"
)
fx_dtype = {
torch.bfloat16: fx.BFloat16,
torch.float16: fx.Float16,
torch.float32: fx.Float32,
torch.int32: fx.Int32,
}
launch = compile_gemm_a16w16_gfx1250(
N=n,
K=k,
tile_m=block_m,
tile_n=block_n,
tile_k=block_k,
m_warp=m_waves,
n_warp=n_waves,
in_dtype=in_dtype_str,
out_dtype=out_dtype_str,
num_buffers=stages,
add_bias=has_bias,
split_k=split_k,
main_loop_unroll=use_half_tile_interleaved,
)

with compile_only_env():
dev = torch.device("cpu")
representative_extent = 8
a = torch.empty((1, representative_extent), device=dev, dtype=torch_dtype)
b = torch.empty((1, representative_extent), device=dev, dtype=torch_dtype)
out = torch.empty((1, representative_extent), device=dev, dtype=torch_out_dtype)
bias = torch.empty(
(representative_extent if has_bias else 0,),
device=dev,
dtype=torch_dtype if has_bias else torch_out_dtype,
)
workspace = torch.empty(
(representative_extent,), device=dev, dtype=torch.float32
)
semaphore = torch.zeros((representative_extent,), device=dev, dtype=torch.int32)
stream = fx.Stream(0)
dispatch_args = (
ptr_arg(out, fx_dtype[out.dtype]),
ptr_arg(a, fx_dtype[a.dtype]),
ptr_arg(b, fx_dtype[b.dtype]),
ptr_arg(bias, fx_dtype[bias.dtype]),
ptr_arg(workspace, fx_dtype[workspace.dtype]),
ptr_arg(semaphore, fx_dtype[semaphore.dtype]),
m,
n,
k,
k,
stream,
)
_compile_executable_to_cache(launch, *dispatch_args)


def _compile_preshuffle_to_cache(
*,
m: int,
Expand Down Expand Up @@ -679,7 +786,9 @@ def compile_one_config(

t0 = time.time()
try:
tensor_context = nullcontext() if kind == "hgemm" else FakeTensorMode()
tensor_context = (
nullcontext() if kind in ("hgemm", "a16w16_gfx1250") else FakeTensorMode()
)
with (
override_env("FLYDSL_GPU_ARCH", aot_arch),
tensor_context,
Expand All @@ -688,6 +797,10 @@ def compile_one_config(
hgemm_kwargs = dict(kwargs)
hgemm_kwargs["target_gfx"] = aot_arch
_compile_hgemm_to_cache(m=m, n=n, k=k, **hgemm_kwargs)
elif kind == "a16w16_gfx1250":
a16w16_kwargs = dict(kwargs)
a16w16_kwargs["target_gfx"] = aot_arch
_compile_a16w16_gfx1250_to_cache(m=m, n=n, k=k, **a16w16_kwargs)
elif kind == "preshuffle":
_compile_preshuffle_to_cache(m=m, n=n, k=k, **kwargs)
elif kind == "8wave":
Expand Down
6 changes: 3 additions & 3 deletions aiter/configs/model_configs/gptoss_bf16_tuned_gemm.csv
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ gfx1250,256,8,128,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0
gfx1250,256,16,128,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,32,128,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,48,128,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,64,128,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,128,128,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,256,128,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,512,128,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
Expand All @@ -154,7 +153,6 @@ gfx1250,256,8,2880,4096,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,
gfx1250,256,16,2880,4096,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,32,2880,4096,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,48,2880,4096,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,64,2880,4096,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,128,2880,4096,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,256,2880,4096,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,512,2880,4096,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
Expand All @@ -170,7 +168,6 @@ gfx1250,256,8,5120,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,
gfx1250,256,16,5120,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,32,5120,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,48,5120,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,64,5120,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,128,5120,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,256,5120,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,512,5120,2880,True,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
Expand Down Expand Up @@ -259,3 +256,6 @@ gfx1250,96,2048,201088,2880,False,torch.bfloat16,torch.bfloat16,False,False,trit
gfx1250,96,4096,201088,2880,False,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,96,8192,201088,2880,False,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,96,16384,201088,2880,False,torch.bfloat16,torch.bfloat16,False,False,triton,0,0,0.0,auto,0.0,0.0,0.0
gfx1250,256,64,5120,2880,True,torch.bfloat16,torch.bfloat16,False,False,flydsl,0,2,6.82,flydsl_hgemm_abf16_wbf16_bf16_t64x64x256x4_ks2_w4x2x1_bias1_ktail0_gm0_pht_gfx1250,0.0,276.75,4474.37
gfx1250,256,64,2880,4096,True,torch.bfloat16,torch.bfloat16,False,False,flydsl,0,4,5.82,flydsl_hgemm_abf16_wbf16_bf16_t64x64x128x6_ks4_w4x2x1_bias1_ktail0_gm0_pht_gfx1250,0.0,259.44,4207.20
gfx1250,256,64,128,2880,True,torch.bfloat16,torch.bfloat16,False,False,flydsl,0,6,3.0,flydsl_hgemm_abf16_wbf16_bf16_t16x16x256x3_ks6_w1x1x1_bias1_ktail0_gm0_pht_gfx1250,0.0,15.73,374.10
Loading
Loading