Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d10c730
feat(rocke): gfx1250 fp8 GEMM bring-up and K-loop optimization (AICK-…
jefyang1 Oct 30, 2026
a26fda9
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Oct 31, 2026
25af796
fix(rocke): record the dense f8f6f4 WMMA atom in the llvm24 arch doma…
jefyang1 Oct 31, 2026
c5a06ab
fix(rocke): record the dense f8f6f4 WMMA atom in the llvm20/22/23 arc…
jefyang1 Nov 1, 2026
a624052
fix(rocke): round the early-refill K-tile count up so a partial last …
jefyang1 Nov 2, 2026
b14c6d9
fix(rocke): name the gfx1250 TDM K-loop knobs in the universal GEMM k…
jefyang1 Nov 2, 2026
0ade238
refactor(rocke): one fp8/bf8 GEMM storage rule in the C++ engine
jefyang1 Nov 2, 2026
ff8e26a
refactor(rocke): one K-tile count and one fill-publish helper for the…
jefyang1 Nov 2, 2026
037e480
refactor(rocke): one TDM descriptor builder: core tdm_descriptor_2d t…
jefyang1 Nov 2, 2026
6fd9f26
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Nov 3, 2026
eaf1c10
fix(rocke): C++ prefetch K-loop drains like Python and develop
jefyang1 Nov 3, 2026
20fea26
refactor(rocke): TDM pad encode lives in core beside tdm_descriptor_2d
jefyang1 Nov 3, 2026
20fad07
refactor(rocke): one GEMM dtype-to-IR map and one A/B element size
jefyang1 Nov 3, 2026
86f5281
fix(rocke): gfx1250 fp8 GEMM review fixes: TDM edge cases, validators…
jefyang1 Nov 3, 2026
5d01090
docs(rocke): gfx1250 fp8 GEMM docs: drop hardware notes, fix stale text
jefyang1 Nov 3, 2026
9dc69fc
test(rocke): cover the remaining fixes from the 11-03 review
jefyang1 Nov 3, 2026
7ea9e66
refactor(rocke): finish the review's N1/N3 leftovers in the GEMM engines
jefyang1 Nov 3, 2026
a027713
docs(rocke): gfx1250 fp8 GEMM docs report one timing protocol
jefyang1 Nov 3, 2026
e443394
fix(rocke): lds_swizzle rejected on every WMMA target; i64 batch offs…
jefyang1 Nov 3, 2026
4ee1e7f
test(rocke): batched TDM fills checked end to end; valid bases for th…
jefyang1 Nov 3, 2026
344060a
fix(rocke): TDM issuers are the launched waves, not warp_m*warp_n*warp_k
jefyang1 Nov 3, 2026
6f6c8f5
fix(rocke): forward split_k, emit_sched_hints, cshuffle_no_alias to t…
jefyang1 Nov 3, 2026
378e5d7
test(rocke): bless gemm parity configs 13-32 in the differential golden
jefyang1 Nov 3, 2026
e44a147
test(rocke): host CTest for the universal GEMM's gfx1250 reject rules
jefyang1 Nov 3, 2026
bfa8ed5
test(rocke): run test_arch_table_engine_parity as a build-tree CTest
jefyang1 Nov 3, 2026
e7dfeec
fix(rocke): read .agpr_count from the HSA metadata note
jefyang1 Nov 3, 2026
ffe895f
fix(rocke): build-pool watchdog is opt-in; the fp8 sweep opts in
jefyang1 Nov 3, 2026
a46f837
refactor(rocke): one exact set, one GPU check, public encoders for th…
jefyang1 Nov 3, 2026
afe4f1d
docs(rocke): Knob Catalog rows state every validator constraint
jefyang1 Nov 3, 2026
9abad70
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Nov 4, 2026
1e4c087
docs(rocke): fp8 case study runs on the dedicated K=128 instruction
jefyang1 Nov 4, 2026
d514645
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Nov 4, 2026
9d20ae2
fix(rocke): reject atoms without A/B lane maps; one bf16/fp8 codec; T…
jefyang1 Nov 4, 2026
e357d26
refactor(rocke): one GEMM spec reader in the binding; shared lane-map…
jefyang1 Nov 4, 2026
43395b2
refactor(rocke): fp8 rounder in rocke.numeric.fp8; GEMM spec dicts fr…
jefyang1 Nov 5, 2026
4158003
docs(rocke): spec-dict docstring says the binding must read new keys;…
jefyang1 Nov 5, 2026
131cf1c
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Nov 5, 2026
30b2be7
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Nov 5, 2026
67f5b45
test(rocke): GEMM spec dicts and the binding's key reads must match
jefyang1 Nov 6, 2026
e2fe050
test(rocke): TDM K-loop tests read the IR through KernelIR
jefyang1 Nov 6, 2026
0434e3c
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Nov 6, 2026
357a71f
test(rocke): spec-dict parity covers top-level fields and ignores com…
jefyang1 Nov 6, 2026
a3e38f9
test(rocke): shorter sweep build-pool and inert-sweep tests
jefyang1 Nov 6, 2026
2812c33
test(rocke): inert-sweep test keeps a value that is not a duplicate
jefyang1 Nov 6, 2026
9f23cdc
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Nov 6, 2026
921b134
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Nov 7, 2026
5442420
Merge branch 'develop' into users/jefyang/rocke/aick-2347
jefyang1 Nov 7, 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
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,17 @@
apply_codegen_policy,
scheduler_strategy_reason,
)
from rocke.core.ir import BF16, F16, F32, I32, IRBuilder, KernelDef, PtrType, Value
from rocke.core.ir import (
BF16,
F16,
F32,
I32,
IRBuilder,
KernelDef,
PtrType,
Value,
encode_tdm_padding,
)
from rocke.helpers.spec import SignatureBuilder, ceil_div, kernel_name_join

WMMA_K = 32 # K of the 16x16x32 atom
Expand Down Expand Up @@ -522,9 +532,10 @@ def _tile(f: Value) -> _Tile:
pad_kw = {}
tile0 = P
if spec.lds_pad == "tdm":
# The TDM pads 4 dwords after every tile_k / 2 dwords; the fields
# encode 2^(interval + 1) and amount + 1 dwords.
pad_kw = dict(pad_interval=(CK // 2).bit_length() - 2, pad_amount=3)
# The TDM pads CH_PAD elements after every tile_k-element row (both
# 16-bit).
interval, amount = encode_tdm_padding(CK * 2, CH_PAD * 2)
pad_kw = dict(pad_interval=interval, pad_amount=amount)
tile0 = CK

def _issue(q: Value) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ if(ROCKE_INSTALL_TESTS)
# the differential harness (needs compiler + source; its Python-only golden
# check is installed separately above), the WaveScope sidecar,
# LDS analyzer and dsl_probes tests (load tools from the adjacent dsl_doc
# source tree), and the arch-domain artifact unit tests. The latter remain
# source tree), the arch-table parity test (reads cpp/core/arch/data.cpp),
# and the arch-domain artifact unit tests. The latter remain
# source-only units, while the full regeneration sweep is installed below as
# its own CTest with an independent timeout and resource policy.
# Include run_all.py: installed runner unit tests import it as a dependency.
Expand All @@ -486,6 +487,8 @@ if(ROCKE_INSTALL_TESTS)
PATTERN "test_lds_analyzer.py" EXCLUDE
PATTERN "test_dsl_probes.py" EXCLUDE
PATTERN "test_arch_domain_artifact.py" EXCLUDE
PATTERN "test_arch_table_engine_parity.py" EXCLUDE
Comment thread
jefyang1 marked this conversation as resolved.
Resolved
PATTERN "test_gemm_spec_dict_binding_parity.py" EXCLUDE
PATTERN "test_gpu_references.py" EXCLUDE)

endblock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ namespace
struct SpecHolder
{
rocke_gemm_universal_spec_t spec;
std::vector<std::string> storage; /* keeps pointed-to strings alive */
/* keeps pointed-to strings alive; a deque, so no element ever moves */
std::deque<std::string> storage;

const char* keep(const std::string& s)
{
Expand Down Expand Up @@ -203,19 +204,18 @@ bool dict_str(const py::dict& d, const char* key, std::string& out)
return false;
}

/* Build a rocke_gemm_universal_spec_t from a Python spec dict.
/* Fill a rocke_gemm_universal_spec_t (already default-initialised) from a spec
* dict; the one reader of the GEMM spec dict. `store` keeps any string fields
* alive for the spec's lifetime. build_spec (universal GEMM), the batched,
* grouped and flatmm readers, and gemm_multi_d and gemm_multi_abd (their nested
* `base`) all call it.
*
* The dict mirrors UniversalGemmSpec. Recognised layouts (both accepted):
* (a) flat: {name, tile_m, tile_n, ..., pipeline, epilogue, dtype_a, ...}
* (b) nested: {name, tile:{...}, trait:{...}, data:{...}, wave_size, ...}
* Nested sub-dicts take precedence; any flat key is also honoured. Every field
* defaults to the C engine default (rocke_gemm_universal_spec_default), so a
* minimal dict {name, tile_m, tile_n, tile_k, warp_m, warp_n} works. */
/* Fill a rocke_gemm_universal_spec_t (already default-initialised) from a spec
* dict. `store` keeps any string fields alive for the spec's lifetime. The
* GEMM-variant families that wrap a UniversalGemmSpec (gemm_multi_d /
* gemm_multi_abd) reuse this to populate their nested `base` field. The dict
* accepts both a flat key view and nested tile/trait/data sub-dicts. */
* keeps its default when absent, so a minimal dict
* {name, tile_m, tile_n, tile_k, warp_m, warp_n} works. */
void fill_universal_spec(rocke_gemm_universal_spec_t* spec,
std::deque<std::string>& store,
const py::dict& root)
Expand All @@ -234,12 +234,15 @@ void fill_universal_spec(rocke_gemm_universal_spec_t* spec,
py::dict trait = sub("trait");
py::dict data = sub("data");

auto pick = [&](const py::dict& nested, const char* key) -> py::dict {
/* One view per section: the flat root keys, overridden by the nested
* sub-dict's. Each field is then read once below, by name, so a new field
* is added in one place. */
auto merged = [&](const py::dict& nested) -> py::dict {
py::dict r;
if(nested.contains(key))
r[key] = nested[key];
else if(root.contains(key))
r[key] = root[key];
for(auto kv : root)
r[kv.first] = kv.second;
for(auto kv : nested)
r[kv.first] = kv.second;
return r;
};

Expand All @@ -251,22 +254,7 @@ void fill_universal_spec(rocke_gemm_universal_spec_t* spec,

/* ---- tile geometry ---- */
{
py::dict t;
const char* keys[] = {"tile_m",
"tile_n",
"tile_k",
"warp_m",
"warp_n",
"warp_k",
"warp_tile_m",
"warp_tile_n",
"warp_tile_k"};
for(const char* k : keys)
{
py::dict got = pick(tile, k);
if(got.contains(k))
t[k] = got[k];
}
py::dict t = merged(tile);
spec->tile.tile_m = dict_int(t, "tile_m", spec->tile.tile_m);
spec->tile.tile_n = dict_int(t, "tile_n", spec->tile.tile_n);
spec->tile.tile_k = dict_int(t, "tile_k", spec->tile.tile_k);
Expand All @@ -280,33 +268,7 @@ void fill_universal_spec(rocke_gemm_universal_spec_t* spec,

/* ---- trait ---- */
{
py::dict tr;
const char* keys[] = {"pipeline",
"scheduler",
"epilogue",
"pad_m",
"pad_n",
"pad_k",
"persistent",
"chiplet_swizzle",
"chiplet_wgm",
"chiplet_num_xcds",
"chiplet_chunk_size",
"waves_per_eu",
"preshuffle_b",
"direct_to_lds",
"dtl_cache_a",
"dtl_cache_b",
"dtl_prefetch",
"active_tile_skip",
"lds_k_pad",
"lds_swizzle"};
for(const char* k : keys)
{
py::dict got = pick(trait, k);
if(got.contains(k))
tr[k] = got[k];
}
py::dict tr = merged(trait);
std::string s;
if(dict_str(tr, "pipeline", s))
spec->trait.pipeline = keep(s);
Expand Down Expand Up @@ -338,18 +300,33 @@ void fill_universal_spec(rocke_gemm_universal_spec_t* spec,
= dict_bool(tr, "active_tile_skip", spec->trait.active_tile_skip);
spec->trait.lds_k_pad = dict_int(tr, "lds_k_pad", spec->trait.lds_k_pad);
spec->trait.lds_swizzle = dict_bool(tr, "lds_swizzle", spec->trait.lds_swizzle);
/* Optional[int]: absent or None leaves the width dtype-resolved. */
if(tr.contains("ab_load_elem_bytes") && !tr["ab_load_elem_bytes"].is_none())
{
spec->trait.ab_load_elem_bytes_set = true;
spec->trait.ab_load_elem_bytes = tr["ab_load_elem_bytes"].cast<int>();
}
spec->trait.tdm = dict_bool(tr, "tdm", spec->trait.tdm);
spec->trait.tdm_depth = dict_int(tr, "tdm_depth", spec->trait.tdm_depth);
spec->trait.split_barrier = dict_bool(tr, "split_barrier", spec->trait.split_barrier);
spec->trait.tdm_alternate_issuers
= dict_bool(tr, "tdm_alternate_issuers", spec->trait.tdm_alternate_issuers);
spec->trait.tdm_early_refill
= dict_bool(tr, "tdm_early_refill", spec->trait.tdm_early_refill);
spec->trait.split_k = dict_int(tr, "split_k", spec->trait.split_k);
/* Optional[bool]: absent or None leaves the hints arch-resolved. */
if(tr.contains("emit_sched_hints") && !tr["emit_sched_hints"].is_none())
{
spec->trait.emit_sched_hints_set = true;
spec->trait.emit_sched_hints = tr["emit_sched_hints"].cast<bool>();
}
spec->trait.cshuffle_no_alias
= dict_bool(tr, "cshuffle_no_alias", spec->trait.cshuffle_no_alias);
}

/* ---- data ---- */
{
py::dict da;
const char* keys[] = {"dtype_a", "dtype_b", "dtype_c", "dtype_acc", "layout"};
for(const char* k : keys)
{
py::dict got = pick(data, k);
if(got.contains(k))
da[k] = got[k];
}
py::dict da = merged(data);
std::string s;
if(dict_str(da, "dtype_a", s))
spec->data.dtype_a = keep(s);
Expand All @@ -373,155 +350,7 @@ SpecHolder build_spec(const py::dict& root)
{
SpecHolder h;
h.spec = rocke_gemm_universal_spec_default();
h.storage.reserve(16);

/* Merge nested sub-dicts down into a flat view for convenience. */
auto sub = [&](const char* key) -> py::dict {
if(root.contains(key) && py::isinstance<py::dict>(root[key]))
return root[key].cast<py::dict>();
return py::dict();
};
py::dict tile = sub("tile");
py::dict trait = sub("trait");
py::dict data = sub("data");

/* A getter that checks the nested sub-dict first, then the flat root. */
auto pick = [&](const py::dict& nested, const char* key) -> py::dict {
py::dict r;
if(nested.contains(key))
r[key] = nested[key];
else if(root.contains(key))
r[key] = root[key];
return r;
};

/* name */
{
std::string s;
if(dict_str(root, "name", s))
h.spec.name = h.keep(s);
}

/* ---- tile geometry ---- */
{
py::dict t;
const char* keys[] = {"tile_m",
"tile_n",
"tile_k",
"warp_m",
"warp_n",
"warp_k",
"warp_tile_m",
"warp_tile_n",
"warp_tile_k"};
for(const char* k : keys)
{
py::dict got = pick(tile, k);
if(got.contains(k))
t[k] = got[k];
}
h.spec.tile.tile_m = dict_int(t, "tile_m", h.spec.tile.tile_m);
h.spec.tile.tile_n = dict_int(t, "tile_n", h.spec.tile.tile_n);
h.spec.tile.tile_k = dict_int(t, "tile_k", h.spec.tile.tile_k);
h.spec.tile.warp_m = dict_int(t, "warp_m", h.spec.tile.warp_m);
h.spec.tile.warp_n = dict_int(t, "warp_n", h.spec.tile.warp_n);
h.spec.tile.warp_k = dict_int(t, "warp_k", h.spec.tile.warp_k);
h.spec.tile.warp_tile_m = dict_int(t, "warp_tile_m", h.spec.tile.warp_tile_m);
h.spec.tile.warp_tile_n = dict_int(t, "warp_tile_n", h.spec.tile.warp_tile_n);
h.spec.tile.warp_tile_k = dict_int(t, "warp_tile_k", h.spec.tile.warp_tile_k);
}

/* ---- trait ---- */
{
py::dict tr;
const char* keys[] = {"pipeline",
"scheduler",
"epilogue",
"pad_m",
"pad_n",
"pad_k",
"persistent",
"chiplet_swizzle",
"chiplet_wgm",
"chiplet_num_xcds",
"chiplet_chunk_size",
"waves_per_eu",
"preshuffle_b",
"direct_to_lds",
"dtl_cache_a",
"dtl_cache_b",
"dtl_prefetch",
"active_tile_skip",
"lds_k_pad",
"lds_swizzle"};
for(const char* k : keys)
{
py::dict got = pick(trait, k);
if(got.contains(k))
tr[k] = got[k];
}
std::string s;
if(dict_str(tr, "pipeline", s))
h.spec.trait.pipeline = h.keep(s);
if(dict_str(tr, "scheduler", s))
h.spec.trait.scheduler = h.keep(s);
if(dict_str(tr, "epilogue", s))
h.spec.trait.epilogue = h.keep(s);
h.spec.trait.pad_m = dict_bool(tr, "pad_m", h.spec.trait.pad_m);
h.spec.trait.pad_n = dict_bool(tr, "pad_n", h.spec.trait.pad_n);
h.spec.trait.pad_k = dict_bool(tr, "pad_k", h.spec.trait.pad_k);
h.spec.trait.persistent = dict_bool(tr, "persistent", h.spec.trait.persistent);
h.spec.trait.chiplet_swizzle
= dict_bool(tr, "chiplet_swizzle", h.spec.trait.chiplet_swizzle);
h.spec.trait.chiplet_wgm = dict_int(tr, "chiplet_wgm", h.spec.trait.chiplet_wgm);
h.spec.trait.chiplet_num_xcds
= dict_int(tr, "chiplet_num_xcds", h.spec.trait.chiplet_num_xcds);
h.spec.trait.chiplet_chunk_size
= dict_int(tr, "chiplet_chunk_size", h.spec.trait.chiplet_chunk_size);
if(tr.contains("waves_per_eu") && !tr["waves_per_eu"].is_none())
{
h.spec.trait.waves_per_eu_set = true;
h.spec.trait.waves_per_eu = tr["waves_per_eu"].cast<int>();
}
h.spec.trait.preshuffle_b = dict_bool(tr, "preshuffle_b", h.spec.trait.preshuffle_b);
h.spec.trait.direct_to_lds = dict_bool(tr, "direct_to_lds", h.spec.trait.direct_to_lds);
h.spec.trait.dtl_cache_a = dict_int(tr, "dtl_cache_a", h.spec.trait.dtl_cache_a);
h.spec.trait.dtl_cache_b = dict_int(tr, "dtl_cache_b", h.spec.trait.dtl_cache_b);
h.spec.trait.dtl_prefetch = dict_bool(tr, "dtl_prefetch", h.spec.trait.dtl_prefetch);
h.spec.trait.active_tile_skip
= dict_bool(tr, "active_tile_skip", h.spec.trait.active_tile_skip);
h.spec.trait.lds_k_pad = dict_int(tr, "lds_k_pad", h.spec.trait.lds_k_pad);
h.spec.trait.lds_swizzle = dict_bool(tr, "lds_swizzle", h.spec.trait.lds_swizzle);
}

/* ---- data ---- */
{
py::dict da;
const char* keys[] = {"dtype_a", "dtype_b", "dtype_c", "dtype_acc", "layout"};
for(const char* k : keys)
{
py::dict got = pick(data, k);
if(got.contains(k))
da[k] = got[k];
}
std::string s;
if(dict_str(da, "dtype_a", s))
h.spec.data.dtype_a = h.keep(s);
if(dict_str(da, "dtype_b", s))
h.spec.data.dtype_b = h.keep(s);
if(dict_str(da, "dtype_c", s))
h.spec.data.dtype_c = h.keep(s);
if(dict_str(da, "dtype_acc", s))
h.spec.data.dtype_acc = h.keep(s);
if(dict_str(da, "layout", s))
h.spec.data.layout = h.keep(s);
}

/* ---- top-level scalars ---- */
h.spec.wave_size = dict_int(root, "wave_size", h.spec.wave_size);
h.spec.block_size = dict_int(root, "block_size", h.spec.block_size);
h.spec.batched = dict_bool(root, "batched", h.spec.batched);

fill_universal_spec(&h.spec, h.storage, root);
rocke_gemm_universal_spec_finalize(&h.spec);
return h;
}
Expand Down
Loading
Loading