diff --git a/dnn-providers/hip-kernel-provider/CMakeLists.txt b/dnn-providers/hip-kernel-provider/CMakeLists.txt index d96e37506a3a..2c3ac7550760 100644 --- a/dnn-providers/hip-kernel-provider/CMakeLists.txt +++ b/dnn-providers/hip-kernel-provider/CMakeLists.txt @@ -525,6 +525,7 @@ if(HIPKERNELPROVIDER_ENABLE_TESTS) set(HIPKERNELPROVIDER_GFX942_ATTENTION_UNIFIED_3D_INTEGRATION_CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/hipkernel_Gfx942AttentionUnified3d_test_categories_integration.yaml") set(HIPKERNELPROVIDER_GFX942_ATTENTION_UNIFIED_2D_INTEGRATION_CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/hipkernel_Gfx942AttentionUnified2D_test_categories_integration.yaml") set(HIPKERNELPROVIDER_GFX942_ATTENTION_DENSE_INTEGRATION_CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/hipkernel_Gfx942AttentionDense_test_categories_integration.yaml") + set(HIPKERNELPROVIDER_ATTENTION_PAGED_UNIFIED_INTEGRATION_CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/hipkernel_AttentionPagedUnified_test_categories_integration.yaml") set(HIPKERNELPROVIDER_GFX950_CONV_FWD_AOT_INTEGRATION_CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/hipkernel_Gfx950ConvFwdAot_test_categories_integration.yaml") set(HIPKERNELPROVIDER_GRAPH_CAPTURE_INTEGRATION_CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/GRAPH_CAPTURE_test_categories_integration.yaml") set(ROCKE_ENGINE_CTEST_CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/ROCKE_ENGINE_test_categories_external.yaml") @@ -541,6 +542,7 @@ if(HIPKERNELPROVIDER_ENABLE_TESTS) AND EXISTS "${HIPKERNELPROVIDER_GFX942_ATTENTION_UNIFIED_3D_INTEGRATION_CATEGORIES_YAML}" AND EXISTS "${HIPKERNELPROVIDER_GFX942_ATTENTION_UNIFIED_2D_INTEGRATION_CATEGORIES_YAML}" AND EXISTS "${HIPKERNELPROVIDER_GFX942_ATTENTION_DENSE_INTEGRATION_CATEGORIES_YAML}" + AND EXISTS "${HIPKERNELPROVIDER_ATTENTION_PAGED_UNIFIED_INTEGRATION_CATEGORIES_YAML}" AND EXISTS "${HIPKERNELPROVIDER_GFX950_CONV_FWD_AOT_INTEGRATION_CATEGORIES_YAML}" AND EXISTS "${HIPKERNELPROVIDER_GRAPH_CAPTURE_INTEGRATION_CATEGORIES_YAML}" AND EXISTS "${ROCKE_ENGINE_CTEST_CATEGORIES_YAML}" @@ -557,6 +559,7 @@ if(HIPKERNELPROVIDER_ENABLE_TESTS) "${HIPKERNELPROVIDER_GFX942_ATTENTION_UNIFIED_3D_INTEGRATION_CATEGORIES_YAML}" "${HIPKERNELPROVIDER_GFX942_ATTENTION_UNIFIED_2D_INTEGRATION_CATEGORIES_YAML}" "${HIPKERNELPROVIDER_GFX942_ATTENTION_DENSE_INTEGRATION_CATEGORIES_YAML}" + "${HIPKERNELPROVIDER_ATTENTION_PAGED_UNIFIED_INTEGRATION_CATEGORIES_YAML}" "${HIPKERNELPROVIDER_GFX950_CONV_FWD_AOT_INTEGRATION_CATEGORIES_YAML}" "${HIPKERNELPROVIDER_GRAPH_CAPTURE_INTEGRATION_CATEGORIES_YAML}" "${ROCKE_ENGINE_CTEST_CATEGORIES_YAML}" diff --git a/dnn-providers/hip-kernel-provider/ROCKE_ENGINE_test_categories_external.yaml b/dnn-providers/hip-kernel-provider/ROCKE_ENGINE_test_categories_external.yaml index 535e11a109a2..f7fbf654f740 100644 --- a/dnn-providers/hip-kernel-provider/ROCKE_ENGINE_test_categories_external.yaml +++ b/dnn-providers/hip-kernel-provider/ROCKE_ENGINE_test_categories_external.yaml @@ -144,6 +144,7 @@ test_categories: - "rocke_library_conv_tf32_lowering_pytest" - "rocke_library_attention_cpu_pytest" - "rocke_library_attention_cache_key_pytest" + - "rocke_library_attention_runtime_layout_pytest" - "rocke_library_attention_pytest" - "rocke_library_attention_gpu_pytest" - "rocke_library_attention_bias_gpu_pytest" @@ -241,6 +242,7 @@ test_categories: - "rocke_library_conv_tf32_lowering_pytest" - "rocke_library_attention_cpu_pytest" - "rocke_library_attention_cache_key_pytest" + - "rocke_library_attention_runtime_layout_pytest" - "rocke_library_attention_pytest" # Not registered on Windows (see rocke/library/tests/ctest_lists.cmake); the # parser ignores a listed name that has no registered test. diff --git a/dnn-providers/hip-kernel-provider/config/hipkernel_AttentionPagedUnified_gfx942.toml b/dnn-providers/hip-kernel-provider/config/hipkernel_AttentionPagedUnified_gfx942.toml new file mode 100644 index 000000000000..b067cbf5a16d --- /dev/null +++ b/dnn-providers/hip-kernel-provider/config/hipkernel_AttentionPagedUnified_gfx942.toml @@ -0,0 +1,18 @@ +# Integration test configuration for hipkernel:AttentionPagedUnified, gfx942 entry +# Filters use GTest-style globs: * matches any sequence of characters + +[meta] +version = 1 + +# The engine serves the paged/ragged SdpaFwd bundles on gfx942 and gfx950. No tolerance +# overrides needed: the forward pass uses the common SdpaAttributes tolerance +# (tol::sdpa::getToleranceFwd()). +# +# The engine ships for both architectures, so on a gfx950 device this entry would repeat +# the gfx950 entry's run. Skip there, so a package carrying both shards runs the bundles +# once. Any other device declines through the ordinary path (the packs arch-prune +# before the matcher). +[[test_skips]] +archs = ["gfx950"] +filters = ["*"] +reason = "hipkernel:AttentionPagedUnified: this entry runs on gfx942 only" diff --git a/dnn-providers/hip-kernel-provider/config/hipkernel_AttentionPagedUnified_gfx950.toml b/dnn-providers/hip-kernel-provider/config/hipkernel_AttentionPagedUnified_gfx950.toml new file mode 100644 index 000000000000..d0e04e1e1aff --- /dev/null +++ b/dnn-providers/hip-kernel-provider/config/hipkernel_AttentionPagedUnified_gfx950.toml @@ -0,0 +1,18 @@ +# Integration test configuration for hipkernel:AttentionPagedUnified, gfx950 entry +# Filters use GTest-style globs: * matches any sequence of characters + +[meta] +version = 1 + +# The engine serves the paged/ragged SdpaFwd bundles on gfx942 and gfx950. No tolerance +# overrides needed: the forward pass uses the common SdpaAttributes tolerance +# (tol::sdpa::getToleranceFwd()). +# +# The engine ships for both architectures, so on a gfx942 device this entry would repeat +# the gfx942 entry's run. Skip there, so a package carrying both shards runs the bundles +# once. Any other device declines through the ordinary path (the packs arch-prune +# before the matcher). +[[test_skips]] +archs = ["gfx942"] +filters = ["*"] +reason = "hipkernel:AttentionPagedUnified: this entry runs on gfx950 only" diff --git a/dnn-providers/hip-kernel-provider/descriptor-packaging/README.md b/dnn-providers/hip-kernel-provider/descriptor-packaging/README.md index defcbbd2cf10..348d12ddb5b1 100644 --- a/dnn-providers/hip-kernel-provider/descriptor-packaging/README.md +++ b/dnn-providers/hip-kernel-provider/descriptor-packaging/README.md @@ -117,8 +117,9 @@ too. Two answers decide which engine-pinned tests are registered: - **Per-arch registrations** (the census, and the external and gpu_ref integration checks) install into a gfx-specific shard and are gated on `hkp_product_ships_engine_for_arch()`, which reads what the shard for that arch - ships. The single-arch rocKE attention engines pinned against the SdpaFwd bundles - are registered from one table, `HKP_PINNED_ATTENTION_ENGINES` in `src/CMakeLists.txt`. + ships. The rocKE attention engines pinned against the SdpaFwd bundles are registered + from one table, `HKP_PINNED_ATTENTION_ENGINES` in `src/CMakeLists.txt`, one row per + engine and architecture. - **Host-side sources that pin an engine**, such as the attention knob suites, are gated on `hkp_product_offers_engine()`, which reads what the product root carries for any arch under this build's filters. It never reads `GPU_TARGETS`: the host libraries and diff --git a/dnn-providers/hip-kernel-provider/hipkernel_AttentionPagedUnified_test_categories_integration.yaml b/dnn-providers/hip-kernel-provider/hipkernel_AttentionPagedUnified_test_categories_integration.yaml new file mode 100644 index 000000000000..956d8469a389 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/hipkernel_AttentionPagedUnified_test_categories_integration.yaml @@ -0,0 +1,82 @@ +# Copyright © Advanced Micro Devices, Inc., or its affiliates. +# SPDX-License-Identifier: MIT +# +# hip-kernel-provider hipkernel:AttentionPagedUnified external integration test categories. +# +# One lane per architecture the engine ships for (gfx942, gfx950), each pinned to +# hipkernel:AttentionPagedUnified via --test-engine. Selects the shared +# integration-test-bundles/{quick,standard,comprehensive,full}/SdpaFwd/ suites by suite +# name. Engine pinning and support claims do the rest: a claimed case the engine declines +# fails its lane, an unclaimed one it declines skips (every non-paged SdpaFwd bundle), and +# an unclaimed one it accepts runs and is reported as unclaimed support. +# Tiers cascade: standard runs quick + standard, comprehensive runs quick + standard + +# comprehensive; only "full" runs the full-tier bundles. + +_common_excludes: &common_excludes + - "*DISABLED*" + +test_categories: + quick: + description: "Quick paged attention SdpaFwd bundle coverage" + test_patterns: + - "quick_SdpaFwd_*.*" + exclude: *common_excludes + labels: + - "quick" + - "pre-commit" + - "smoke" + + standard: + description: "Standard paged attention SdpaFwd bundle coverage" + test_patterns: + - "quick_SdpaFwd_*.*" + - "standard_SdpaFwd_*.*" + exclude: *common_excludes + labels: + - "standard" + - "pr" + - "precheckin" + + comprehensive: + description: "Comprehensive paged attention SdpaFwd coverage: quick + standard + comprehensive-tier bundles" + test_patterns: + - "quick_SdpaFwd_*.*" + - "standard_SdpaFwd_*.*" + - "comprehensive_SdpaFwd_*.*" + exclude: *common_excludes + labels: + - "comprehensive" + - "nightly" + - "extended" + + full: + description: "Full paged attention SdpaFwd coverage" + test_patterns: + - "*_SdpaFwd_*.*" + exclude: *common_excludes + labels: + - "full" + - "all" + + ffm-quick: + description: "Fast-feedback quick tier: paged attention SdpaFwd quick bundles" + test_patterns: + - "quick_SdpaFwd_*.*" + exclude: *common_excludes + labels: + - "ffm-quick" + - "ffm-full" + +# category_timeouts are CTest kill limits, set to 2x the tier's runtime budget +# (quick ~5 min, standard ~30 min incl. quick, comprehensive <= 60 min incl. +# quick+standard; full has no budget) so a budget overrun is a failure to +# investigate while ordinary run-to-run variance does not trip the timeout. +execution_settings: + default_timeout: 300 + timeout_multiplier: 1 + category_timeouts: + quick: 600 + standard: 3600 + comprehensive: 7200 + full: 14400 + ffm-quick: 1800 diff --git a/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/common.py b/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/common.py index cf306cf8eec1..fceb4649bede 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/common.py +++ b/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/common.py @@ -1048,6 +1048,7 @@ def items(spec): and not getattr(spec, f.name) ) and not (f.name == "lse_layout" and spec.lse_layout == "token_major") + and not (f.name == "runtime_layout" and not spec.runtime_layout) ) return ( diff --git a/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/tuning_specs.py b/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/tuning_specs.py index aa673f7a9114..0d6292a7948a 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/tuning_specs.py +++ b/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/tuning_specs.py @@ -180,6 +180,9 @@ def _semantic_fields( "causal_top_left", "right_bound", "emit_lse", + # hipDNN's paged engine selects it (kernels/*/attention_tiled_2d.py); + # dispatch never does, and a sweep must not vary it. + "runtime_layout", "lse_layout", } ) diff --git a/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/unified_rules.py b/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/unified_rules.py index ebfabcbeed9b..13efa2c45665 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/unified_rules.py +++ b/dnn-providers/hip-kernel-provider/rocke/library/dispatch/attention/unified_rules.py @@ -359,11 +359,15 @@ def defaults(self, base, kernel): # The LSE output fields are outputs the caller selects, not defaults # that knobs are a delta against: keeping them out of the kernel and # the split-KV reduce defaults leaves every config_key, and so every - # stored pin, as before the fields existed. + # stored pin, as before the fields existed. The 2D ``runtime_layout`` flag + # (hipDNN's paged engine; never a knob) is kept out of the kernel defaults + # for the same reason. "kernel": { name: value for name, value in _declared_defaults(type(kernel.kernel_spec)) - if name not in recorded and name not in _LSE_OUTPUT_FIELDS + if name not in recorded + and name not in _LSE_OUTPUT_FIELDS + and name != "runtime_layout" }, "reduce": ( None diff --git a/dnn-providers/hip-kernel-provider/rocke/library/kernels/common/_attention_runtime_layout.py b/dnn-providers/hip-kernel-provider/rocke/library/kernels/common/_attention_runtime_layout.py new file mode 100644 index 000000000000..7a4c92ad1bee --- /dev/null +++ b/dnn-providers/hip-kernel-provider/rocke/library/kernels/common/_attention_runtime_layout.py @@ -0,0 +1,91 @@ +# Copyright (c) Advanced Micro Devices, Inc., or its affiliates. +# SPDX-License-Identifier: MIT + +"""Runtime-layout pieces shared by the gfx942 and gfx950 tiled 2D attention builders. + +``runtime_layout`` (hipDNN's ``AttentionPagedUnified`` engine) appends kernel +arguments after the fixed ones and the runtime shape kernargs +(``RUNTIME_KERNARG_FIELDS``: num_query_heads, num_kv_heads, sliding_window), in +the order of ``RUNTIME_LAYOUT_EXTRA_ARGS``. Both architectures take the same +list, so the ABI and the sink-logit read live here once; a divergence between the +two builders would be a silent ABI break, and the C++ twin +(``instance_attention_tiled_2d_rtl_internal.h``) mirrors this list. +""" + +from __future__ import annotations + +from rocke.core.ir import F32, I16, I32, PtrType + +# (name, type) in ABI order. ``block_tables_v_ptr`` is V's block table; it +# shares ``block_table_stride`` with ``block_tables_ptr`` (K's table) and may be +# the same pointer. ``q_uniform_len`` is L > 0 for a dense Q (L rows per +# sequence) and 0 for a ragged one, whose offsets must be non-decreasing with +# off[b+1] - off[b] >= seq_lens_q[b] and off[B] the end of the last block. +# Strides are in elements; ``kv_block_span_bytes`` is the per-block +# buffer-resource size. ``sink_is_f32`` nonzero: ``sink_ptr`` holds Hq fp32 +# logits, else Hq logits in the Q dtype (ignored without sinks). ``num_kv_blocks`` is +# the K/V container's block count: a page id at or past it (or negative) reads as a +# masked page instead of addressing memory outside the cache. ``block_table_width`` is +# the page tables' row width M in entries: a sequence length past ``M * block_size`` +# would walk the table read off its row, so it is capped there. It is not +# ``block_table_stride`` (the step between rows), which is 0 or arbitrary for a batch +# of one and may exceed the width. +RUNTIME_LAYOUT_EXTRA_ARGS = ( + ("block_tables_v_ptr", "ptr"), + ("seq_lens_q_ptr", "ptr"), + ("has_seq_lens_q", "i32"), + ("q_uniform_len", "i32"), + ("q_seq_stride", "i32"), + ("q_tok_stride", "i32"), + ("q_head_stride", "i32"), + ("o_seq_stride", "i32"), + ("o_tok_stride", "i32"), + ("o_head_stride", "i32"), + ("kv_block_stride", "i32"), + ("kv_tok_stride", "i32"), + ("kv_head_stride", "i32"), + ("kv_block_span_bytes", "i32"), + ("q_block_grid", "i32"), + ("sink_is_f32", "i32"), + ("num_kv_blocks", "i32"), + ("block_table_width", "i32"), +) + + +def declare_runtime_layout_params(b): + """Declare the appended kernel arguments on ``b``; ``{name: Value}`` in ABI order.""" + params = {} + for name, ty in RUNTIME_LAYOUT_EXTRA_ARGS: + if ty == "ptr": + params[name] = b.param(name, PtrType(I32, "global"), readonly=True, align=4) + else: + params[name] = b.param(name, I32) + return params + + +def sink_logit(b, sinks, dtype, qh, qh_in, sink_is_f32=None): + """Query head ``qh``'s sink logit in f32. + + ``sink_is_f32`` is the runtime-layout kernarg (``None`` outside that mode, + where ``sinks`` holds Hq logits in the Q dtype). With it, nonzero means + ``sinks`` holds Hq fp32 logits, else Hq logits in the Q dtype. The fp32 form + is read as two 16-bit halves and both forms mask on their own flag, so neither + reads past the other's buffer (2*Hq halves vs Hq). + """ + if sink_is_f32 is None: + return b.cast_to_f32(b.global_load(sinks, qh, dtype, align=2)) + is_f32 = b.cmp_ne(sink_is_f32, b.const_i32(0)) + is_q = b.cmp_eq(sink_is_f32, b.const_i32(0)) + f32_in = b.land(qh_in, is_f32) + qh2 = b.mul(qh, b.const_i32(2)) + lo_idx = b.select(f32_in, qh2, b.const_i32(0)) + lo = b.global_load(sinks, lo_idx, I16, align=2) + hi_idx = b.select(f32_in, b.add(qh2, b.const_i32(1)), b.const_i32(0)) + hi = b.global_load(sinks, hi_idx, I16, align=2) + lo32 = b.zext(lo, I32) + hi32 = b.zext(hi, I32) + word = b.add(lo32, b.shl(hi32, b.const_i32(16))) + sink_w = b.bitcast(word, F32) + q_idx = b.select(b.land(qh_in, is_q), qh, b.const_i32(0)) + sink_h = b.global_load(sinks, q_idx, dtype, align=2) + return b.select(is_f32, sink_w, b.cast_to_f32(sink_h)) diff --git a/dnn-providers/hip-kernel-provider/rocke/library/kernels/gfx942/attention_tiled_2d.py b/dnn-providers/hip-kernel-provider/rocke/library/kernels/gfx942/attention_tiled_2d.py index 656ad9310047..d7d1047a8f92 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/kernels/gfx942/attention_tiled_2d.py +++ b/dnn-providers/hip-kernel-provider/rocke/library/kernels/gfx942/attention_tiled_2d.py @@ -39,6 +39,11 @@ from typing import ClassVar, Optional, Tuple from kernels.common._fmha_common import check_head_counts, gqa_ratio +from kernels.common._attention_runtime_layout import ( + RUNTIME_LAYOUT_EXTRA_ARGS, + declare_runtime_layout_params, + sink_logit, +) from kernels.common._lse_store import lse_row_has_mass, lse_store from kernels.common.attention_mask_type import band_mask_type from kernels.common._spec_checks import require_bool @@ -49,6 +54,7 @@ F16, F32, FP8E4M3, + I16, I32, I64, IRBuilder, @@ -505,9 +511,41 @@ class UnifiedAttention2DTiledSpec: # [total_q, num_query_heads, 1] through a trailing ``lse_ptr`` argument. # Off by default; off emits no new IR, so shipped kernels are unchanged. emit_lse: bool = field(default=False, kw_only=True) + # Runtime-layout mode (hipDNN paged/ragged SDPA engine, vLLM KV-cache view). + # The head counts, the window and the batch's search trip count are already + # kernargs (``RUNTIME_KERNARG_FIELDS``, ``RUNTIME_SEARCH_ITERS``). When True + # the kernel also takes 18 appended kernargs (block_tables_v_ptr, + # seq_lens_q_ptr, has_seq_lens_q, q_uniform_len, the Q/O/KV element strides, + # kv_block_span_bytes, q_block_grid, sink_is_f32, num_kv_blocks, + # block_table_width) and serves a + # dense-or-ragged Q and a real paged-KV layout from one compiled object: + # Q/O/KV strides are runtime, K pages through ``block_tables_ptr`` and V + # through ``block_tables_v_ptr`` + # (the same pointer, or a second table with the same row stride), the + # per-sequence Q/O base and the KV block term are 64-bit (one buffer + # resource per page), block-table reads past ceil(seq_len/BS) and K/V reads + # past seq_len are masked, a dense Q's rows past seq_lens_q (padding) and + # rows with no visible key store zeros, a ragged Q stores only its live + # rows (the first seq_lens_q rows of its block), and the q-block grid + # is walked with a grid-stride loop. The window mask is always on, with the + # ``sliding_window`` kernarg as its size, so the spec's ``sliding_window`` + # must be 0. The kernarg is a plain size: ``d - k < window`` keeps key k, so + # a window of 0 or below keeps none and every row stores zeros. "No window" + # is a window wider than any sequence (the engine passes 0x3FFFFFFF), never 0 + # or -1; the caller owns that (AttentionPagedUnifiedNative.cpp builds it, and + # a saved plan holding 0 or a negative window is refused at load). Only the + # default narrow 16x16x16 path is supported; see + # ``_runtime_layout_reject_reason``. ``tile_size`` may divide ``block_size`` + # here (sub-block tiles), which the fixed-layout path does not allow. + # Default False -> every existing kernel is byte-identical. + runtime_layout: bool = False def __post_init__(self): require_bool("emit_lse", self.emit_lse) + require_bool("runtime_layout", self.runtime_layout) + _rtl_reason = _runtime_layout_reject_reason(self) + if _rtl_reason is not None: + raise ValueError(_rtl_reason) # gfx942 (CDNA3) variant: the narrow ``16x16x16`` default path only. # The wide-K (32x32x16 migration) and transpose-read / native-fp8 # experimental knobs all depend on gfx950-only ISA (wide-K MFMA atoms, @@ -937,7 +975,7 @@ def __post_init__(self): ) if self.use_alibi or self.use_qq_bias: raise ValueError("use_register_pv v1 does not support ALiBi or QQ bias") - if self.tile_size is not None: + if self.tile_size is not None and not self.runtime_layout: if self.tile_size <= 0 or self.tile_size % self.block_size != 0: raise ValueError( f"tile_size must be a positive multiple of block_size " @@ -1098,7 +1136,223 @@ def kernel_name(self) -> str: "cmps" if self.use_causal_mask_phase_split else "", "k1buf" if self.use_k_single_buffer else "", "lse" if self.emit_lse else "", + "rtl" if self.runtime_layout else "", + ) + + +# --------------------------------------------------------------------------- +# Runtime-layout mode (``spec.runtime_layout``) +# --------------------------------------------------------------------------- + +# Spec flags that bake a layout, need per-head side inputs, or select a +# non-default pipeline; runtime_layout supports none of them. +_RTL_INCOMPATIBLE_FLAGS = ( + "has_softcap", + "use_alibi", + "use_qq_bias", + "use_fp8_mfma_qk", + "use_fp8_mfma_pv", + "use_register_pv", + "use_mfma_32x32", + "use_mfma_32x32x8", + "use_transposed_qk_32x32", + "use_transposed_scalar_state", + "use_transposed_invariant_hoist", + "use_transposed_mask_once", + "use_transposed_half_local_pv", + "use_mfma32_skip_legacy_qreg", + "use_transposed_mask_limit", + "use_grouped_kv2_softmax", + "use_fast_paged_kv_desc", + "use_i64_kv_addr", + "use_early_v_schedule", + "use_agpr_alloc_zero", + "use_conflict_free_v", + "use_conflict_free_v_store", + "use_k_single_buffer", + "use_k_sliced_ring", + "use_k_sliced_ldsseq", + "use_iglp_opt", + "use_qk_pv_sched_group_barrier", + "use_q_direct_global", + "use_v_hbm_direct", + "use_k_hbm_direct", + "use_global_load_lds_k", + "use_q_major_grid", + "use_causal_mask_phase_split", + "emit_lse", +) + +# Buffer voffset used for masked K/V lanes. A page's buffer resource holds +# ``kv_block_span_bytes`` bytes, so a voffset at or past that returns 0 without a +# memory access. The caller keeps ``kv_block_span_bytes`` below +# ``0x7FFF0000`` (MAX_BLOCK_SPAN_BYTES in AttentionPagedUnifiedNative.cpp, which +# declines a graph with a larger block and refuses a saved plan holding one), so +# this voffset is always past the span, with the widest (16-byte) load to spare. +_RTL_KV_OOB_VOFF = 0x7FFFFFF0 + +# The kernargs appended in runtime_layout mode are RUNTIME_LAYOUT_EXTRA_ARGS +# (kernels/common/_attention_runtime_layout.py), shared with the gfx950 builder. + + +def _runtime_layout_reject_reason(spec: "UnifiedAttention2DTiledSpec") -> Optional[str]: + """Why ``spec`` is not a valid runtime_layout spec (None when valid/unused). + + This spec has no ``use_additive_bias``, ``causal_top_left`` or ``right_bound`` + field (the gfx942 kernel is always bottom-right causal with no right bound), + so, unlike the gfx950 spec, there is nothing of those to refuse. + """ + if not spec.runtime_layout: + return None + bad = [name for name in _RTL_INCOMPATIBLE_FLAGS if getattr(spec, name)] + if spec.kv_storage_dtype is not None: + bad.append("kv_storage_dtype") + if spec.sliding_window != 0: + bad.append("sliding_window != 0 (the window is a runtime kernarg)") + if spec.block_m_per_warp != 16: + bad.append("block_m_per_warp != 16") + if bad: + return "runtime_layout is incompatible with: " + ", ".join(bad) + ok, heads_reason = check_head_counts(spec.num_query_heads, spec.num_kv_heads) + if not ok: + return heads_reason + if spec.tile_size is not None: + t = spec.tile_size + if t < 16 or t % 16 != 0 or t > spec.block_size or spec.block_size % t != 0: + return ( + "runtime_layout tile_size must be a multiple of 16 that divides " + f"block_size (got tile_size={t}, block_size={spec.block_size})" + ) + return None + + +def runtime_layout_lds_bytes(*, head_size: int, tile_size: int, num_warps: int) -> int: + """Static LDS of a runtime_layout kernel (fp16/bf16). + + Every allocation is touched inside the q-block grid-stride loop, so the + LDS packer cannot alias any of them: K double buffer + V (with the + bank-deconflict row pad, an upper bound) + P_lds + Q_lds (only when Q does + not fit in K_lds) + Acc_lds. + """ + t, hd, bm = tile_size, head_size, num_warps * 16 + k_lds = 2 * t * hd * 2 + v_lds = t * (hd + 8) * 2 + p_lds = bm * (t + 8) * 2 + q_lds = 0 if bm <= 2 * t else bm * hd * 2 + acc_lds = bm * (32 if hd <= 64 else hd) * 2 + return k_lds + v_lds + p_lds + q_lds + acc_lds + + +def runtime_layout_geometry( + head_size: int, block_size: int, *, arch: str = "gfx942" +) -> Optional[Tuple[int, Optional[int]]]: + """``(num_warps, tile_size)`` the runtime_layout catalog uses. + + Largest CTA (num_warps 4, 2, 1) first, then the largest KV tile that + divides ``block_size`` and fits the arch LDS budget. ``tile_size`` is + None when the tile is one whole cache block. None when nothing fits. + """ + from rocke.core.arch import ArchTarget + + from ..common.attention_arch import attention_lds_capacity_bytes + + cap = attention_lds_capacity_bytes(arch) + wave_size = ArchTarget.from_gfx(arch).wave_size + for nw in (4, 2, 1): + t = block_size + while t >= 16: + if (t * head_size) % (nw * wave_size * 2) == 0 and runtime_layout_lds_bytes( + head_size=head_size, tile_size=t, num_warps=nw + ) <= cap: + return nw, (None if t == block_size else t) + t //= 2 + return None + + +def runtime_layout_catalog_spec( + *, + dtype: str, + head_size: int, + block_size: int, + num_queries_per_kv: int, + arch: str = "gfx942", + use_sinks: bool = False, +) -> UnifiedAttention2DTiledSpec: + """The catalog spec for one (dtype, head_size, block_size, QPK) object.""" + geom = runtime_layout_geometry(head_size, block_size, arch=arch) + if geom is None: + raise ValueError( + f"no runtime_layout geometry fits head_size={head_size} " + f"block_size={block_size} on {arch}" + ) + num_warps, tile_size = geom + return UnifiedAttention2DTiledSpec( + head_size=head_size, + block_size=block_size, + num_query_heads=num_queries_per_kv, + num_kv_heads=1, + dtype=dtype, + use_sinks=use_sinks, + sliding_window=0, + has_softcap=False, + num_warps=num_warps, + tile_size=tile_size, + runtime_layout=True, + ) + + +def _supports_runtime_layout( + spec: UnifiedAttention2DTiledSpec, *, arch: str, use_d256_fast: bool +) -> Tuple[bool, str]: + if use_d256_fast: + return False, "runtime_layout is not supported by the gfx942 4-warp GQA builder" + reason = _runtime_layout_reject_reason(spec) + if reason is not None: + return False, reason + from ..common.attention_arch import ( + attention_lds_capacity_bytes, + validate_tiled_attention_arch, + ) + + arch_ok, arch_reason = validate_tiled_attention_arch(arch) + if not arch_ok: + return False, arch_reason + if spec.dtype not in ("fp16", "bf16"): + return False, f"runtime_layout supports fp16/bf16 (got {spec.dtype!r})" + if spec.head_size not in (64, 128, 256): + return ( + False, + f"runtime_layout head_size must be 64/128/256 (got {spec.head_size})", + ) + if spec.block_size not in (16, 32, 64): + return ( + False, + f"runtime_layout block_size must be 16/32/64 (got {spec.block_size})", + ) + qpk = spec.num_queries_per_kv + if not 1 <= qpk <= 16: + return False, f"runtime_layout needs 1<=num_queries_per_kv<=16 (got {qpk})" + if spec.num_warps not in (1, 2, 4, 8): + return False, f"runtime_layout num_warps must be 1/2/4/8 (got {spec.num_warps})" + t = spec.tile_size_eff + threads = spec.num_warps * 64 + if (t * spec.head_size) % (threads * 2) != 0: + return ( + False, + f"runtime_layout: tile {t}x{spec.head_size} is not a whole number of " + f"{threads}-lane async K/V copies", + ) + lds = runtime_layout_lds_bytes( + head_size=spec.head_size, tile_size=t, num_warps=spec.num_warps + ) + cap = attention_lds_capacity_bytes(arch) + if lds > cap: + return ( + False, + f"runtime_layout: estimated LDS {lds} B (num_warps={spec.num_warps}, " + f"T={t}, HD={spec.head_size}) exceeds the {arch} {cap} B LDS budget", ) + return True, "supported" def supports_tiled_2d( @@ -1412,6 +1666,21 @@ def build_unified_attention_2d_tiled( raise NotImplementedError( f"gfx942 tiled 2D kernel requires a 16x16x16 {_a_dt} MFMA atom on {arch}" ) + if spec.runtime_layout: + # The supports gate's LDS check, repeated so a direct build of an + # over-budget spec fails here (the C builder makes the same check). + _rtl_lds = runtime_layout_lds_bytes( + head_size=spec.head_size, + tile_size=spec.tile_size_eff, + num_warps=spec.num_warps, + ) + _rtl_cap = ArchTarget.from_gfx(arch).lds_capacity_bytes + if _rtl_lds > _rtl_cap: + raise ValueError( + f"runtime_layout: estimated LDS {_rtl_lds} B (num_warps={spec.num_warps}, " + f"T={spec.tile_size_eff}, HD={spec.head_size}) exceeds the {arch} " + f"{_rtl_cap} B LDS budget" + ) HD = spec.head_size T = spec.tile_size_eff @@ -1629,6 +1898,13 @@ def build_unified_attention_2d_tiled( if spec.emit_lse else None ) + RTL = spec.runtime_layout + # The window code paths are compiled whenever a window may be active: a + # compile-time window, or always in runtime-layout mode (window kernarg). + SW_ACTIVE = SLIDING_WINDOW > 0 or RTL + if RTL: + # Appended runtime-layout kernargs (ABI order: RUNTIME_LAYOUT_EXTRA_ARGS). + rtl_p = declare_runtime_layout_params(b) if spec.use_q_major_grid: q_block_global_idx = b.block_id_x() @@ -1650,25 +1926,152 @@ def build_unified_attention_2d_tiled( wave_row_base = b.mul(wave_id, b.const_i32(BLOCK_M_PER_WARP)) # ---------------- seq lookup ---------------- - seq_idx = binary_search_seq_idx( - b, - cu_q, - q_block_global_idx, - num_seqs_p, - block_q=BLOCK_Q, - iterations=binary_search_seq_idx_trip_count(b, num_seqs_p), - ) - cu_q_start = b.global_load_i32(cu_q, seq_idx) - cu_q_stop = b.global_load_i32(cu_q, b.add(seq_idx, b.const_i32(1))) - cur_batch_q_len = b.sub(cu_q_stop, cu_q_start) - q_block_start_idx = b.add(b.div(cu_q_start, b.const_i32(BLOCK_Q)), seq_idx) - q_block_local_idx = b.sub(q_block_global_idx, q_block_start_idx) - seq_len = b.global_load_i32(seq_lens, seq_idx) - context_len = b.sub(seq_len, cur_batch_q_len) - - qb_start_pos = b.mul(q_block_local_idx, b.const_i32(BLOCK_Q)) - with b.scf_if(b.cmp_ge(qb_start_pos, cur_batch_q_len)): - b.ret() + if RTL: + # q-block mapping (DENSE when q_uniform_len > 0, else RAGGED) and the + # grid-stride loop ``qb = blockIdx.y; qb < total; qb += q_block_grid``. + # RAGGED finds a q-block's sequence by binary search over the offsets, + # which needs non-decreasing origins, off[b+1] - off[b] >= + # seq_lens_q[b] and off[B] the end of the last sequence's block. + # The loop and the "block has rows" branch are entered here and closed + # after the epilogue; both conditions are CTA-uniform, so the barriers + # inside are reached by every wave or by none. + rtl_q_len_u = rtl_p["q_uniform_len"] + rtl_dense = b.cmp_gt(rtl_q_len_u, b.const_i32(0)) + rtl_ragged = b.cmp_eq(rtl_q_len_u, b.const_i32(0)) + rtl_has_lq = b.cmp_ne(rtl_p["has_seq_lens_q"], b.const_i32(0)) + rtl_bps = b.select( + rtl_dense, + b.div(b.add(rtl_q_len_u, b.const_i32(BLOCK_Q - 1)), b.const_i32(BLOCK_Q)), + b.const_i32(1), + ) + rtl_off_end = b.masked_global_load( + cu_q, num_seqs_p, rtl_ragged, b.const_i32(0), dtype=I32, align=4 + ) + rtl_total_q_blocks = b.select( + rtl_dense, + b.mul(num_seqs_p, rtl_bps), + b.add(b.div(rtl_off_end, b.const_i32(BLOCK_Q)), num_seqs_p), + ) + rtl_qb_loop = b.scf_for( + q_block_global_idx, + rtl_total_q_blocks, + rtl_p["q_block_grid"], + iv_name="rtl_qb", + ) + q_block_global_idx = rtl_qb_loop.__enter__() + # DENSE maps q-blocks to sequences arithmetically, so its search runs + # no iteration and never dereferences ``query_start_len_ptr``. + seq_idx_ragged = binary_search_seq_idx( + b, + cu_q, + q_block_global_idx, + num_seqs_p, + block_q=BLOCK_Q, + iterations=b.select( + rtl_dense, + b.const_i32(0), + binary_search_seq_idx_trip_count(b, num_seqs_p), + ), + ) + seq_idx_dense = b.div(q_block_global_idx, rtl_bps) + seq_idx = b.select(rtl_dense, seq_idx_dense, seq_idx_ragged) + # A q-block before the first origin (qb < off[0] / BLOCK_Q) finds no + # sequence (-1): it reads sequence 0's entries and writes no row. Its + # start position is negative, so its row count is INT32_MIN, below it. + rtl_seq_ok = b.cmp_ge(seq_idx, b.const_i32(0)) + seq_idx = b.smax(seq_idx, b.const_i32(0)) + rtl_off_start = b.masked_global_load( + cu_q, seq_idx, rtl_ragged, b.const_i32(0), dtype=I32, align=4 + ) + rtl_off_stop = b.masked_global_load( + cu_q, + b.add(seq_idx, b.const_i32(1)), + rtl_ragged, + b.const_i32(0), + dtype=I32, + align=4, + ) + rtl_lq = b.masked_global_load( + rtl_p["seq_lens_q_ptr"], + seq_idx, + rtl_has_lq, + b.const_i32(0), + dtype=I32, + align=4, + ) + # ``rtl_owned``: the rows this sequence's block spans in Q/O (DENSE: L; + # RAGGED: off[seq+1] - off[seq]). ``cur_batch_q_len``: the live rows, + # seq_lens_q[seq] when given (never past the block). ``rtl_q_rows``: + # the rows the kernel writes. A dense Q writes its padding rows (owned + # rows past the live ones) as zeros; a ragged Q writes only its live + # rows, since rows of the block past seq_lens_q belong to no sequence + # and the last one's may lie past the end of O. + rtl_owned = b.select(rtl_dense, rtl_q_len_u, b.sub(rtl_off_stop, rtl_off_start)) + cur_batch_q_len = b.select(rtl_has_lq, b.smin(rtl_owned, rtl_lq), rtl_owned) + rtl_q_rows = b.select(rtl_dense, rtl_q_len_u, cur_batch_q_len) + rtl_q_rows = b.select(rtl_seq_ok, rtl_q_rows, b.const_i32(-(2**31))) + # Sequence base index ``sb`` of the Q/O addressing. + rtl_seq_base_idx = b.select(rtl_dense, seq_idx, rtl_off_start) + q_block_start_idx = b.select( + rtl_dense, + b.mul(seq_idx, rtl_bps), + b.add(b.div(rtl_off_start, b.const_i32(BLOCK_Q)), seq_idx), + ) + q_block_local_idx = b.sub(q_block_global_idx, q_block_start_idx) + seq_len = b.global_load_i32(seq_lens, seq_idx) + # A length past the table row would walk the page-table read off its end: + # bound it by the row's width (block_table_width * block_size). The width + # is its own argument: block_table_stride is the row-to-row step, which a + # batch of one has no use for. + rtl_bt_cap = b.mul(rtl_p["block_table_width"], b.const_i32(BS)) + seq_len = b.select(b.cmp_ult(seq_len, rtl_bt_cap), seq_len, rtl_bt_cap) + context_len = b.sub(seq_len, cur_batch_q_len) + qb_start_pos = b.mul(q_block_local_idx, b.const_i32(BLOCK_Q)) + rtl_rows_if = b.scf_if(b.cmp_lt(qb_start_pos, rtl_q_rows)) + rtl_rows_if.__enter__() + # 64-bit per-sequence Q/O bases; within-sequence offsets stay i32. + _rtl_sb64 = b.zext(rtl_seq_base_idx, I64) + _q_src = b.global_ptr_add( + query, + b.shl(b.mul(_rtl_sb64, b.zext(rtl_p["q_seq_stride"], I64)), b.const_i64(1)), + ) + _o_dst = b.global_ptr_add( + output, + b.shl(b.mul(_rtl_sb64, b.zext(rtl_p["o_seq_stride"], I64)), b.const_i64(1)), + ) + rtl_q_desc = DynamicTensorDescriptor.create( + "rtl_q", + coord_names=("token", "head", "dim"), + strides=[rtl_p["q_tok_stride"], rtl_p["q_head_stride"], b.const_i32(1)], + ) + rtl_o_desc = DynamicTensorDescriptor.create( + "rtl_o", + coord_names=("token", "head", "dim"), + strides=[rtl_p["o_tok_stride"], rtl_p["o_head_stride"], b.const_i32(1)], + ) + cu_q_start = None # RAGGED/DENSE base is folded into _q_src/_o_dst + else: + seq_idx = binary_search_seq_idx( + b, + cu_q, + q_block_global_idx, + num_seqs_p, + block_q=BLOCK_Q, + iterations=binary_search_seq_idx_trip_count(b, num_seqs_p), + ) + cu_q_start = b.global_load_i32(cu_q, seq_idx) + cu_q_stop = b.global_load_i32(cu_q, b.add(seq_idx, b.const_i32(1))) + cur_batch_q_len = b.sub(cu_q_stop, cu_q_start) + q_block_start_idx = b.add(b.div(cu_q_start, b.const_i32(BLOCK_Q)), seq_idx) + q_block_local_idx = b.sub(q_block_global_idx, q_block_start_idx) + seq_len = b.global_load_i32(seq_lens, seq_idx) + context_len = b.sub(seq_len, cur_batch_q_len) + + qb_start_pos = b.mul(q_block_local_idx, b.const_i32(BLOCK_Q)) + with b.scf_if(b.cmp_ge(qb_start_pos, cur_batch_q_len)): + b.ret() + _q_src = query + _o_dst = output # ---------------- LDS layout ---------------- # Q is loaded once. K and V are double-buffered [2, T, HD] in natural @@ -2242,13 +2645,18 @@ def _v_load1(v_buf: Value, v_row: Value, v_n_col: Value) -> Value: ) q_pos_safe = b.select(qmask_t, q_pos_t, b.const_i32(0)) qh_safe = b.select(qmask_t, qh_t, b.const_i32(0)) - q_off_base, _ = q_desc.offset( - b, - token=b.add(cu_q_start, q_pos_safe), - head=qh_safe, - dim=b.const_i32(0), - ) - v8 = b.global_load_vN(query, b.add(q_off_base, Q_col), dtype, 8, align=16) + if RTL: + q_off_base, _ = rtl_q_desc.offset( + b, token=q_pos_safe, head=qh_safe, dim=b.const_i32(0) + ) + else: + q_off_base, _ = q_desc.offset( + b, + token=b.add(cu_q_start, q_pos_safe), + head=qh_safe, + dim=b.const_i32(0), + ) + v8 = b.global_load_vN(_q_src, b.add(q_off_base, Q_col), dtype, 8, align=16) # When Q is aliased to K_lds (single shared scratch), the store # goes through ``[buf, row_in_buf, col]`` indexing of the K_lds # 3D buffer. ``buf = Q_row // T`` selects which K_lds slot, @@ -2281,8 +2689,13 @@ def _v_load1(v_buf: Value, v_row: Value, v_n_col: Value) -> Value: msp_raw = b.add(b.add(context_len, qb_start_pos), b.const_i32(bm1_div_nqk + 1)) max_seq_prefix_len = b.select(b.cmp_lt(msp_raw, seq_len), msp_raw, seq_len) num_tiles = b.div(b.add(max_seq_prefix_len, b.const_i32(T - 1)), b.const_i32(T)) + if RTL: + # A q-block of padding rows only reads no key: its rows store zeros. + num_tiles = b.select( + b.cmp_lt(qb_start_pos, cur_batch_q_len), num_tiles, b.const_i32(0) + ) - if SLIDING_WINDOW > 0: + if SW_ACTIVE: qpos_hi_raw = b.add(qb_start_pos, b.const_i32(bm1_div_nqk)) cur_q_minus1 = b.sub(cur_batch_q_len, b.const_i32(1)) qpos_hi = b.select( @@ -2408,6 +2821,12 @@ def _pack_p_a32(p_regs0_f32: list[Value], p_regs1_f32: list[Value]) -> Value: hi.append(_select_lane_rg(v0_x16, v0_x32, v1_x48, v1)) return b.vec_pack([b.cast_f32_to(v, dtype) for v in (lo + hi)], dtype) + def _sink_logit(qh, qh_in): + # Query head ``qh``'s sink logit in f32 (see ``sink_logit``). + return sink_logit( + b, sinks, dtype, qh, qh_in, rtl_p["sink_is_f32"] if RTL else None + ) + if USE_SINKS: m_inits = [] if USE_MFMA_32X32 and TRANSPOSED_QK_32X32 and TRANSPOSED_SCALAR_STATE: @@ -2416,8 +2835,7 @@ def _pack_p_a32(p_regs0_f32: list[Value], p_regs1_f32: list[Value]) -> Value: b.mul(kv_head_idx, b.const_i32(NQK)), b.mod(row, b.const_i32(NQK)) ) qh_in = b.cmp_lt(qh, num_qh_p) - sink_h = b.global_load(sinks, qh, dtype, align=2) - sink_f = b.fmul(b.cast_to_f32(sink_h), rcp_ln2) + sink_f = b.fmul(_sink_logit(qh, qh_in), rcp_ln2) m_inits.append(b.select(qh_in, sink_f, neg_inf)) else: for r in range(REGS_PER_LANE): @@ -2426,8 +2844,7 @@ def _pack_p_a32(p_regs0_f32: list[Value], p_regs1_f32: list[Value]) -> Value: b.mul(kv_head_idx, b.const_i32(NQK)), b.mod(row, b.const_i32(NQK)) ) qh_in = b.cmp_lt(qh, num_qh_p) - sink_h = b.global_load(sinks, qh, dtype, align=2) - sink_f = b.fmul(b.cast_to_f32(sink_h), rcp_ln2) + sink_f = b.fmul(_sink_logit(qh, qh_in), rcp_ln2) m_inits.append(b.select(qh_in, sink_f, neg_inf)) else: m_inits = [neg_inf for _ in range(SOFTMAX_STATE_SLOTS)] @@ -2692,7 +3109,7 @@ def _fast_paged_kv_voff(call: int, block0: Value, block1: Value): block_b = b.shl(physical, b.const_i32(15)) # 32 * 8 * 64 * 2 (i32) return None, b.add(block_b, within) - else: + elif not RTL: _kv_base = DynamicTensorDescriptor.create( "paged_kv_bytes", coord_names=("physical_block", "token", "kv_head", "dim"), @@ -2797,6 +3214,69 @@ def _page_voff(call: int, kv_head_b: Value) -> Value: dim = b.mod(half, b.const_i32(HD)) return _kv_page_off(token, dim, kv_head_b) + if RTL: + # Runtime-stride paged K/V (bytes): K and V share all strides. A tile + # never crosses a cache block (``tile_size`` divides ``block_size``), so, + # as on the i64 path above, each tile load reads its page id once and + # builds one buffer resource at the page's 64-bit base, with range + # ``kv_block_span_bytes``. The within-page voffset stays i32 and masked + # lanes (token >= seq_len) read nothing. + rtl_kv_page_stride_b = b.shl( + b.sext(rtl_p["kv_block_stride"], I64), b.const_i64(1) + ) + rtl_kv_desc = DynamicTensorDescriptor.create( + "rtl_kv_page_bytes", + coord_names=("token", "kv_head", "dim"), + strides=[ + b.shl(rtl_p["kv_tok_stride"], b.const_i32(1)), + b.shl(rtl_p["kv_head_stride"], b.const_i32(1)), + b.const_i32(2), + ], + ) + rtl_kv_oob = b.const_i32(_RTL_KV_OOB_VOFF) + # Block-table reads go through a buffer resource so a masked entry + # (position >= ceil(seq_len / BS)) is an out-of-range voffset: it + # returns physical block 0 without touching memory. K pages through + # ``block_tables_ptr``, V through ``block_tables_v_ptr``; both tables + # share ``block_table_stride``. + rtl_bt_rsrc = b.buffer_rsrc(block_tables, big_bytes) + rtl_bt_v_rsrc = b.buffer_rsrc(rtl_p["block_tables_v_ptr"], big_bytes) + + def _rtl_kv_block( + cache: Value, bt_rsrc: Value, kv_tile_idx: Value + ) -> Tuple[Value, Value, Value]: + """(first token, its offset within the cache block, page resource).""" + tok0 = b.mul(kv_tile_idx, b.const_i32(T)) + lblk = b.div(tok0, b.const_i32(BS)) + lblk_tok = b.mul(lblk, b.const_i32(BS)) + blk_ok = b.cmp_lt(lblk_tok, seq_len) + bt_voff = b.select( + blk_ok, b.shl(b.add(seq_base, lblk), b.const_i32(2)), rtl_kv_oob + ) + phys = b.buffer_load_vN(bt_rsrc, bt_voff, zero_soff, I32, 1) + phys = b.to_sgpr_u32(b.vec_extract(phys, 0)) + # A page id outside [0, num_kv_blocks) would address memory outside the + # cache: it reads as a masked page (block 0, zero-size resource). + phys_ok = b.cmp_ult(phys, rtl_p["num_kv_blocks"]) + phys = b.select(phys_ok, phys, b.const_i32(0)) + page = b.global_ptr_add(cache, b.mul(b.zext(phys, I64), rtl_kv_page_stride_b)) + rsrc = b.buffer_rsrc( + page, b.select(phys_ok, rtl_p["kv_block_span_bytes"], b.const_i32(0)) + ) + return tok0, b.sub(tok0, lblk_tok), rsrc + + def _rtl_kv_call(call: int, blk: Tuple[Value, Value, Value]) -> Tuple[Value, Value]: + """(page resource, voffset) of one async K/V call for this lane.""" + tok0, tok_in_blk0, rsrc = blk + linear_half = b.add(b.const_i32(call * KV_HALVES_PER_CALL), lane_half_base) + tok = b.div(linear_half, b.const_i32(HD)) + dim = b.mod(linear_half, b.const_i32(HD)) + within, _ = rtl_kv_desc.offset( + b, token=b.add(tok_in_blk0, tok), kv_head=kv_head_idx, dim=dim + ) + tok_ok = b.cmp_lt(b.add(tok0, tok), seq_len) + return rsrc, b.select(tok_ok, within, rtl_kv_oob) + def _issue_k_load_runtime(kv_tile_idx: Value, buf_idx: Value) -> None: """Issue async K loads for one tile into K_lds[buf_idx]. @@ -2818,12 +3298,16 @@ def _issue_k_load_runtime(kv_tile_idx: Value, buf_idx: Value) -> None: K_wave_base = b.smem_ptr_add(K_buf_base, wave_lds_offset_i64) if FAST_PAGED_KV_DESC: fast_block0, fast_block1 = _fast_paged_kv_blocks(kv_tile_idx) - if PAGE_RSRC_I64: + elif RTL: + rtl_blk = _rtl_kv_block(key, rtl_bt_rsrc, kv_tile_idx) + elif PAGE_RSRC_I64: page_ptrs, page_rsrcs, kv_head_b = _tile_pages(key, kv_tile_idx) for call in range(kv_calls_per_tile): k_rsrc = key_rsrc k_ptr = key - if FAST_PAGED_KV_DESC: + if RTL: + k_rsrc, voff = _rtl_kv_call(call, rtl_blk) + elif FAST_PAGED_KV_DESC: base_i64, voff = _fast_paged_kv_voff(call, fast_block0, fast_block1) if base_i64 is not None: # I64_KV_ADDR: per-block 64-bit base k_ptr = b.global_ptr_add(key, base_i64) @@ -2953,11 +3437,15 @@ def _issue_v_load_runtime(kv_tile_idx: Value, buf_idx: Value) -> None: V_wave_base = b.smem_ptr_add(V_lds_addr, v_wave_lds_offset_i64) if FAST_PAGED_KV_DESC: fast_block0, fast_block1 = _fast_paged_kv_blocks(kv_tile_idx) - if PAGE_RSRC_I64: + elif RTL: + rtl_blk = _rtl_kv_block(value, rtl_bt_v_rsrc, kv_tile_idx) + elif PAGE_RSRC_I64: _, page_rsrcs, kv_head_b = _tile_pages(value, kv_tile_idx) for call in range(kv_calls_per_tile): v_rsrc = value_rsrc - if FAST_PAGED_KV_DESC: + if RTL: + v_rsrc, voff = _rtl_kv_call(call, rtl_blk) + elif FAST_PAGED_KV_DESC: base_i64, voff = _fast_paged_kv_voff(call, fast_block0, fast_block1) if base_i64 is not None: v_rsrc = b.buffer_rsrc( @@ -4891,7 +5379,7 @@ def _kslot(group_idx: int) -> int: causal_ok = b.cmp_le(col_abs, causal_lim) in_prefix = b.cmp_lt(col_abs, max_seq_prefix_len) m_ok = b.land(b.land(row_ok, causal_ok), in_prefix) - if SLIDING_WINDOW > 0: + if SW_ACTIVE: dist = b.sub(causal_lim, col_abs) m_ok = b.land(m_ok, b.cmp_lt(dist, sw_const)) s_raw = b.vec_extract(S_n[atom][n], in_atom) @@ -5874,8 +6362,11 @@ def _store_row_lse(row: Value, slot: int, writer: Value) -> None: b.mul(kv_head_idx, b.const_i32(NQK)), b.mod(OUT_ROW_BASE, b.const_i32(NQK)), ) + # Runtime layout stores every row it owns: live rows get their attention, + # and a dense Q's padding rows (past seq_lens_q) were masked like keyless + # rows, so they store zeros. A ragged Q owns only its live rows. _op_mask_inner = b.land( - b.cmp_lt(op_pos, cur_batch_q_len), + b.cmp_lt(op_pos, rtl_q_rows if RTL else cur_batch_q_len), b.cmp_lt(op_qh, num_qh_p), ) op_mask = ( @@ -5883,12 +6374,15 @@ def _store_row_lse(row: Value, slot: int, writer: Value) -> None: if VALID_ROWS < BLOCK_M else _op_mask_inner ) - out_base, _ = q_desc.offset( - b, - token=b.add(cu_q_start, op_pos), - head=op_qh, - dim=b.const_i32(0), - ) + if RTL: + out_base, _ = rtl_o_desc.offset(b, token=op_pos, head=op_qh, dim=b.const_i32(0)) + else: + out_base, _ = q_desc.offset( + b, + token=b.add(cu_q_start, op_pos), + head=op_qh, + dim=b.const_i32(0), + ) for stripe in range(OUT_STRIPES): n_start = stripe * N_TILES_PER_STRIPE @@ -5921,7 +6415,7 @@ def _store_row_lse(row: Value, slot: int, writer: Value) -> None: out_col = b.add(b.const_i32(stripe * OUT_STRIPE_COLS), col_in_stripe) with b.scf_if(op_mask): b.global_store_vN( - output, b.add(out_base, out_col), v8h, OUT_VEC, align=16 + _o_dst, b.add(out_base, out_col), v8h, OUT_VEC, align=16 ) # ---- stage 3: sync so the next stripe can overwrite Acc_lds ---- if stripe + 1 < OUT_STRIPES: @@ -5938,6 +6432,13 @@ def _store_row_lse(row: Value, slot: int, writer: Value) -> None: writer16 = b.cmp_eq(lane_col, b.const_i32(0)) for r in range(SOFTMAX_STATE_SLOTS): _store_row_lse(b.add(wave_row_base, _in_warp_row(r)), r, writer16) + if RTL: + # Close the "block has rows" branch, then fence LDS reuse before the + # next grid-stride q-block (its Q staging and K/V DMA rewrite the slabs + # this q-block's epilogue just read), then close the q-block loop. + rtl_rows_if.__exit__(None, None, None) + b.sync() + rtl_qb_loop.__exit__(None, None, None) return b.kernel @@ -6295,6 +6796,12 @@ def build_gfx942_4warp_gqa( # This body has no LSE store; refuse rather than build a kernel that # carries the "lse" name but takes no lse_ptr and writes nothing. raise NotImplementedError(_GFX942_4WARP_LSE_REFUSAL) + if spec.runtime_layout: + # The 4-warp body reads the fixed-layout kernargs only; refuse rather than + # build an "_rtl" kernel that ignores the runtime layout. + raise NotImplementedError( + "runtime_layout is not supported by the gfx942 4-warp GQA builder" + ) if spec.use_i64_kv_addr: # K/V are i32 element offsets. Refuse rather than emit an i32 kernel # under a spec that claims i64; dispatch keeps the flag off through @@ -6911,6 +7418,8 @@ def _supports_tiled_2d_spec( ok, reason = check_head_counts(spec.num_query_heads, spec.num_kv_heads) if not ok: return False, reason + if spec.runtime_layout: + return _supports_runtime_layout(spec, arch=arch, use_d256_fast=use_d256_fast) use_fp8 = spec.kv_storage_dtype is not None return supports_tiled_2d( head_size=spec.head_size, diff --git a/dnn-providers/hip-kernel-provider/rocke/library/kernels/gfx950/attention_tiled_2d.py b/dnn-providers/hip-kernel-provider/rocke/library/kernels/gfx950/attention_tiled_2d.py index 0751de19afc6..9990e9aff4e9 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/kernels/gfx950/attention_tiled_2d.py +++ b/dnn-providers/hip-kernel-provider/rocke/library/kernels/gfx950/attention_tiled_2d.py @@ -55,6 +55,11 @@ ) from kernels.common._spec_checks import require_bool from kernels.common.attention_mask_type import band_mask_type +from kernels.common._attention_runtime_layout import ( + RUNTIME_LAYOUT_EXTRA_ARGS, + declare_runtime_layout_params, + sink_logit, +) from rocke.core.ir import ( BF16, @@ -62,6 +67,7 @@ F16, F32, FP8E4M3, + I16, I32, I64, IRBuilder, @@ -537,6 +543,24 @@ class UnifiedAttention2DTiledSpec: # [total_q, num_query_heads, 1] through a trailing ``lse_ptr`` argument. # Off by default; off emits no new IR, so shipped kernels are unchanged. emit_lse: bool = field(default=False, kw_only=True) + # Runtime-layout mode (hipDNN ``AttentionPagedUnified`` / vLLM KV-cache view). + # The head counts, the window and the batch's search trip count are already + # kernargs (``RUNTIME_KERNARG_FIELDS``, ``RUNTIME_SEARCH_ITERS``). Runtime + # layout adds the Q/O/KV strides, a dense or ragged Q and a real paged KV + # cache as appended kernel arguments (see ``_RTL_PARAMS``), so one compiled + # object serves them all. ``sliding_window`` must be 0 (the window mask is + # always compiled, with the kernarg as its size: ``d - k < window`` keeps key + # k, so a kernarg of 0 or below keeps none, and "no window" is a window wider + # than any sequence, which the caller passes) and every CTA walks the + # q-block grid with a grid-stride loop. K pages through + # ``block_tables_ptr`` and V through ``block_tables_v_ptr`` (the same + # pointer, or a second table with the same row stride). The KV block term is + # addressed in i64 through one buffer resource per page. A dense Q's rows + # past seq_lens_q (padding) and rows with no visible key store zeros; a + # ragged Q stores only its live rows (the first seq_lens_q rows of its + # block). + # Default False leaves the kernel unchanged. + runtime_layout: bool = False # lse_layout: "token_major" is the [total_q, num_query_heads, 1] order above. # "head_major" stores each sequence as [num_query_heads, q_len] from element # cu_q_start * num_query_heads, i.e. [B, Hq, S, 1] for equal-length @@ -545,6 +569,7 @@ class UnifiedAttention2DTiledSpec: def __post_init__(self): require_bool("emit_lse", self.emit_lse) + require_bool("runtime_layout", self.runtime_layout) if self.lse_layout not in UNIFIED_LSE_LAYOUTS: raise ValueError( f"lse_layout must be one of {UNIFIED_LSE_LAYOUTS}, " @@ -572,6 +597,10 @@ def __post_init__(self): "right_bound != 0 is incompatible with use_alibi / use_qq_bias " "(their offsets are defined on the causal diagonal)" ) + if self.runtime_layout: + reason = _runtime_layout_reject_reason(self) + if reason is not None: + raise ValueError(reason) if self.num_warps not in (1, 2, 4, 8): raise ValueError( f"num_warps must be 1, 2, 4, or 8 (got {self.num_warps}). " @@ -1115,9 +1144,145 @@ def kernel_name(self) -> str: if self.emit_lse else "" ), + "rtl" if self.runtime_layout else "", ) +# Kernel arguments appended after the fixed ones and the runtime shape kernargs +# (``RUNTIME_KERNARG_FIELDS``: num_query_heads, num_kv_heads, sliding_window) +# when ``runtime_layout`` is set, in order: the names of +# ``RUNTIME_LAYOUT_EXTRA_ARGS`` (kernels/common/_attention_runtime_layout.py), +# shared with the gfx942 builder. +_RTL_PARAMS = tuple(name for name, _ in RUNTIME_LAYOUT_EXTRA_ARGS) + + +def _runtime_layout_wave_size() -> int: + """Lanes per wave of the runtime-layout target, from the exact arch.""" + from rocke.core.arch import ArchTarget + + return ArchTarget.from_gfx("gfx950").wave_size + + +def _runtime_layout_reject_reason(spec: "UnifiedAttention2DTiledSpec") -> Optional[str]: + """Why ``spec`` cannot use ``runtime_layout`` (``None`` when it can). + + Runtime-layout mode runs only the default 16x16x32 pipeline with one + paged block per KV tile; every flag that bakes a layout, a schedule built + around a different pipeline, or a feature outside the hipDNN paged SDPA + contract is refused. + """ + ok, heads_reason = check_head_counts(spec.num_query_heads, spec.num_kv_heads) + if not ok: + return heads_reason + if spec.sliding_window != 0: + return ( + "runtime_layout takes the sliding window as a kernarg; " + "spec sliding_window must be 0" + ) + features = { + "has_softcap": spec.has_softcap, + "use_alibi": spec.use_alibi, + "use_qq_bias": spec.use_qq_bias, + "use_additive_bias": spec.use_additive_bias, + "kv_storage_dtype (fp8 KV)": spec.kv_storage_dtype is not None, + "use_fp8_mfma_qk": spec.use_fp8_mfma_qk, + "use_fp8_mfma_pv": spec.use_fp8_mfma_pv, + "causal_top_left": spec.causal_top_left, + "right_bound != 0": spec.right_bound != 0, + "emit_lse": spec.emit_lse, + } + for feature, on in features.items(): + if on: + return f"runtime_layout does not support {feature}" + pipeline_flags = { + "use_mfma_32x32": spec.use_mfma_32x32, + "use_transposed_qk_32x32": spec.use_transposed_qk_32x32, + "use_fast_paged_kv_desc": spec.use_fast_paged_kv_desc, + "use_i64_kv_addr (always 64-bit in runtime_layout)": spec.use_i64_kv_addr, + "use_register_pv": spec.use_register_pv, + "use_v_double_buffer": spec.use_v_double_buffer, + "kv_ring_depth != 2": spec.kv_ring_depth != 2, + "use_staggered_iter_wait": spec.use_staggered_iter_wait, + "use_early_v_schedule": spec.use_early_v_schedule, + "use_k_single_buffer": spec.use_k_single_buffer, + "use_grouped_kv2_softmax": spec.use_grouped_kv2_softmax, + "use_q_reread": spec.use_q_reread, + "use_q_direct_reg": spec.use_q_direct_reg, + "use_kq_lds_pad": spec.use_kq_lds_pad, + "use_mask_phase_split": spec.use_mask_phase_split, + "use_agpr_alloc_zero": spec.use_agpr_alloc_zero, + "use_sched_barrier": spec.use_sched_barrier, + "use_softmax_mfma_interleave": spec.use_softmax_mfma_interleave, + # The reversal maps over total_q // BLOCK_Q + num_seqs blocks, not the + # runtime_layout grid-stride range. + "use_qblock_reverse": spec.use_qblock_reverse, + } + for flag, on in pipeline_flags.items(): + if on: + return ( + "runtime_layout runs the default 16x16x32 pipeline; " + f"{flag} is not supported" + ) + if spec.block_m_per_warp != 16: + return "runtime_layout requires block_m_per_warp=16" + if spec.tile_size is not None and spec.tile_size != spec.block_size: + return ( + "runtime_layout requires tile_size == block_size " + "(one paged block per KV tile)" + ) + # Checked before the DMA divisibility below, which divides by it. + if spec.num_warps not in (1, 2, 4, 8): + return ( + "runtime_layout requires num_warps in {1, 2, 4, 8} " + f"(got {spec.num_warps})" + ) + threads = spec.num_warps * _runtime_layout_wave_size() + if (spec.block_size * spec.head_size) % (threads * 8) != 0: + return ( + f"runtime_layout: block_size*head_size={spec.block_size * spec.head_size} " + f"must be a multiple of num_warps*512={threads * 8} " + "(whole async-DMA calls per tile)" + ) + return None + + +def runtime_layout_num_warps(head_size: int, block_size: int) -> int: + """The fixed ``num_warps`` of the runtime-layout catalog geometry. + + Four warps (BLOCK_M=64) whenever one tile holds whole 4-warp async-DMA + calls; the single smaller tile (head_size=64, block_size=16) uses two. + """ + for nw in (4, 2, 1): + if (head_size * block_size) % (nw * _runtime_layout_wave_size() * 8) == 0: + return nw + raise ValueError( + f"no runtime_layout geometry for head_size={head_size}, block_size={block_size}" + ) + + +def runtime_layout_catalog_spec( + *, + dtype: str, + head_size: int, + block_size: int, + num_queries_per_kv: int, + use_sinks: bool = False, +) -> "UnifiedAttention2DTiledSpec": + """The runtime-layout spec the hipDNN catalog compiles for one combination.""" + return UnifiedAttention2DTiledSpec( + head_size=head_size, + block_size=block_size, + num_query_heads=num_queries_per_kv, + num_kv_heads=1, + dtype=dtype, + use_sinks=use_sinks, + sliding_window=0, + has_softcap=False, + num_warps=runtime_layout_num_warps(head_size, block_size), + runtime_layout=True, + ) + + def supports_tiled_2d( *, head_size: int, @@ -1305,6 +1470,14 @@ def build_unified_attention_2d_tiled( VALID_ROWS = BLOCK_Q * NQK NUM_KV = spec.num_kv_heads SLIDING_WINDOW = spec.sliding_window + # Runtime-layout mode (see the spec field): runtime Hq / window / strides, + # dense-or-ragged q-block mapping and a grid-stride q-block loop. The spec + # already refused every incompatible flag, so the rest of the builder only + # sees the default 16x16x32 pipeline with one paged block per tile. + RTL = spec.runtime_layout + # The window code paths are compiled whenever a window may be active: a + # compile-time window, or always in runtime-layout mode (window kernarg). + SW_ACTIVE = SLIDING_WINDOW > 0 or RTL USE_SOFTCAP = spec.has_softcap USE_SINKS = spec.use_sinks USE_ALIBI = spec.use_alibi @@ -1461,6 +1634,7 @@ def build_unified_attention_2d_tiled( if spec.emit_lse else None ) + rtl = declare_runtime_layout_params(b) if RTL else {} kv_head_idx = b.block_id_x() q_block_global_idx = b.block_id_y() @@ -1485,24 +1659,129 @@ def build_unified_attention_2d_tiled( wave_row_base = b.mul(wave_id, b.const_i32(BLOCK_M_PER_WARP)) # ---------------- seq lookup ---------------- - seq_idx = binary_search_seq_idx( - b, - cu_q, - q_block_global_idx, - num_seqs_p, - block_q=BLOCK_Q, - iterations=binary_search_seq_idx_trip_count(b, num_seqs_p), - ) - cu_q_start = b.global_load_i32(cu_q, seq_idx) - cu_q_stop = b.global_load_i32(cu_q, b.add(seq_idx, b.const_i32(1))) - cur_batch_q_len = b.sub(cu_q_stop, cu_q_start) - q_block_start_idx = b.add(b.div(cu_q_start, b.const_i32(BLOCK_Q)), seq_idx) - q_block_local_idx = b.sub(q_block_global_idx, q_block_start_idx) - seq_len = b.global_load_i32(seq_lens, seq_idx) - if spec.causal_top_left: - context_len = b.const_i32(0) - else: + if RTL: + # DENSE (q_uniform_len = L > 0): bps = ceil(L / BLOCK_Q) q-blocks per + # sequence, seq = qb / bps, sequence base token sb = seq. RAGGED + # (L == 0): ``query_start_len_ptr`` holds token offsets off[0..B]; + # seq comes from the q-block binary search, sb = off[seq]. The search + # needs non-decreasing origins, off[b+1] - off[b] >= seq_lens_q[b] + # and off[B] the end of the last sequence's block. DENSE mode never + # dereferences the offsets beyond masked index-0 reads. + rtl_zero = b.const_i32(0) + rtl_one = b.const_i32(1) + rtl_bq = b.const_i32(BLOCK_Q) + q_uniform_len = rtl["q_uniform_len"] + rtl_dense = b.cmp_gt(q_uniform_len, rtl_zero) + rtl_ragged = b.cmp_le(q_uniform_len, rtl_zero) + rtl_has_slq = b.cmp_ne(rtl["has_seq_lens_q"], rtl_zero) + rtl_bps = b.select( + rtl_dense, + b.div(b.add(q_uniform_len, b.const_i32(BLOCK_Q - 1)), rtl_bq), + rtl_one, + ) + rtl_off_total = b.masked_global_load( + cu_q, num_seqs_p, rtl_ragged, rtl_zero, dtype=I32, align=4 + ) + total_q_blocks = b.select( + rtl_dense, + b.mul(num_seqs_p, rtl_bps), + b.add(b.div(rtl_off_total, rtl_bq), num_seqs_p), + ) + # Grid-stride q-block loop: the body below (through the epilogue) runs + # once per q-block ``blockIdx.y + k * q_block_grid``. Entered here and + # closed after the epilogue so the long body keeps its indentation. + rtl_qb_loop = b.scf_for( + q_block_global_idx, total_q_blocks, rtl["q_block_grid"], iv_name="rtl_qb" + ) + q_block_global_idx = rtl_qb_loop.__enter__() + # DENSE maps q-blocks to sequences arithmetically, so its search runs + # no iteration and never dereferences ``query_start_len_ptr``. + seq_idx_ragged = binary_search_seq_idx( + b, + cu_q, + q_block_global_idx, + num_seqs_p, + block_q=BLOCK_Q, + iterations=b.select( + rtl_dense, rtl_zero, binary_search_seq_idx_trip_count(b, num_seqs_p) + ), + ) + seq_idx = b.select( + rtl_dense, b.div(q_block_global_idx, rtl_bps), seq_idx_ragged + ) + # A q-block before the first origin (qb < off[0] / BLOCK_Q) finds no + # sequence (-1): it reads sequence 0's entries and writes no row. Its + # start position is negative, so its row count is INT32_MIN, below it. + rtl_seq_ok = b.cmp_ge(seq_idx, rtl_zero) + seq_idx = b.smax(seq_idx, rtl_zero) + rtl_off_start = b.masked_global_load( + cu_q, seq_idx, rtl_ragged, rtl_zero, dtype=I32, align=4 + ) + rtl_off_stop = b.masked_global_load( + cu_q, b.add(seq_idx, rtl_one), rtl_ragged, rtl_zero, dtype=I32, align=4 + ) + rtl_slq = b.masked_global_load( + rtl["seq_lens_q_ptr"], seq_idx, rtl_has_slq, rtl_zero, dtype=I32, align=4 + ) + # ``rtl_owned``: the rows this sequence's block spans in Q/O (DENSE: L; + # RAGGED: off[seq+1] - off[seq]). ``cur_batch_q_len``: the live rows, + # seq_lens_q[seq] when given (never past the block). ``rtl_q_rows``: + # the rows the kernel writes. A dense Q writes its padding rows (owned + # rows past the live ones) as zeros; a ragged Q writes only its live + # rows, since rows of the block past seq_lens_q belong to no sequence + # and the last one's may lie past the end of O. + rtl_owned = b.select( + rtl_dense, q_uniform_len, b.sub(rtl_off_stop, rtl_off_start) + ) + cur_batch_q_len = b.select(rtl_has_slq, b.smin(rtl_owned, rtl_slq), rtl_owned) + rtl_q_rows = b.select(rtl_dense, q_uniform_len, cur_batch_q_len) + rtl_q_rows = b.select(rtl_seq_ok, rtl_q_rows, b.const_i32(-(2**31))) + q_block_start_idx = b.select( + rtl_dense, + b.mul(seq_idx, rtl_bps), + b.add(b.div(rtl_off_start, rtl_bq), seq_idx), + ) + q_block_local_idx = b.sub(q_block_global_idx, q_block_start_idx) + seq_len = b.global_load_i32(seq_lens, seq_idx) + # A length past the table row would walk the page-table read off its end: + # bound it by the row's width (block_table_width * block_size). The width + # is its own argument: block_table_stride is the row-to-row step, which a + # batch of one has no use for. + rtl_bt_cap = b.mul(rtl["block_table_width"], b.const_i32(BS)) + seq_len = b.select(b.cmp_ult(seq_len, rtl_bt_cap), seq_len, rtl_bt_cap) context_len = b.sub(seq_len, cur_batch_q_len) + # Per-sequence Q/O base terms in i64 (ragged offsets times the + # multiplier can pass 2^31 elements); within-sequence terms stay i32. + rtl_sb64 = b.zext(b.select(rtl_dense, seq_idx, rtl_off_start), I64) + rtl_elem_bytes = b.const_i64(2) + rtl_q_ptr = b.global_ptr_add( + query, + b.mul(b.mul(rtl_sb64, b.zext(rtl["q_seq_stride"], I64)), rtl_elem_bytes), + ) + rtl_o_ptr = b.global_ptr_add( + output, + b.mul(b.mul(rtl_sb64, b.zext(rtl["o_seq_stride"], I64)), rtl_elem_bytes), + ) + cu_q_start = None + else: + seq_idx = binary_search_seq_idx( + b, + cu_q, + q_block_global_idx, + num_seqs_p, + block_q=BLOCK_Q, + iterations=binary_search_seq_idx_trip_count(b, num_seqs_p), + ) + cu_q_start = b.global_load_i32(cu_q, seq_idx) + cu_q_stop = b.global_load_i32(cu_q, b.add(seq_idx, b.const_i32(1))) + cur_batch_q_len = b.sub(cu_q_stop, cu_q_start) + q_block_start_idx = b.add(b.div(cu_q_start, b.const_i32(BLOCK_Q)), seq_idx) + q_block_local_idx = b.sub(q_block_global_idx, q_block_start_idx) + seq_len = b.global_load_i32(seq_lens, seq_idx) + if spec.causal_top_left: + context_len = b.const_i32(0) + else: + context_len = b.sub(seq_len, cur_batch_q_len) # Right bound of the band (see the spec field). ``_upper_ok`` is the per-score # compare ``col <= d + right_bound`` (``None`` when unbounded); every site that @@ -1524,8 +1803,17 @@ def _band_row_mask(row_ok, upper_ok, in_prefix): return b.land(b.land(row_ok, upper_ok), in_prefix) qb_start_pos = b.mul(q_block_local_idx, b.const_i32(BLOCK_Q)) - with b.scf_if(b.cmp_ge(qb_start_pos, cur_batch_q_len)): - b.ret() + if RTL: + # Inside the grid-stride loop a q-block past the written rows skips its + # body instead of returning. The condition is CTA-uniform, so the + # barriers inside stay convergent. Closed after the epilogue. A block + # of a dense Q's padding rows only (past the live rows) runs no KV tile + # and stores zeros. + rtl_live_block = b.scf_if(b.cmp_lt(qb_start_pos, rtl_q_rows)) + rtl_live_block.__enter__() + else: + with b.scf_if(b.cmp_ge(qb_start_pos, cur_batch_q_len)): + b.ret() # ---------------- LDS layout ---------------- # Q is loaded once. K and V are double-buffered [2, T, HD] in natural @@ -1830,6 +2118,35 @@ def _band_row_mask(row_ok, upper_ok, in_prefix): coord_names=("token", "head", "dim"), strides=(b.mul(num_qh_p, b.const_i32(HD)), HD, 1), ) + + def _q_row_off(pos: Value, head: Value) -> Value: + """Element offset of Q row ``(pos, head)`` from ``q_base_ptr``. + + Runtime layout: the per-sequence term is already folded into the i64 + ``rtl_q_ptr``; the in-sequence terms use the runtime strides. + """ + if RTL: + return b.add( + b.mul(pos, rtl["q_tok_stride"]), b.mul(head, rtl["q_head_stride"]) + ) + off, _ = q_desc.offset( + b, token=b.add(cu_q_start, pos), head=head, dim=b.const_i32(0) + ) + return off + + def _o_row_off(pos: Value, head: Value) -> Value: + """Element offset of O row ``(pos, head)`` from ``o_base_ptr``.""" + if RTL: + return b.add( + b.mul(pos, rtl["o_tok_stride"]), b.mul(head, rtl["o_head_stride"]) + ) + off, _ = q_desc.offset( + b, token=b.add(cu_q_start, pos), head=head, dim=b.const_i32(0) + ) + return off + + q_base_ptr = rtl_q_ptr if RTL else query + o_base_ptr = rtl_o_ptr if RTL else output # direct-reg: skip the cooperative Q->LDS staging store entirely. # The per-lane Q32 MFMA operand is gathered straight from global in the # QK-operand block below (Q_lds is None). @@ -1852,13 +2169,8 @@ def _band_row_mask(row_ok, upper_ok, in_prefix): ) q_pos_safe = b.select(qmask_t, q_pos_t, b.const_i32(0)) qh_safe = b.select(qmask_t, qh_t, b.const_i32(0)) - q_off_base, _ = q_desc.offset( - b, - token=b.add(cu_q_start, q_pos_safe), - head=qh_safe, - dim=b.const_i32(0), - ) - v8 = b.global_load_vN(query, b.add(q_off_base, Q_col), dtype, 8, align=16) + q_off_base = _q_row_off(q_pos_safe, qh_safe) + v8 = b.global_load_vN(q_base_ptr, b.add(q_off_base, Q_col), dtype, 8, align=16) # When Q is aliased to K_lds (single shared scratch), the store # goes through ``[buf, row_in_buf, col]`` indexing of the K_lds # 3D buffer. ``buf = Q_row // T`` selects which K_lds slot, @@ -1896,8 +2208,13 @@ def _band_row_mask(row_ok, upper_ok, in_prefix): ) max_seq_prefix_len = b.select(b.cmp_lt(msp_raw, seq_len), msp_raw, seq_len) num_tiles = b.div(b.add(max_seq_prefix_len, b.const_i32(T - 1)), b.const_i32(T)) + if RTL: + # A q-block of padding rows only reads no key: its rows store zeros. + num_tiles = b.select( + b.cmp_lt(qb_start_pos, cur_batch_q_len), num_tiles, b.const_i32(0) + ) - if SLIDING_WINDOW > 0: + if SW_ACTIVE: qpos_hi_raw = b.add(qb_start_pos, b.const_i32(bm1_div_nqk)) cur_q_minus1 = b.sub(cur_batch_q_len, b.const_i32(1)) qpos_hi = b.select( @@ -2026,6 +2343,12 @@ def _pack_p_a32(p_regs0_f32: list[Value], p_regs1_f32: list[Value]) -> Value: hi.append(_select_lane_rg(v0_x16, v0_x32, v1_x48, v1)) return b.vec_pack([b.cast_f32_to(v, dtype) for v in (lo + hi)], dtype) + def _sink_logit(qh, qh_in): + # Query head ``qh``'s sink logit in f32 (see ``sink_logit``). + return sink_logit( + b, sinks, dtype, qh, qh_in, rtl["sink_is_f32"] if RTL else None + ) + if USE_SINKS: m_inits = [] if USE_MFMA_32X32 and TRANSPOSED_QK_32X32 and TRANSPOSED_SCALAR_STATE: @@ -2034,8 +2357,7 @@ def _pack_p_a32(p_regs0_f32: list[Value], p_regs1_f32: list[Value]) -> Value: b.mul(kv_head_idx, b.const_i32(NQK)), b.mod(row, b.const_i32(NQK)) ) qh_in = b.cmp_lt(qh, num_qh_p) - sink_h = b.global_load(sinks, qh, dtype, align=2) - sink_f = b.fmul(b.cast_to_f32(sink_h), rcp_ln2) + sink_f = b.fmul(_sink_logit(qh, qh_in), rcp_ln2) m_inits.append(b.select(qh_in, sink_f, neg_inf)) else: for r in range(REGS_PER_LANE): @@ -2044,8 +2366,7 @@ def _pack_p_a32(p_regs0_f32: list[Value], p_regs1_f32: list[Value]) -> Value: b.mul(kv_head_idx, b.const_i32(NQK)), b.mod(row, b.const_i32(NQK)) ) qh_in = b.cmp_lt(qh, num_qh_p) - sink_h = b.global_load(sinks, qh, dtype, align=2) - sink_f = b.fmul(b.cast_to_f32(sink_h), rcp_ln2) + sink_f = b.fmul(_sink_logit(qh, qh_in), rcp_ln2) m_inits.append(b.select(qh_in, sink_f, neg_inf)) else: m_inits = [neg_inf for _ in range(SOFTMAX_STATE_SLOTS)] @@ -2233,7 +2554,18 @@ def _acc_idx(n: int, atom: int) -> int: # lookup with the total block-table footprint so OOB lookups # return ``0`` (a guaranteed-valid block id). Downstream causal / # in_prefix masks already discard the bogus tokens. - block_table_max_idx = b.to_sgpr_u32(b.mul(num_seqs_p, bt_stride_p)) + if RTL: + # Runtime layout: only the entries ``< ceil(seq_len / BS)`` of this + # sequence's row are ever read (masked lookups return block 0, whose + # loads are then masked off by the per-token voffset guard). + block_table_max_idx = b.to_sgpr_u32( + b.add( + seq_base, + b.div(b.add(seq_len, b.const_i32(BS - 1)), b.const_i32(BS)), + ) + ) + else: + block_table_max_idx = b.to_sgpr_u32(b.mul(num_seqs_p, bt_stride_p)) # When a copy covers COPY_TOKENS whole tokens and they fit in one page, the # bf16/fp16 loaders build the page base, the in-page token offset and the # lane part separately (see ``_paged_copy``). A copy that ends mid-row @@ -2241,7 +2573,8 @@ def _acc_idx(n: int, atom: int) -> int: # keeps the paged-KV descriptor, which addresses each lane's own row. COPY_TOKENS = KV_HALVES_PER_CALL // HD PAGE_COPIES = ( - not FAST_PAGED_KV_DESC + not RTL + and not FAST_PAGED_KV_DESC and not KV_FP8 and KV_HALVES_PER_CALL % HD == 0 and BS % COPY_TOKENS == 0 @@ -2256,7 +2589,67 @@ def _acc_idx(n: int, atom: int) -> int: ) # Page ids already read for a tile, by the tile index value. tile_pages = {} - if FAST_PAGED_KV_DESC: + if RTL: + # Runtime-stride paged KV bytes. One paged block per tile (T == BS), so + # ``tile_idx`` is the logical block index: each tile load reads its page + # id once and builds one buffer resource at the page's 64-bit base (the + # per-page mechanism of the gfx942 i64 path; caches are many GiB), with + # range ``kv_block_span_bytes``. Token/head/dim stay in the i32 voffset. + # K and V share strides. + rtl_kv_page_stride_b = b.mul( + b.zext(rtl["kv_block_stride"], I64), b.const_i64(KV_BYTES) + ) + rtl_kv_desc = DynamicTensorDescriptor.create( + "rtl_kv_page_bytes", + coord_names=("token", "kv_head", "dim"), + strides=[ + b.mul(rtl["kv_tok_stride"], b.const_i32(KV_BYTES)), + b.mul(rtl["kv_head_stride"], b.const_i32(KV_BYTES)), + b.const_i32(KV_BYTES), + ], + ) + rtl_kv_span = rtl["kv_block_span_bytes"] + + def _rtl_kv_page(src: Value, table: Value, kv_tile_idx: Value) -> Value: + """The buffer resource of the tile's page (block 0 past the table). + + ``table`` is K's ``block_tables_ptr`` or V's ``block_tables_v_ptr``; + both rows start at ``seq_base`` (one ``block_table_stride``). + """ + idx = b.add(seq_base, kv_tile_idx) + phys = b.masked_global_load( + table, + idx, + b.cmp_lt(idx, block_table_max_idx), + b.const_i32(0), + dtype=I32, + align=4, + ) + phys = b.to_sgpr_u32(phys) + # A page id outside [0, num_kv_blocks) would address memory outside + # the cache: it reads as a masked page (block 0, zero-size resource). + phys_ok = b.cmp_ult(phys, rtl["num_kv_blocks"]) + phys = b.select(phys_ok, phys, b.const_i32(0)) + page = b.global_ptr_add(src, b.mul(b.zext(phys, I64), rtl_kv_page_stride_b)) + return b.buffer_rsrc(page, b.select(phys_ok, rtl_kv_span, b.const_i32(0))) + + def _rtl_kv_voff(kv_tile_idx: Value, linear_half: Value) -> Value: + """This lane's voffset within the page for one async-DMA call. + + Lanes whose token is at or past ``seq_len`` get an out-of-range + voffset, so the DMA writes zeros without touching memory. + """ + tok_in_tile = b.div(linear_half, b.const_i32(HD)) + within, _ = rtl_kv_desc.offset( + b, + token=tok_in_tile, + kv_head=kv_head_idx, + dim=b.mod(linear_half, b.const_i32(HD)), + ) + tok = b.add(b.mul(kv_tile_idx, b.const_i32(T)), tok_in_tile) + return b.select(b.cmp_lt(tok, seq_len), within, rtl_kv_span) + + elif FAST_PAGED_KV_DESC: assert (BS, T, HD, NUM_KV, KV_BYTES, NUM_WARPS, kv_calls_per_tile) == ( 32, 64, @@ -2438,6 +2831,8 @@ def _issue_k_load_runtime(kv_tile_idx: Value, buf_idx: Value) -> None: K_wave_base = b.smem_ptr_add(K_buf_base, wave_lds_offset_K_i64) if FAST_PAGED_KV_DESC: fast_block0, fast_block1 = _fast_paged_kv_blocks(kv_tile_idx) + elif RTL: + rtl_rsrc = _rtl_kv_page(key, block_tables, kv_tile_idx) pages = {} for call in range(kv_calls_per_tile): k_rsrc = key_rsrc @@ -2456,7 +2851,10 @@ def _issue_k_load_runtime(kv_tile_idx: Value, buf_idx: Value) -> None: linear_half = b.add( b.const_i32(call * KV_HALVES_PER_CALL), lane_half_base ) - if I64_KV_ADDR: + if RTL: + k_rsrc = rtl_rsrc + voff = _rtl_kv_voff(kv_tile_idx, linear_half) + elif I64_KV_ADDR: base_i64, voff, _ = paged_kv_desc.offset_i64_split( b, "physical_block", @@ -2502,6 +2900,8 @@ def _issue_v_load_runtime(kv_tile_idx: Value, buf_idx: Value) -> None: V_wave_base = b.smem_ptr_add(V_lds_addr, wave_lds_offset_i64) if FAST_PAGED_KV_DESC: fast_block0, fast_block1 = _fast_paged_kv_blocks(kv_tile_idx) + elif RTL: + rtl_rsrc = _rtl_kv_page(value, rtl["block_tables_v_ptr"], kv_tile_idx) pages = {} for call in range(kv_calls_per_tile): v_rsrc = value_rsrc @@ -2520,7 +2920,10 @@ def _issue_v_load_runtime(kv_tile_idx: Value, buf_idx: Value) -> None: linear_half = b.add( b.const_i32(call * KV_HALVES_PER_CALL), lane_half_base ) - if I64_KV_ADDR: + if RTL: + v_rsrc = rtl_rsrc + voff = _rtl_kv_voff(kv_tile_idx, linear_half) + elif I64_KV_ADDR: base_i64, voff, _ = paged_kv_desc.offset_i64_split( b, "physical_block", @@ -3842,7 +4245,7 @@ def _mod3_add(x, c): causal_ok = _upper_ok(col_abs, causal_lim) in_prefix = b.cmp_lt(col_abs, max_seq_prefix_len) m_ok = _band_row_mask(row_ok, causal_ok, in_prefix) - if SLIDING_WINDOW > 0: + if SW_ACTIVE: dist = b.sub(causal_lim, col_abs) m_ok = b.land(m_ok, b.cmp_lt(dist, sw_const)) s_raw = b.vec_extract(st_regs[n], reg) @@ -4068,7 +4471,7 @@ def _mod3_add(x, c): causal_ok = _upper_ok(col_abs, causal_lim) in_prefix = b.cmp_lt(col_abs, max_seq_prefix_len) m_ok = _band_row_mask(row_ok, causal_ok, in_prefix) - if SLIDING_WINDOW > 0: + if SW_ACTIVE: dist = b.sub(causal_lim, col_abs) m_ok = b.land(m_ok, b.cmp_lt(dist, sw_const)) s_raw = b.vec_extract(S32_n[n], reg) @@ -4145,7 +4548,7 @@ def _mod3_add(x, c): causal_ok = _upper_ok(col_abs, causal_lim) in_prefix = b.cmp_lt(col_abs, max_seq_prefix_len) m_ok = _band_row_mask(row_ok, causal_ok, in_prefix) - if SLIDING_WINDOW > 0: + if SW_ACTIVE: dist = b.sub(causal_lim, col_abs) m_ok = b.land(m_ok, b.cmp_lt(dist, sw_const)) s_raw = b.vec_extract(S_n[atom][n], in_atom) @@ -5009,8 +5412,11 @@ def _acc_final_get(n: int, atom: int) -> Value: b.mul(kv_head_idx, b.const_i32(NQK)), b.mod(OUT_ROW_BASE, b.const_i32(NQK)), ) + # Runtime layout stores every row it owns: live rows get their attention, + # and a dense Q's padding rows (past seq_lens_q) were masked like keyless + # rows, so they store zeros. A ragged Q owns only its live rows. _op_mask_inner = b.land( - b.cmp_lt(op_pos, cur_batch_q_len), + b.cmp_lt(op_pos, rtl_q_rows if RTL else cur_batch_q_len), b.cmp_lt(op_qh, num_qh_p), ) op_mask = ( @@ -5018,12 +5424,7 @@ def _acc_final_get(n: int, atom: int) -> Value: if VALID_ROWS < BLOCK_M else _op_mask_inner ) - out_base, _ = q_desc.offset( - b, - token=b.add(cu_q_start, op_pos), - head=op_qh, - dim=b.const_i32(0), - ) + out_base = _o_row_off(op_pos, op_qh) for stripe in range(OUT_STRIPES): n_start = stripe * N_TILES_PER_STRIPE # ---- stage 1: write this stripe's N-tiles into Acc_lds ---- @@ -5055,7 +5456,7 @@ def _acc_final_get(n: int, atom: int) -> Value: out_col = b.add(b.const_i32(stripe * OUT_STRIPE_COLS), col_in_stripe) with b.scf_if(op_mask): b.global_store_vN( - output, b.add(out_base, out_col), v8h, OUT_VEC, align=16 + o_base_ptr, b.add(out_base, out_col), v8h, OUT_VEC, align=16 ) # ---- stage 3: sync so the next stripe can overwrite Acc_lds ---- if stripe + 1 < OUT_STRIPES: @@ -5088,6 +5489,12 @@ def _acc_final_get(n: int, atom: int) -> Value: row_has_mass=lse_row_has_mass(b, l_final[reg]), ) + if RTL: + rtl_live_block.__exit__(None, None, None) + # Barrier between grid-stride iterations: the next q-block reuses the + # same LDS (Q staging aliases K_lds; Acc_lds is rewritten). + b.sync() + rtl_qb_loop.__exit__(None, None, None) return b.kernel @@ -5104,11 +5511,16 @@ def supports_tiled_2d_spec( on them; the ones the spec carries are forwarded anyway so a later rule on them judges the spec, not the defaults. ``use_mfma_32x32x8``, ``use_conflict_free_v_store``, ``use_k_sliced_ring`` and ``use_d256_fast`` are - not gfx950 spec fields. + not gfx950 spec fields. A ``runtime_layout`` spec is additionally held to + the runtime-layout restrictions (``_runtime_layout_reject_reason``). """ ok, reason = check_head_counts(spec.num_query_heads, spec.num_kv_heads) if not ok: return False, reason + if spec.runtime_layout: + reason = _runtime_layout_reject_reason(spec) + if reason is not None: + return False, reason use_fp8 = spec.kv_storage_dtype is not None return supports_tiled_2d( head_size=spec.head_size, diff --git a/dnn-providers/hip-kernel-provider/rocke/library/tests/ctest_lists.cmake b/dnn-providers/hip-kernel-provider/rocke/library/tests/ctest_lists.cmake index b23bcd3cd1a0..88a3ff0cd2f9 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/tests/ctest_lists.cmake +++ b/dnn-providers/hip-kernel-provider/rocke/library/tests/ctest_lists.cmake @@ -325,6 +325,27 @@ string(APPEND _ROCKE_INSTALLED_CTEST_ENTRIES " ENVIRONMENT \"PYTHONPATH=${ROCKE_TEST_CTEST_REL}tests/library\"\n" " TIMEOUT 900)\n") +# Tiled 2D runtime_layout host checks (no GPU required): catalog predicate and +# emit for every shipped cell, the rejection matrix, `_rtl` naming and the +# appended kernel arguments, for gfx942 and gfx950. The same files' GPU numerics +# are marked `gpu` and run in rocke_library_gpu_pytest, so `-m "not gpu"` keeps +# them out of this entry on a GPU runner. Same PYTHONPATH rule as the conv entry. +set(_ROCKE_LIBRARY_ATTENTION_RUNTIME_LAYOUT_TEST_RELPATHS + "tests/library/tests/test_gfx942_attention_runtime_layout.py" + "tests/library/tests/test_attention_tiled_2d_runtime_layout_gfx950.py") +set(_ROCKE_LIBRARY_ATTENTION_RUNTIME_LAYOUT_TESTS "") +foreach(_t ${_ROCKE_LIBRARY_ATTENTION_RUNTIME_LAYOUT_TEST_RELPATHS}) + string(APPEND _ROCKE_LIBRARY_ATTENTION_RUNTIME_LAYOUT_TESTS + " \"${ROCKE_TEST_CTEST_REL}${_t}\"") +endforeach() +string(APPEND _ROCKE_INSTALLED_CTEST_ENTRIES + "add_test(rocke_library_attention_runtime_layout_pytest ${_ROCKE_INSTALLED_PYTEST}${_ROCKE_LIBRARY_ATTENTION_RUNTIME_LAYOUT_TESTS} -m \"not gpu\" -v -rs --timeout=60)\n") +string(APPEND _ROCKE_INSTALLED_CTEST_ENTRIES + "set_tests_properties(rocke_library_attention_runtime_layout_pytest PROPERTIES\n" + " LABELS \"ckc\\;python\\;attention\\;host\\;quick\"\n" + " ENVIRONMENT \"PYTHONPATH=${ROCKE_TEST_CTEST_REL}tests/library\"\n" + " TIMEOUT 300)\n") + # Exhaustive counted-sync gates are intentionally outside normal pytest # discovery. The structural gate is host-only; the compiler gate additionally # requires the reference COMGR/LLVM toolchain and llvm-objdump. They share a @@ -620,6 +641,8 @@ set(_ROCKE_LIBRARY_GPU_TEST_RELPATHS "tests/library/tests/test_attention_unified_2d_masked_tile_numeric.py" "tests/library/tests/test_attention_unified_scalar_masked_tile_numeric.py" "tests/library/tests/test_attention_tiled_3d_wave_page_id_load.py" + "tests/library/tests/test_gfx942_attention_runtime_layout.py" + "tests/library/tests/test_attention_tiled_2d_runtime_layout_gfx950.py" "tests/library/tests/test_kda_chunkwise_gfx942_numeric.py" "tests/library/tests/test_kda_chunkwise_gfx950_numeric.py" "tests/library/tests/test_kda_gdn_gfx950_numeric.py" diff --git a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx942_attention_tiled_2d_emit.c b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx942_attention_tiled_2d_emit.c index 958039e86c7a..192006eb8c94 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx942_attention_tiled_2d_emit.c +++ b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx942_attention_tiled_2d_emit.c @@ -21,6 +21,35 @@ #include "rocke/lower_llvm.h" #include "rocke/verify.h" +/* A runtime_layout spec on the catalog geometry (Python _rtl, lockstep with + * runtime_layout_catalog_spec). tile_size 0 == None (one cache block). */ +static void rtl_spec(rocke_attention_tiled_2d_spec_t* s, + int head_size, + int block_size, + int num_query_heads, + int num_kv_heads, + const char* dtype, + bool use_sinks, + int num_warps, + int tile_size) +{ + s->head_size = head_size; + s->block_size = block_size; + s->num_query_heads = num_query_heads; + s->num_kv_heads = num_kv_heads; + s->dtype = dtype; + s->use_sinks = use_sinks; + s->sliding_window = 0; + s->has_softcap = false; + s->num_warps = num_warps; + if(tile_size != 0) + { + s->has_tile_size = true; + s->tile_size = tile_size; + } + s->runtime_layout = true; +} + /* Fill `s` for config index `idx`. Returns 0 on success, -1 on unknown idx. */ static int make_spec(int idx, rocke_attention_tiled_2d_spec_t* s) { @@ -318,6 +347,66 @@ static int make_spec(int idx, rocke_attention_tiled_2d_spec_t* s) s->use_conflict_free_v_store = true; s->use_i64_kv_addr = (idx == 19); break; + /* --- idx20-38: runtime_layout, every catalog (head_size, block_size) cell + * with its catalog num_warps / tile_size, GQA 1-16, one num_kv_heads > 1 + * spec, then the sink variants (lockstep with the Python _rtl rows). */ + case 20: + rtl_spec(s, 64, 16, 1, 1, "fp16", false, 4, 0); + break; + case 21: + rtl_spec(s, 64, 32, 4, 1, "bf16", false, 4, 0); + break; + case 22: + rtl_spec(s, 64, 64, 6, 1, "fp16", false, 4, 0); + break; + case 23: + rtl_spec(s, 128, 16, 8, 1, "bf16", false, 4, 0); + break; + case 24: + rtl_spec(s, 128, 32, 1, 1, "fp16", false, 4, 0); + break; + case 25: + rtl_spec(s, 128, 64, 4, 1, "bf16", false, 4, 32); + break; + case 26: + rtl_spec(s, 256, 16, 6, 1, "fp16", false, 2, 0); + break; + case 27: + rtl_spec(s, 256, 32, 8, 1, "bf16", false, 2, 16); + break; + case 28: + rtl_spec(s, 256, 64, 1, 1, "fp16", false, 2, 16); + break; + case 29: + rtl_spec(s, 128, 32, 16, 4, "bf16", false, 4, 0); + break; + case 30: + rtl_spec(s, 64, 16, 2, 1, "bf16", true, 4, 0); + break; + case 31: + rtl_spec(s, 64, 32, 5, 1, "fp16", true, 4, 0); + break; + case 32: + rtl_spec(s, 64, 64, 7, 1, "bf16", true, 4, 0); + break; + case 33: + rtl_spec(s, 128, 16, 16, 1, "fp16", true, 4, 0); + break; + case 34: + rtl_spec(s, 128, 32, 2, 1, "bf16", true, 4, 0); + break; + case 35: + rtl_spec(s, 128, 64, 5, 1, "fp16", true, 4, 32); + break; + case 36: + rtl_spec(s, 256, 16, 7, 1, "bf16", true, 2, 0); + break; + case 37: + rtl_spec(s, 256, 32, 16, 1, "fp16", true, 2, 16); + break; + case 38: + rtl_spec(s, 256, 64, 2, 1, "bf16", true, 2, 16); + break; default: return -1; } diff --git a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx942_attention_tiled_2d_emit.py b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx942_attention_tiled_2d_emit.py index 0efe7ebc6472..87823ed2467b 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx942_attention_tiled_2d_emit.py +++ b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx942_attention_tiled_2d_emit.py @@ -334,6 +334,62 @@ } +def _rtl( + head_size, + block_size, + num_query_heads, + dtype, + *, + num_kv_heads=1, + use_sinks=False, + num_warps=4, + tile_size=None, +): + """A runtime_layout spec on the catalog geometry (runtime_layout_catalog_spec).""" + cfg = dict( + head_size=head_size, + block_size=block_size, + num_query_heads=num_query_heads, + num_kv_heads=num_kv_heads, + dtype=dtype, + use_sinks=use_sinks, + sliding_window=0, + has_softcap=False, + num_warps=num_warps, + runtime_layout=True, + ) + if tile_size is not None: + cfg["tile_size"] = tile_size + return cfg + + +# --- idx20-38: runtime_layout (hipDNN paged/ragged engine). Every catalog +# (head_size, block_size) cell with its catalog num_warps / tile_size +# (sub-block tiles at d128/b64 and d256/b32-64), fp16 and bf16, GQA ratios +# 1-16 (5, 6 and 7 leave VALID_ROWS < BLOCK_M), one num_kv_heads > 1 spec, +# then the sink variants (idx30-38). Dense or ragged Q, the window and the +# Q/O/KV strides are kernel arguments, so every config emits all of them. +_CONFIGS[20] = _rtl(64, 16, 1, "fp16") +_CONFIGS[21] = _rtl(64, 32, 4, "bf16") +_CONFIGS[22] = _rtl(64, 64, 6, "fp16") +_CONFIGS[23] = _rtl(128, 16, 8, "bf16") +_CONFIGS[24] = _rtl(128, 32, 1, "fp16") +_CONFIGS[25] = _rtl(128, 64, 4, "bf16", tile_size=32) +_CONFIGS[26] = _rtl(256, 16, 6, "fp16", num_warps=2) +_CONFIGS[27] = _rtl(256, 32, 8, "bf16", num_warps=2, tile_size=16) +_CONFIGS[28] = _rtl(256, 64, 1, "fp16", num_warps=2, tile_size=16) +_CONFIGS[29] = _rtl(128, 32, 16, "bf16", num_kv_heads=4) +_CONFIGS[30] = _rtl(64, 16, 2, "bf16", use_sinks=True) +_CONFIGS[31] = _rtl(64, 32, 5, "fp16", use_sinks=True) +_CONFIGS[32] = _rtl(64, 64, 7, "bf16", use_sinks=True) +_CONFIGS[33] = _rtl(128, 16, 16, "fp16", use_sinks=True) +_CONFIGS[34] = _rtl(128, 32, 2, "bf16", use_sinks=True) +_CONFIGS[35] = _rtl(128, 64, 5, "fp16", use_sinks=True, tile_size=32) +_CONFIGS[36] = _rtl(256, 16, 7, "bf16", use_sinks=True, num_warps=2) +_CONFIGS[37] = _rtl(256, 32, 16, "fp16", use_sinks=True, num_warps=2, tile_size=16) +_CONFIGS[38] = _rtl(256, 64, 2, "bf16", use_sinks=True, num_warps=2, tile_size=16) + + def _kernel(idx: int): if idx not in _CONFIGS: raise SystemExit(f"unknown config index {idx}") diff --git a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx950_attention_tiled_2d_emit.c b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx950_attention_tiled_2d_emit.c index ce4e0c348e02..380022265419 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx950_attention_tiled_2d_emit.c +++ b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx950_attention_tiled_2d_emit.c @@ -25,6 +25,29 @@ #include "rocke/lower_llvm.h" #include "rocke/verify.h" +/* A runtime_layout spec on the catalog geometry (Python _rtl, lockstep with + * runtime_layout_catalog_spec). */ +static void rtl_spec(rocke_attention_tiled_2d_spec_t* s, + int head_size, + int block_size, + int num_query_heads, + int num_kv_heads, + const char* dtype, + bool use_sinks, + int num_warps) +{ + s->head_size = head_size; + s->block_size = block_size; + s->num_query_heads = num_query_heads; + s->num_kv_heads = num_kv_heads; + s->dtype = dtype; + s->use_sinks = use_sinks; + s->sliding_window = 0; + s->has_softcap = false; + s->num_warps = num_warps; + s->runtime_layout = true; +} + /* Fill `s` for config index `idx`. Returns 0 on success, -1 on unknown idx. */ static int make_spec(int idx, rocke_attention_tiled_2d_spec_t* s) { @@ -1239,6 +1262,67 @@ static int make_spec(int idx, rocke_attention_tiled_2d_spec_t* s) make_spec(75, s); s->use_transposed_qk_32x32 = true; break; + /* --- idx77-95: runtime_layout, every catalog (head_size, block_size) cell + * with its catalog num_warps, GQA 1-16, one num_kv_heads > 1 spec, then + * the sink variants (lockstep with the Python _rtl rows). */ + case 77: + rtl_spec(s, 64, 16, 1, 1, "fp16", false, 2); + break; + case 78: + rtl_spec(s, 64, 32, 4, 1, "bf16", false, 4); + break; + case 79: + rtl_spec(s, 64, 64, 6, 1, "fp16", false, 4); + break; + case 80: + rtl_spec(s, 128, 16, 8, 1, "bf16", false, 4); + break; + case 81: + rtl_spec(s, 128, 32, 1, 1, "fp16", false, 4); + break; + case 82: + rtl_spec(s, 128, 64, 4, 1, "bf16", false, 4); + break; + case 83: + rtl_spec(s, 256, 16, 6, 1, "fp16", false, 4); + break; + case 84: + rtl_spec(s, 256, 32, 8, 1, "bf16", false, 4); + break; + case 85: + rtl_spec(s, 256, 64, 1, 1, "fp16", false, 4); + break; + case 86: + rtl_spec(s, 128, 32, 16, 4, "bf16", false, 4); + break; + /* idx87-95: the sink variants. */ + case 87: + rtl_spec(s, 64, 16, 2, 1, "bf16", true, 2); + break; + case 88: + rtl_spec(s, 64, 32, 5, 1, "fp16", true, 4); + break; + case 89: + rtl_spec(s, 64, 64, 7, 1, "bf16", true, 4); + break; + case 90: + rtl_spec(s, 128, 16, 16, 1, "fp16", true, 4); + break; + case 91: + rtl_spec(s, 128, 32, 2, 1, "bf16", true, 4); + break; + case 92: + rtl_spec(s, 128, 64, 5, 1, "fp16", true, 4); + break; + case 93: + rtl_spec(s, 256, 16, 7, 1, "bf16", true, 4); + break; + case 94: + rtl_spec(s, 256, 32, 16, 1, "fp16", true, 4); + break; + case 95: + rtl_spec(s, 256, 64, 2, 1, "bf16", true, 4); + break; default: return -1; } diff --git a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx950_attention_tiled_2d_emit.py b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx950_attention_tiled_2d_emit.py index 775f0d49a185..6f81c34acab7 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx950_attention_tiled_2d_emit.py +++ b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/gfx950_attention_tiled_2d_emit.py @@ -1188,6 +1188,58 @@ _CONFIGS[76] = {**_CONFIGS[75], "use_transposed_qk_32x32": True} +def _rtl( + head_size, + block_size, + num_query_heads, + dtype, + *, + num_kv_heads=1, + use_sinks=False, + num_warps=4, +): + """A runtime_layout spec on the catalog geometry (runtime_layout_catalog_spec).""" + return dict( + head_size=head_size, + block_size=block_size, + num_query_heads=num_query_heads, + num_kv_heads=num_kv_heads, + dtype=dtype, + use_sinks=use_sinks, + sliding_window=0, + has_softcap=False, + num_warps=num_warps, + runtime_layout=True, + ) + + +# --- idx77-95: runtime_layout (hipDNN paged/ragged engine). Every catalog +# (head_size, block_size) cell with its catalog num_warps (2 at d64/b16), +# fp16 and bf16, GQA ratios 1-16 (5, 6 and 7 leave VALID_ROWS < BLOCK_M), +# one num_kv_heads > 1 spec, then the sink variants (idx87-95). Dense or +# ragged Q, the window and the Q/O/KV strides are kernel arguments, so every +# config emits all of them. +_CONFIGS[77] = _rtl(64, 16, 1, "fp16", num_warps=2) +_CONFIGS[78] = _rtl(64, 32, 4, "bf16") +_CONFIGS[79] = _rtl(64, 64, 6, "fp16") +_CONFIGS[80] = _rtl(128, 16, 8, "bf16") +_CONFIGS[81] = _rtl(128, 32, 1, "fp16") +_CONFIGS[82] = _rtl(128, 64, 4, "bf16") +_CONFIGS[83] = _rtl(256, 16, 6, "fp16") +_CONFIGS[84] = _rtl(256, 32, 8, "bf16") +_CONFIGS[85] = _rtl(256, 64, 1, "fp16") +_CONFIGS[86] = _rtl(128, 32, 16, "bf16", num_kv_heads=4) +_CONFIGS[87] = _rtl(64, 16, 2, "bf16", use_sinks=True, num_warps=2) +_CONFIGS[88] = _rtl(64, 32, 5, "fp16", use_sinks=True) +_CONFIGS[89] = _rtl(64, 64, 7, "bf16", use_sinks=True) +_CONFIGS[90] = _rtl(128, 16, 16, "fp16", use_sinks=True) +_CONFIGS[91] = _rtl(128, 32, 2, "bf16", use_sinks=True) +_CONFIGS[92] = _rtl(128, 64, 5, "fp16", use_sinks=True) +_CONFIGS[93] = _rtl(256, 16, 7, "bf16", use_sinks=True) +_CONFIGS[94] = _rtl(256, 32, 16, "fp16", use_sinks=True) +_CONFIGS[95] = _rtl(256, 64, 2, "bf16", use_sinks=True) + + def _spec(idx: int) -> UnifiedAttention2DTiledSpec: if idx not in _CONFIGS: raise SystemExit(f"unknown config index {idx}") diff --git a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/golden/llvm_gfx_all.json b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/golden/llvm_gfx_all.json index 4e5a2fd4f9df..e7065fb283c3 100644 --- a/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/golden/llvm_gfx_all.json +++ b/dnn-providers/hip-kernel-provider/rocke/library/tests/parity/golden/llvm_gfx_all.json @@ -1071,7 +1071,26 @@ "18": "bf7b02b7aa2d32470335fc8dbb966b40af321525e28b3f351bc7405a27265d69", "19": "d9b3c7bf671ce53b4eaed65a93a88fdc88eadc9a4013f22a4c654984440711e0", "2": "ee4683453afbbc49e5ae11714bccf200fada5e75884a59405cc6676af6e57b81", + "20": "d4b1497fd89d64769dd134adbf400c93b2abed67cc8a587974fc8b23f4f20096", + "21": "1609bbfbbcb7e20859c75bac8be5dd9a1c643c01e5d89f4b1d22a4985e1b466b", + "22": "af0770506442bc7d78c8f005d5482403bb3bdfdde2fb83f12923b9c2351d2e7e", + "23": "4f086eebccbe81e3f3375188bc09947b7a764a95570b4467a92b0a8e7e42f3a9", + "24": "553c5a2de77284b13a7d3b4319e57a97bb7062c9bc774ef46f32374606167fc8", + "25": "7897d5160a2910fe8412beec66fa668c53ec560e8155482ef19d1cec9c7981ba", + "26": "c12eaa755b4b5eafc5ef603c21069392dfabf34839ddc0acaeb27ebde3bed6e3", + "27": "5933a682d283412fd584efc17799738f50e35a345a22539fc834100970140296", + "28": "431dd33b1a3bd1a87c10f655b5b7bddd5c55d3454028624cc9b802ffa3f2347d", + "29": "6bc42b9083e241d4405c1810ee108bc173fff818e5bb8c28aa9ff2d04ced53e2", "3": "b364ec606939a153220377511d8bb21345bf28f998a41c1f8e3b0d96cac6c4a8", + "30": "0e15d515a3e5835d0158cf948e6410cd79951b81ab02a33dd0824a1b52b69af4", + "31": "540d874ac13d7733f4af1b127868cbe8bc43fe6cfd134fd8ecbffb616f5d75cc", + "32": "220c7ac26c1c0c8a8b70382c51319d0588685a33d33996509d05d4bbdc5e5e02", + "33": "b652fa1440a923b73bd8fd8fc57b5752b1ef1bf17445a966f30312865120138e", + "34": "48a21a4a8d0026ffa58fd0764cddf8b4ee052a1913e4b79e4160266bffbf2871", + "35": "80cb9c3877aa7ef89c05ffe57267efafe112c6a2748794a9831be27337ede4cb", + "36": "dc24cc12cf63dc688e943cd047adbff4375cc85eeed2e08fe7b6d1ebf46c5d04", + "37": "bc8509a917703fa9a2bdcf30503bba871c14b45e8b90bc45428eff3715491524", + "38": "171908db8974fad6378eb3c88a83db33b56fd40106528b50473dc6b14ba54dd6", "4": "66849d43bf1485879bcf1c5f173d72862cca98a1985d0d2d0ef824fba8c5cbe6", "5": "e9427bcb1fe7b9bfe568b7451b9f6ccd770c9399ff05deae35775479e13a407b", "6": "4337bae9b89e2794112a158ead6c4f06c3c86d992046ba3902496ddc4f940b07", @@ -1242,8 +1261,27 @@ "74": "4ed2861ee15646599091a13275f1a61728089a306f294cf7d13930eb5830fd3f", "75": "bed5bf3bdd0114db986f138893800f5dc59f5ac92ee24e07c6bd98320c750da1", "76": "e083d4f587b86585d0e42f29046dc9262a85ce1fd6182d543f171636e55407d1", + "77": "3d0bd8b87f3294e3a75539b975fa4b7679124e8b74a8b547e8dce984273c6019", + "78": "1821840057ad53e8a0dea176d99da6d0ccaceada36d34744f316f0a45154f368", + "79": "439cbefe8ec0ce49151c1412a53d0fdf2991a4bf7e23116941a12832d12c5c8d", "8": "f4f0267af6f85a06591533f53a3cc74339723fa2e33c5f68e5fcd1b1ac4a6520", - "9": "3c0bbb4435538d794f348fb385377e07b8274d96162257c6117e15e995afdf25" + "80": "69ce31dc933740c24a6bbecec34079dc81c2f3070db58a3e9914a91ab93922ab", + "81": "20b02877f280ddd832039cdb424982816c0f3d655db4ebf79588afde1ec99cdf", + "82": "4c77a1519b39675ac3db218a0b50e08b9047cd11c9d62eebb532b9d2b927b12e", + "83": "6eac83af8d2bfbce49e22bfd7262420cb60554d1c7ad43c05121a1f0a2223b37", + "84": "682a3d422fd9f20b5960342ef334ec3e8018308382254c0aaa54d976524dae7a", + "85": "62085c2736e94165d4733f2371fa8261e5416c987197e102c6455e0b562d66d2", + "86": "c7b9c2e465957e4b787b11c4a37fb56c3bb293c5ada344f25a273fca0551de07", + "87": "8e142a89830409acc01a77dbd489b42e0e904a7703bda4fc9f7f27eea0e16da0", + "88": "4c0f095adb9e1c1fc8b38987e0c4168ca264fd08f628fdc713c244de0eb46b94", + "89": "a7412e4498c2d1c47cec0c70a2bb98528dcaed4d9b945ed7296c03794ff202c6", + "9": "3c0bbb4435538d794f348fb385377e07b8274d96162257c6117e15e995afdf25", + "90": "a342b3af825f8026c29383f7ac92b2b4fa9bfd5c4e57fe73025d3782826b413a", + "91": "68a32ce23aef680e46a08f6907f9cb78431d69ddfe317674bba2db7435ae9b3f", + "92": "ca959a0c4adc29985a421c6967b14ea44a1ee9085ff2d0a63aec9656264212a3", + "93": "7416f65411c2b11e875d85d0b3422138301a7c50568b4c16285be0ec0c57b9ee", + "94": "24ed900308dc939aead8cc084e7f05f5f1784a6dc34943533e14385da7642308", + "95": "9395eab4cd47c069bec4fc00f070b5d9f81b99c275dfd1e52da75f50dff4a41d" }, "gfx950_attention_tiled_2d_fastkv_regp": { "0": "d21a86dc7cd4b574b7c58faad7dff5e113e6ad5fd5739abed3d049e27de730fa", @@ -2343,7 +2381,26 @@ "18": "7d21d4ce1dd271b1dfe7f82d0c6c128c3e249b1f00833a090b74b3facb94f80e", "19": "d5b8888550a1db52d497b490f09cc169d739d054d269284ff7be8f5e3d3c2031", "2": "5841c730e964542b171c289e6075eaf6332b3cae253707da9fd74d8bb3c9ba9a", + "20": "7ecea7f1743994ce3e9245f22615974f89f28d010e7aa44bf34c0622ace8b1bb", + "21": "e9cd008e7be4d014c63ab3be6902cac8fb85feab131f0d0ae704b9baa6e3dfe3", + "22": "625b1e29624f55d85059eeea53d3f1b628aaf9847648dc20cc9b17a7332e7445", + "23": "ddba7a92486ff7641f2a6702170b3b7f7727f38ffbab7842e468e8ddeb00f23f", + "24": "c32780deef66415d82a880eee4d5cabc7c10ffc10dfe4fd98eb1c753b9e7a80f", + "25": "38d64fb6aa4e8c0d0645b04e4b73de3dd5ab60146e54dde82518e08cb4110566", + "26": "4168358296b0455249a8dac1ed1e269998ea428d07276c5a72435bb32e6df8f1", + "27": "0db54d6075e898e20b5048330007055aac78f2e886d64bef82d63a0b616c0bf5", + "28": "62d5862bad3bd1bae068167b06185809987c6e793b2fb1a6fafbdc8d8e97aff4", + "29": "bba78e2631fb4bea1442bb3bd3c4d52115208b91fd16439d82f7eb82affbe45b", "3": "bd9164bfbcff6da42e08428ca167eeb648967f4c40c019f79ef435be664b0d6a", + "30": "1f29c04375229d4c169688ddfacba697b5365ab61ec2eb2f84ff30c28c4a457d", + "31": "90c0653f1a63d611d2e0017d52ba3cc2c514aea3ee74666bdf951a4b95da0ff6", + "32": "e9ea21292ab2b607e2f310fc9baab9d9758dc2335fafe574fb5fd0244146b924", + "33": "4c969d18d0a8f15a1f695139431d6ff683e6881ed1f400703912f4fc10718c8b", + "34": "48a04e385883585ca0091ae36c5b058bb70a25b92d26cb36b090cfec124d5cb7", + "35": "3ce5fdcec60a259fb34153e40979ee6a107b1467814ae4c42dc2ec304f3e77ef", + "36": "ac4cfbf66caf56627b5ac767d15d5b36402fcbd7d475bec143a6f36f1dab5ede", + "37": "beef9a230e154a9b5c53ce3dc0e9f3aa8ee5e974e0da989a6cd922117d7b134e", + "38": "69a35b3801b9107cebd83f2fa0c8b78022003350a193c85c0a30fe8667ceba8c", "4": "1b04fa2470af0aa59452389cb41125418154ab3939758ed4a38789ce290b33ab", "5": "f6e5cf8a0392c1bce3fd7d9ce4d0eccf9d39fe29f02ab9bcf5c342152eba4ffb", "6": "c5ef7876d05cc7b9ea1fd4a8fe807c660bb1102a5f198790aecfff165b017c28", @@ -2514,8 +2571,27 @@ "74": "d833ca18333f361c1c677dd9d1e59b506cfd1733a90a56c5c782a80a224867a5", "75": "c91136c4b793fba4b88cb3ce5ba0f88314ae0ab899493a6fae0460373d57b712", "76": "b6e22bf0098737c4fd607da275cec72c11266f82c9573d8d2d89bd446c32fdd8", + "77": "58acd05c2c6a2621f79a87eec13f0fe304d6c911f888c096d5496db995b7d3f4", + "78": "549a09305249f70c8e8824905f35b0b7a5c3728d5c832d8a3944a39ae02b9eb8", + "79": "687303930848395a502c6036f285f4c071973a31544b8bf98a57821f10b4dc12", "8": "436a62f0670b97e464439f466724c5d911a96b10e4bb035429b37d5be8d85243", - "9": "07eadd3cdcb25d33e4162b75d3543681a9f260e6a972c64ce4bfe3a28dee2bf9" + "80": "6c6a2e94819e7165956dec4bf2e69ab33133b46f9c41624eef43cb7bc02f8f38", + "81": "0c04ef80a18a2e63bf5fb7a0c50eedc1b60fbc87c20377c6327e92f0bbb6e9ec", + "82": "e772f977a85f0e14a6e19c8d00a3c5ed1b355fc61a969d3c9b8bbccdd8a8784b", + "83": "980f972ea1935af331139a665f3d38e482a4d1ad7fa13e228a149d317c6b12e2", + "84": "76be08c992d232ebce1b15ab422247367ed502eabc587d6028a753751b10bdcf", + "85": "903edd0e7cb8eab6f4bcafd15da63cf5003e764722dc648a0e35152142e8417a", + "86": "d91e0c6b28325fc626bec0439ddd72ca716e4f542eea9cb3abe0bd2b2108007d", + "87": "260a04529e544f7e091167b9e3069e7799d5be8cfb45dcf1b8c184e9614ae96d", + "88": "dbc9edb05ae0e9e7dbc5ddceb25cc7ebfccb93d9b6902bdcc8960d59d608af09", + "89": "b28792bce54a9c25d8a338bfe656c83f53669f11e7e2370dd1e5877f3bbb9264", + "9": "07eadd3cdcb25d33e4162b75d3543681a9f260e6a972c64ce4bfe3a28dee2bf9", + "90": "70e79f9d1bee787dbd87c9255757291abd96d2d0b788090a19b8b6e2460a790d", + "91": "9e83bea39ac34a2d2ee63ec0d608fc46699cef90fc757acb5f287726848bfb6c", + "92": "dbeeb982d0239464c56349c4b52cb023c631da20fc44c675fbf848902b1246f0", + "93": "adc3839bcaaae547fc6b7f5cfb1fb5b97aafcdeb878bcffc055a081fd0bf3c20", + "94": "359eab4b78132c1e68a69b9497e3bdf7090e91444e77fdc0ecd28c018897628b", + "95": "5de6f30122331e8ff5ed19a897271c53f706eb2bec7064f029ee1899d7f5102c" }, "gfx950_attention_tiled_2d_fastkv_regp": { "0": "52fef7be3f5b5752f4d62e09b0c9296df1abdaba39cc1d360d05e41e0b70edb3", @@ -3614,7 +3690,26 @@ "18": "eb020317c6d6bab712c0379731bdb9eab253ad67be3b1937c759c4ead5743c78", "19": "a8cc1af85ca357f2e5b109402706d4be4e6f9235839c3016290441ed7cdd6799", "2": "9b7b8d4ad0d7c67143c5887f561e08182cf9a095bed1a76ed53b406cbd45f768", + "20": "5176a7ba5111f7e8883f1969f8c00010005f38e54f0df885e4bea24bdfa83902", + "21": "5fccf557bff0da50d20f3a242b156b2fa4a0851628c9908d4ffbc6466237d127", + "22": "ddf0baed580749d6466504f52390d3115965070d20ae8f5a98c1a3518e1f5f19", + "23": "0ebcbd3257a688137007a94ea3a284ef022ede96f42618dc7459f9b4a2069bab", + "24": "08c3a22db667e9c7f8d153ace36a098f2f398a02b1a1a930f56a6c7c68a34423", + "25": "830f689e6e87930060321f9f7dc4c37a91ef62c1b911f521f10cbd809c51bf31", + "26": "daad8544b6c4ca52b742eb92c406c079727ca7e9c9f9f366a69e86b96b22cbda", + "27": "7fa6fc51e5cd344e0b2ff677f409d717c090da95cd12bbc27e806a2deb158523", + "28": "4e79764f9448929f18d85e3239cea36164d5f0d0c33731c5308dc6d03e8a4c9b", + "29": "65f27a1733306f614fd54fa7fef5145071e18467f951e5451652a35993954445", "3": "04366ee133dbfc67fba244a8d80ef386386c288436c373fd2ba3fb34581287e7", + "30": "5fd0a380ae0b17d227e1df05d2f2324d94d600c188c9fc1c0622a3041448686f", + "31": "17f500e56adf13fb7dd35a1f0b329df7d85ef21de97496569dbaf68587914457", + "32": "76de9c9670c0b63f66fdbde5374694aa6a43825009256f7d21c1828988095e66", + "33": "93ff7e359c2c536c491f094558d418c8ccbfc56cb8aeaeab44aacc8b37085622", + "34": "2ba106cdf59a6f050a8de644a42015208c36290675d6611938b8e206ef52fd65", + "35": "4c14b6bbcfc8eb77c65ead93da1b19cd6c1c48477bc77a3a8f2e4ab51ee7f529", + "36": "324a8148aa908a912c92db936170c7ae16eb51c795e9845fd5dd3e116fd9f0d8", + "37": "6ee2d4c20393f75cefed53acb4667bd3630900cee5aac06c9c01340b2d417d1f", + "38": "d624e19a2d28469f3f12c28ffffc81b28e73c315bdfb12ff0ef792eb5298097b", "4": "f7627f88969eff7df1add5b6a54937fff1c2eb1f869cf4db71f51ab1657c72f8", "5": "3b8b9c52b4b74d31c9be73c6d0ba0c5e7549a0015ff4e3fffb86fa16968912e4", "6": "a42abe98ff959a8fec3fa4e6d733b7a7382fb99212f6c25846d80aa3fd6e734f", @@ -3785,8 +3880,27 @@ "74": "70a3199bf1a975e725d3fad3d15cb5e8845ac78d7d100894fe89876ea4efbad8", "75": "3c712353d43586a58692f93c9e78c052a39649d37cf2ba5112381ce2e5b87aea", "76": "3182e2624ad47469c4b206a6e66648217cdba883df598df700ccc194b236c2d3", + "77": "e343947f1e295c5c625e67d170b92d57ed789636fbd90e8a92bc623540ffb8fd", + "78": "43c0dee789525ef71b3c8c834b73bb1cad8d7b6c28bcca1c306034e568b46174", + "79": "1ded1cd6189c828599936af927fcbd76b5afdf4f555e3604244e6b403f912919", "8": "7d827babcb8192445726b06e4250deb674158b5a77d87ecdd9e873118dc0ec93", - "9": "5454f3658b3f3e436f29eb8a9f7184ed12eb0209155508c15d6d0b09eae9e2b0" + "80": "de95fe108e0b4b8ef4f0c06f752186ab1c5531670f6098b0dfa341a857532bf1", + "81": "0bc86bcbad718767fe0f82f459b02689a2a2e7dd5f84d4978c1438ca18affcb6", + "82": "fa438ce9767e58b7cb2d1ad23b79c8a3a3a5dab160d13b4e9f7eea8fba989e8e", + "83": "fa34f75a170456ad2610bdc5e23e7f20b8fcc1506b9c7c6402afb41bcf84108d", + "84": "1765fb5bdb5cb2f09f8d0b132ebf1761b1169733b6ee013b6ddc7fc973bd4c29", + "85": "57c0459315dc8c380009eeee5788d8c9d66451763edecd378e1507dbc0a8cd52", + "86": "24d2401943e0706566d6a8b6394630e37da8aaef601c50cbef4da5bab9effe5e", + "87": "6eaf4414006dec90d1fa77b721d8718bb78256f88df25437df73bb18f0c20362", + "88": "764f194543825ee2173f9931e09fa41bafc8dfbb62bb96955b021fe0168852bd", + "89": "b3a3f1538cbd1ef0d85ec294c7ad2304183d5f6030af94f5a5e69a2762f067bc", + "9": "5454f3658b3f3e436f29eb8a9f7184ed12eb0209155508c15d6d0b09eae9e2b0", + "90": "8265e32360d732499d5be5f74421ca1255a982132c3d1d3442b9f6428b2662b4", + "91": "2cd944b9616d734e4f917c3aac468d7df9b87c7f0269e13b4fab274b2b67dc9f", + "92": "477f02afedf418c5e7765bf5ed737c25a573e25568ab74f4cca5c5aadeb712a6", + "93": "9bb9ff5fa5e2b3630e7c4c9d9eb3ba69c6d5c226afda6f67256e6f9787d13084", + "94": "d11e685b61b841e84a547c2db108f3a86dd7d7b99575e4b6585f582930815fc8", + "95": "e7dea586b4b59673ba16b3bd0d3376ede26cc6279015ef50208a35f79a4e7321" }, "gfx950_attention_tiled_2d_fastkv_regp": { "0": "6f9c1088480f429bc5f275eac443b8bdeeb1bedc8113b3984c4abc00054969a1", @@ -4948,7 +5062,26 @@ "18": "6d6f02a547cd98da2c8c2961aa07a31551ead49bedb8ab041c1ac25e13e2950a", "19": "16015c221eb6a733534c1950dd21aafad2e4e2a0dbc4bcb02b642e2956803831", "2": "55c737ed7f81060d5f9202dd7f3fabe25917c8497e7fa03edd921e2e552be9e9", + "20": "2230c3aae93c09faac76a04c6d4ab43b7ed786ee3de44ad5c31a8987d6e27f59", + "21": "3bb59c4a121d5913fcc382dc550f081d7e71d4d4f30595cee90fefa7f42edf3e", + "22": "54c6a4a59cbdff603a95ba7b4c48b5e0f5a2cd4bfb2050f825447b9db2353632", + "23": "8b7f4bb5f824e6fad3e70bc21d6ef1c5ae13b9fbe1b7cdc767246f68d9a662a2", + "24": "56ddb4d3fe1d7989bd6731fdb68b9d86a7a9317c9f5e8dcd758989b6571bd8f0", + "25": "19af297c4cbeb40c1bbc31efe17ccd84e7127da444fe9715e481bfbc00f2bf47", + "26": "28191a9c513a956898b1c0bcdc6d638f8e9ab48c2c7380b00f57e6c668a4cf21", + "27": "f2ef2d18ed8f642f0396960c3a91ea2898b66d474c99cb04719ca3e678c55d57", + "28": "99667da65ccf40ae74e0bdbd3f6cc02c78fcafd02c189051db8e5d07daad216c", + "29": "810238696b9e2a712b564e996ab55da6e6bbb418c00727405aaa5a452be0c1fd", "3": "bc950eea70f3c80d7e64c6fdfad5c96ba3fb4da49a316168cfd1bf20f6b20f13", + "30": "4a65ee5b3528bd7548785534a6eaa742c8158144c5a825ef6d04a9af368c1f89", + "31": "4e5307c3a8d2aca8d87b588d4b0440d2d19d83d9b95a987d2cb8c27b383606d0", + "32": "0f97c111ef05d651425aa6bbfa3b57d87d896cd5dd0a7d0ce495a501213784fa", + "33": "94d168f7522c2d2f12a8a3535ce2ffb40e176e0602499f3d380ac0dd59886cbc", + "34": "2657c3b6e0b093bf976d70f32810669fd1a7d6a4f446b602226d0ccbd382f4aa", + "35": "4cd8a9f1b83aced6ccf02dd654d6c9b1203d54f7a7149a312d64a0ea8319ec16", + "36": "89fd4b0e8d63babc67f4e90408ef1e900239facfdd3dab7b5a9892f4d00077d8", + "37": "bf62d411f42003c6f6d386c51ed14039a4d2339a15100ba7f053aa0be44d2122", + "38": "b6aa08d96b4f6431155e4c009b5828844605272cad4d18ec7babe08fcd96bfaa", "4": "dbad6405c1fb6e15d364d61db3ea7a9aae57e32c8cb64cd0fabb96862c823d69", "5": "bda1d590f8870c8b1bf8a8fea4ffd99cdd1af6741fcd2d6224fa2286956230be", "6": "8458e403a87e59406586051bbf9b4498d67aea928e654eaaae67cf55b9b4dbfb", @@ -5119,8 +5252,27 @@ "74": "bb8b0a1e8e06e91044209b4407f8ddfc8dcb3c51d91d28f7673fc209c8d84bb0", "75": "95c373866387c3529e8d60536d70d0d6372d782f1c1e64b067fa86daf3ca0fdd", "76": "fd54658289a24225c4a5b7a7ea339f4337b9b297f599b482da8ce45367c466be", + "77": "453462d5c79abebc0a3c11a32e0dec5593b54a20eceeb862062f5c48de313c48", + "78": "b5ca9819239715029eeed3e010ae7c22285de81c4283bd38b6e5c20fde12b490", + "79": "8bb6e846ecc5be2458d6df617f528372e6dab756748baf4d6d3cca56347e40fd", "8": "9a4431d34fde7e376552fc757ff75be86b1c4c6194b3f95c93c0ab9fbbf9f2a4", - "9": "6267b3845952589a6f3594a1e07902bfd52ec3ecfaa85d398c4b002570f37e07" + "80": "969e3f1ca771532273dc64125eeee6fcc1f459477c57e1a828bf688151b9eaa9", + "81": "f29ef6ec4cf99dd85a5417becc55bb218497808635e2fa72574ba5993eb8c05a", + "82": "d2d878bb04e0f0bb797a7d4bbe54110324dc1c5b22062c38f9a2da023d86da55", + "83": "0e12bd186691921dc982d43ebe2e82da0b42f1b9570df0593aeaf6d0dfec8dd4", + "84": "70f98ad6d8d00f6214efca098f765450ffc851c37ed86030015ff9b9528af92f", + "85": "5ad58ace0f8f4936f5ba6f058ef40d27c621a109f744537256ac67522e036210", + "86": "2529f71504bc1cd8289773ab9d8af82175405cf42ac16637a71e40d2a6fe1181", + "87": "976332249b905434f5f4a526b21c74aa20ea71754798600cd42571e8538890ba", + "88": "721896e77c5552778ec7c08af0d7264a5c73fd14eec1d38ef48ff8c9918741c8", + "89": "b312f0896a48b3bc32607c663912db44f2f5c34b64a2c8bf95880e98463a6226", + "9": "6267b3845952589a6f3594a1e07902bfd52ec3ecfaa85d398c4b002570f37e07", + "90": "b70fcbf561da4e5ea81ff7ccb2e8453a2f6f53574d6b7481b26b553a0f47bfc7", + "91": "d9bd3bcb8e1f34099793ac90090dc79bb4471580d4d02531669cc47fbfe62d01", + "92": "affd3209eb5c8eabe9d467982f3e0d0b8e93485f21817d307247e60bb4145c94", + "93": "64f57bc8f2a06039f7192bf9a84a6770a9febf145713e8630e89f930a34dd581", + "94": "5e33ea96a313a76df9d88e55cac1297a19c29a2e6a5bad85006976a350d1c41a", + "95": "1c177bdbc96c27000df991b8bb66329825891dad4dba433fb93a0b7485d5bf82" }, "gfx950_attention_tiled_2d_fastkv_regp": { "0": "e1fadd21fc2e1e2701d08d91d04fbb52034b6bccb6205c6d28b42fb210a5d6ba", @@ -6486,7 +6638,26 @@ "18": "6d6f02a547cd98da2c8c2961aa07a31551ead49bedb8ab041c1ac25e13e2950a", "19": "16015c221eb6a733534c1950dd21aafad2e4e2a0dbc4bcb02b642e2956803831", "2": "55c737ed7f81060d5f9202dd7f3fabe25917c8497e7fa03edd921e2e552be9e9", + "20": "2230c3aae93c09faac76a04c6d4ab43b7ed786ee3de44ad5c31a8987d6e27f59", + "21": "3bb59c4a121d5913fcc382dc550f081d7e71d4d4f30595cee90fefa7f42edf3e", + "22": "54c6a4a59cbdff603a95ba7b4c48b5e0f5a2cd4bfb2050f825447b9db2353632", + "23": "8b7f4bb5f824e6fad3e70bc21d6ef1c5ae13b9fbe1b7cdc767246f68d9a662a2", + "24": "56ddb4d3fe1d7989bd6731fdb68b9d86a7a9317c9f5e8dcd758989b6571bd8f0", + "25": "19af297c4cbeb40c1bbc31efe17ccd84e7127da444fe9715e481bfbc00f2bf47", + "26": "28191a9c513a956898b1c0bcdc6d638f8e9ab48c2c7380b00f57e6c668a4cf21", + "27": "f2ef2d18ed8f642f0396960c3a91ea2898b66d474c99cb04719ca3e678c55d57", + "28": "99667da65ccf40ae74e0bdbd3f6cc02c78fcafd02c189051db8e5d07daad216c", + "29": "810238696b9e2a712b564e996ab55da6e6bbb418c00727405aaa5a452be0c1fd", "3": "bc950eea70f3c80d7e64c6fdfad5c96ba3fb4da49a316168cfd1bf20f6b20f13", + "30": "4a65ee5b3528bd7548785534a6eaa742c8158144c5a825ef6d04a9af368c1f89", + "31": "4e5307c3a8d2aca8d87b588d4b0440d2d19d83d9b95a987d2cb8c27b383606d0", + "32": "0f97c111ef05d651425aa6bbfa3b57d87d896cd5dd0a7d0ce495a501213784fa", + "33": "94d168f7522c2d2f12a8a3535ce2ffb40e176e0602499f3d380ac0dd59886cbc", + "34": "2657c3b6e0b093bf976d70f32810669fd1a7d6a4f446b602226d0ccbd382f4aa", + "35": "4cd8a9f1b83aced6ccf02dd654d6c9b1203d54f7a7149a312d64a0ea8319ec16", + "36": "89fd4b0e8d63babc67f4e90408ef1e900239facfdd3dab7b5a9892f4d00077d8", + "37": "bf62d411f42003c6f6d386c51ed14039a4d2339a15100ba7f053aa0be44d2122", + "38": "b6aa08d96b4f6431155e4c009b5828844605272cad4d18ec7babe08fcd96bfaa", "4": "dbad6405c1fb6e15d364d61db3ea7a9aae57e32c8cb64cd0fabb96862c823d69", "5": "bda1d590f8870c8b1bf8a8fea4ffd99cdd1af6741fcd2d6224fa2286956230be", "6": "8458e403a87e59406586051bbf9b4498d67aea928e654eaaae67cf55b9b4dbfb", @@ -6657,8 +6828,27 @@ "74": "bb8b0a1e8e06e91044209b4407f8ddfc8dcb3c51d91d28f7673fc209c8d84bb0", "75": "95c373866387c3529e8d60536d70d0d6372d782f1c1e64b067fa86daf3ca0fdd", "76": "fd54658289a24225c4a5b7a7ea339f4337b9b297f599b482da8ce45367c466be", + "77": "453462d5c79abebc0a3c11a32e0dec5593b54a20eceeb862062f5c48de313c48", + "78": "b5ca9819239715029eeed3e010ae7c22285de81c4283bd38b6e5c20fde12b490", + "79": "8bb6e846ecc5be2458d6df617f528372e6dab756748baf4d6d3cca56347e40fd", "8": "9a4431d34fde7e376552fc757ff75be86b1c4c6194b3f95c93c0ab9fbbf9f2a4", - "9": "6267b3845952589a6f3594a1e07902bfd52ec3ecfaa85d398c4b002570f37e07" + "80": "969e3f1ca771532273dc64125eeee6fcc1f459477c57e1a828bf688151b9eaa9", + "81": "f29ef6ec4cf99dd85a5417becc55bb218497808635e2fa72574ba5993eb8c05a", + "82": "d2d878bb04e0f0bb797a7d4bbe54110324dc1c5b22062c38f9a2da023d86da55", + "83": "0e12bd186691921dc982d43ebe2e82da0b42f1b9570df0593aeaf6d0dfec8dd4", + "84": "70f98ad6d8d00f6214efca098f765450ffc851c37ed86030015ff9b9528af92f", + "85": "5ad58ace0f8f4936f5ba6f058ef40d27c621a109f744537256ac67522e036210", + "86": "2529f71504bc1cd8289773ab9d8af82175405cf42ac16637a71e40d2a6fe1181", + "87": "976332249b905434f5f4a526b21c74aa20ea71754798600cd42571e8538890ba", + "88": "721896e77c5552778ec7c08af0d7264a5c73fd14eec1d38ef48ff8c9918741c8", + "89": "b312f0896a48b3bc32607c663912db44f2f5c34b64a2c8bf95880e98463a6226", + "9": "6267b3845952589a6f3594a1e07902bfd52ec3ecfaa85d398c4b002570f37e07", + "90": "b70fcbf561da4e5ea81ff7ccb2e8453a2f6f53574d6b7481b26b553a0f47bfc7", + "91": "d9bd3bcb8e1f34099793ac90090dc79bb4471580d4d02531669cc47fbfe62d01", + "92": "affd3209eb5c8eabe9d467982f3e0d0b8e93485f21817d307247e60bb4145c94", + "93": "64f57bc8f2a06039f7192bf9a84a6770a9febf145713e8630e89f930a34dd581", + "94": "5e33ea96a313a76df9d88e55cac1297a19c29a2e6a5bad85006976a350d1c41a", + "95": "1c177bdbc96c27000df991b8bb66329825891dad4dba433fb93a0b7485d5bf82" }, "gfx950_attention_tiled_2d_fastkv_regp": { "0": "e1fadd21fc2e1e2701d08d91d04fbb52034b6bccb6205c6d28b42fb210a5d6ba", diff --git a/dnn-providers/hip-kernel-provider/rocke/library/tests/test_attention_tiled_2d_runtime_layout_gfx950.py b/dnn-providers/hip-kernel-provider/rocke/library/tests/test_attention_tiled_2d_runtime_layout_gfx950.py new file mode 100644 index 000000000000..fec6f1fb6e47 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/rocke/library/tests/test_attention_tiled_2d_runtime_layout_gfx950.py @@ -0,0 +1,815 @@ +# Copyright (c) Advanced Micro Devices, Inc., or its affiliates. +# SPDX-License-Identifier: MIT + +"""Device numerics of the gfx950 tiled-2D unified attention in runtime-layout mode. + +``runtime_layout=True`` takes head counts, the sliding window, every Q/O/KV +stride and a dense-or-ragged Q mapping as kernel arguments. Each catalog kernel +runs a set of scenarios against a numpy gather-then-dense reference: + +- vLLM's interleaved KV view (one ``[nb, Hkv, bs, 2D]`` allocation, K is + ``[..., :D]``, V is ``[..., D:]``) and plain NHD caches; +- shuffled page tables with ``0x7fffffff`` past each sequence's used blocks and + NaN in every cache slot that is not a live token (so any load of a padded + token or a stale table entry shows up as a NaN or a fault); +- dense Q (L=1, L=3 with padded rows) and ragged Q (mixed decode and chunked + prefill rows, offset gaps with ``seq_lens_q``, exact offsets without, a + first origin past the first q-blocks); +- sliding window on and off, Q token strides of a fused QKV split, padded O + token strides, and grids smaller than the q-block count (grid-stride loop); +- a separate V block table (``block_tables_v_ptr``) that places V in other + blocks than K. + +Outputs must be finite and within tolerance; rows that see no key, and a dense +Q's padded rows past seq_lens_q, must be exactly zero; every O element the +kernel must not write (a ragged Q's gap rows past seq_lens_q, token-stride +padding, guard regions) must keep its sentinel. Sinks come as fp32 logits +(``sink_is_f32``) or in the Q dtype. The device test is skipped +unless the visible device is gfx950; the catalog check needs no device. +""" + +from __future__ import annotations + +import itertools +import math +import zlib +from dataclasses import dataclass +from typing import Optional, Sequence, Tuple + +import numpy as np +import pytest + +_ARCH = None +try: + from rocke.runtime.hip_module import get_device_arch + + _ARCH = get_device_arch(0) +except Exception: # noqa: BLE001 - no runtime / no device + _ARCH = None + +_NEEDS_GFX950 = pytest.mark.skipif( + _ARCH != "gfx950", reason=f"needs gfx950; device is {_ARCH}" +) + +NO_WINDOW = 0x3FFFFFFF +GARBAGE_BLOCK = 0x7FFFFFFF +SENTINEL = 0xDEAD # raw 16-bit pattern of every O element the kernel must not write +GUARD = 64 # elements of sentinel before and after the O view +NUM_KV_HEADS = 2 +# The kernel rounds P and O to bf16/fp16 (8 or 11 mantissa bits); the reference +# stays in fp32. 2e-2 covers that rounding, not a looser kernel. +ATOL = 2e-2 +RTOL = 2e-2 + + +@dataclass(frozen=True) +class Scenario: + name: str + seq_lens: Tuple[int, ...] + # DENSE when ``q_uniform_len > 0``: every sequence owns ``q_uniform_len`` Q + # rows; ``q_lens`` (if given) is ``seq_lens_q``. RAGGED otherwise: ``q_lens`` + # are the query lengths and ``gaps`` the unused tokens after each sequence, + # or ``offsets`` gives off[0..B] as is (non-decreasing, off[B] the end of + # the last block; needs ``has_seq_lens_q``). The kernel gets + # q_uniform_len = 0. + q_uniform_len: int = 0 + q_lens: Optional[Tuple[int, ...]] = None + gaps: Optional[Tuple[int, ...]] = None + offsets: Optional[Tuple[int, ...]] = None + has_seq_lens_q: bool = False + window: int = NO_WINDOW + kv_layout: str = "vllm" # "vllm" interleaved or "nhd" + fused_qkv: bool = True # Q token stride = (Hq + 2*Hkv) * D + grid_y_div: int = 1 # launch grid.y = ceil(full grid.y / grid_y_div) + # V pages through its own block table (another permutation of the blocks); + # otherwise block_tables_v_ptr is block_tables_ptr. + separate_v_table: bool = False + + +SCENARIOS = ( + # Decode batch; seq_len 0 rows still exist (no seq_lens_q) and must be 0. + Scenario("dense_l1", seq_lens=(37, 0, 1, 130, 64), q_uniform_len=1), + # Speculative-style L=3 with padded rows (seq_lens_q < L, one empty). + Scenario( + "dense_l3_padded", + seq_lens=(50, 3, 0, 77), + q_uniform_len=3, + q_lens=(3, 2, 0, 1), + has_seq_lens_q=True, + window=21, + kv_layout="nhd", + ), + Scenario( + "dense_l3_grid_stride", + seq_lens=(9, 40, 3, 100, 18, 66), + q_uniform_len=3, + kv_layout="nhd", + fused_qkv=False, + grid_y_div=3, + ), + # Mixed decode + chunked prefill, offset gaps, an empty sequence. + Scenario( + "ragged_mixed_gap", + seq_lens=(33, 17, 1, 0, 140, 69), + q_lens=(1, 17, 1, 0, 40, 5), + gaps=(0, 3, 0, 2, 7, 2), + has_seq_lens_q=True, + ), + Scenario( + "ragged_exact_window", + seq_lens=(6, 90, 50), + q_lens=(6, 1, 23), + window=16, + kv_layout="nhd", + ), + Scenario( + "ragged_grid_stride_window", + seq_lens=(33, 17, 1, 140, 69), + q_lens=(1, 17, 1, 40, 5), + gaps=(0, 3, 0, 7, 2), + has_seq_lens_q=True, + window=29, + grid_y_div=4, + ), + Scenario( + "dense_l1_separate_v_table", + seq_lens=(37, 0, 1, 130, 64), + q_uniform_len=1, + separate_v_table=True, + ), + Scenario( + "ragged_separate_v_table_window", + seq_lens=(33, 17, 1, 0, 140, 69), + q_lens=(1, 17, 1, 0, 40, 5), + gaps=(0, 3, 0, 2, 7, 2), + has_seq_lens_q=True, + window=29, + kv_layout="nhd", + separate_v_table=True, + ), + # 0 < seq_len < q_len: the leading rows see no key (zeros), the rest see the + # keys up to their own bottom-right diagonal. + Scenario( + "dense_l5_keyless_leading_rows", + seq_lens=(2, 1, 40, 4), + q_uniform_len=5, + q_lens=(5, 5, 3, 5), + has_seq_lens_q=True, + ), + Scenario( + "ragged_keyless_leading_rows_window", + seq_lens=(2, 30, 1), + q_lens=(5, 1, 4), + gaps=(1, 0, 2), + has_seq_lens_q=True, + window=16, + kv_layout="nhd", + ), + # One sequence: the table's row stride is not passed (0), so the length cap + # must come from its width. + Scenario("dense_l1_single_sequence", seq_lens=(100,), q_uniform_len=1), + # One decode row whose origin lies past the first q-blocks: those blocks + # find no sequence and write nothing (rows before off[0] keep the sentinel). + Scenario( + "ragged_shifted_first_origin", + seq_lens=(20,), + q_lens=(1,), + offsets=(64, 65), + has_seq_lens_q=True, + ), +) + + +def _kernel_cases(): + """(dtype, head_size, block_size, qpk) kernels exercised on the device.""" + cases = list( + itertools.product(("bf16", "fp16"), (64, 128, 256), (16, 64), (1, 4, 5, 8)) + ) + cases += [(dt, hd, 32, 4) for dt in ("bf16", "fp16") for hd in (64, 128, 256)] + return cases + + +_LAUNCHERS: dict = {} + + +def _launcher( + dtype: str, head_size: int, block_size: int, qpk: int, use_sinks: bool = False +): + key = (dtype, head_size, block_size, qpk, use_sinks) + if key not in _LAUNCHERS: + from kernels.gfx950.attention_tiled_2d import ( + UnifiedAttention2DTiledSpec, + build_unified_attention_2d_tiled, + runtime_layout_catalog_spec, + supports_tiled_2d_spec, + ) + from rocke.helpers.compile import compile_kernel + from rocke.helpers.spec import SignatureBuilder + from rocke.runtime.launcher import KernelLauncher + + spec = runtime_layout_catalog_spec( + dtype=dtype, + head_size=head_size, + block_size=block_size, + num_queries_per_kv=qpk, + use_sinks=use_sinks, + ) + ok, why = supports_tiled_2d_spec(spec, arch="gfx950") + assert ok, why + art = compile_kernel(build_unified_attention_2d_tiled(spec), arch="gfx950") + io = "f16" if dtype == "fp16" else "bf16" + sb = SignatureBuilder() + for name in ("output_ptr", "query_ptr", "key_cache_ptr", "value_cache_ptr"): + sb.ptr(name, io) + sb.ptr("sink_ptr", io) + sb.ptr("block_tables_ptr", "i32") + sb.ptr("seq_lens_ptr", "i32") + sb.ptr("alibi_slopes_ptr", "f32") + sb.ptr("qq_bias_ptr", "f32") + sb.ptr("query_start_len_ptr", "i32") + for name in ("scale", "k_scale", "v_scale", "out_scale", "softcap"): + sb.scalar(name, "f32") + for name in ("num_seqs", "block_table_stride", "qq_bias_stride_0"): + sb.scalar(name, "i32") + for name in UnifiedAttention2DTiledSpec.RUNTIME_KERNARG_FIELDS: + sb.scalar(name, "i32") + sb.ptr("block_tables_v_ptr", "i32") + sb.ptr("seq_lens_q_ptr", "i32") + for name in ( + "has_seq_lens_q", + "q_uniform_len", + "q_seq_stride", + "q_tok_stride", + "q_head_stride", + "o_seq_stride", + "o_tok_stride", + "o_head_stride", + "kv_block_stride", + "kv_tok_stride", + "kv_head_stride", + "kv_block_span_bytes", + "q_block_grid", + "sink_is_f32", + "num_kv_blocks", + "block_table_width", + ): + sb.scalar(name, "i32") + launcher = KernelLauncher( + hsaco=art.hsaco, kernel_name=art.kernel_name, signature=sb.build() + ) + _LAUNCHERS[key] = (spec, launcher) + return _LAUNCHERS[key] + + +def _encode(a: np.ndarray, dtype: str) -> np.ndarray: + """fp32 -> raw 16-bit storage of ``dtype``.""" + from rocke.numeric.bf16 import f32_to_bf16 + + if dtype == "bf16": + return f32_to_bf16(a.astype(np.float32)) + return a.astype(np.float16).view(np.uint16) + + +def _decode(a: np.ndarray, dtype: str) -> np.ndarray: + from rocke.numeric.bf16 import bf16_to_f32 + + if dtype == "bf16": + return bf16_to_f32(a) + return a.view(np.float16).astype(np.float32) + + +def _reference( + q: np.ndarray, + k: Sequence[np.ndarray], + v: Sequence[np.ndarray], + seq_len: int, + q_len: int, + qpk: int, + window: int, + scale: float, + sinks: Optional[np.ndarray] = None, +) -> np.ndarray: + """Bottom-right causal (+ window) attention of one sequence, fp32. + + ``q`` is ``[q_len, Hq, D]``; ``k``/``v`` are the gathered ``[seq_len, Hkv, D]`` + live tokens. ``sinks`` ([Hq] logits, not scaled) join the softmax max and + denominator. Rows with no visible key are zero. + """ + hq, d = q.shape[1], q.shape[2] + out = np.zeros((q_len, hq, d), dtype=np.float32) + if q_len == 0: + return out + diag = (seq_len - q_len) + np.arange(q_len)[:, None] + key = np.arange(seq_len)[None, :] + visible = (key <= diag) & (diag - key < window) + for h in range(hq): + kvh = h // qpk + s = (q[:, h, :] @ k[:, kvh, :].T) * scale + s = np.where(visible, s, -np.inf) + row_max = np.max(s, axis=1, initial=-np.inf, where=visible) + has_key = np.isfinite(row_max) + if sinks is not None: + row_max = np.where(has_key, np.maximum(row_max, sinks[h]), row_max) + p = np.where(visible, np.exp(s - np.where(has_key, row_max, 0.0)[:, None]), 0.0) + denom = p.sum(axis=1) + if sinks is not None: + denom = denom + np.where(has_key, np.exp(sinks[h] - row_max), 0.0) + o = p @ v[:, kvh, :] + out[:, h, :] = np.where( + has_key[:, None], o / np.where(has_key, denom, 1.0)[:, None], 0.0 + ) + return out + + +def _run( + dtype: str, + head_size: int, + block_size: int, + qpk: int, + sc: Scenario, + use_sinks: bool = False, + sink_f32: bool = False, + bad_page: Optional[str] = None, +): + from rocke.runtime.hip_module import Runtime + from rocke.runtime.host_buffers import as_u8_buffer + from rocke.runtime.launcher import DeviceMem, LaunchConfig + + spec, launcher = _launcher(dtype, head_size, block_size, qpk, use_sinks) + rng = np.random.default_rng( + zlib.crc32( + f"{dtype}/{head_size}/{block_size}/{qpk}/{sc.name}/{use_sinks}".encode() + ) + ) + D, BS = head_size, block_size + hkv = NUM_KV_HEADS + hq = hkv * qpk + B = len(sc.seq_lens) + seq_lens = np.array(sc.seq_lens, dtype=np.int32) + dense = sc.q_uniform_len > 0 + if dense: + L = sc.q_uniform_len + slq = np.array(sc.q_lens if sc.q_lens else (L,) * B, dtype=np.int32) + q_lens = np.minimum(slq, L) if sc.has_seq_lens_q else np.full(B, L, np.int32) + rows_per_seq = np.full(B, L) + starts = np.arange(B) * L + offsets = None + else: + q_lens = np.array(sc.q_lens, dtype=np.int32) + slq = q_lens + if sc.offsets is not None: + assert sc.has_seq_lens_q, "explicit offsets need seq_lens_q" + offsets = np.array(sc.offsets, dtype=np.int32) + rows_per_seq = q_lens + else: + gaps = np.array(sc.gaps if sc.gaps else (0,) * B, dtype=np.int32) + offsets = np.zeros(B + 1, dtype=np.int32) + offsets[1:] = np.cumsum(q_lens + gaps) + rows_per_seq = q_lens + gaps + starts = offsets[:B] + total_rows = int((starts + rows_per_seq).max()) if B else 0 + q_uniform_len = sc.q_uniform_len if dense else 0 + + # ---- Q (optionally a fused-QKV row) ---- + q_tok = (hq + 2 * hkv) * D if sc.fused_qkv else hq * D + q_host_f = rng.standard_normal((max(total_rows, 1), q_tok)).astype(np.float32) + q_host = _encode(q_host_f, dtype) + q_view = _decode(q_host, dtype)[:, : hq * D].reshape(-1, hq, D) + + # ---- O with padded token stride and sentinel guards ---- + o_tok = hq * D + 8 + o_host = np.full(GUARD + max(total_rows, 1) * o_tok + GUARD, SENTINEL, np.uint16) + + # ---- paged KV cache: NaN everywhere except live tokens ---- + nblk = [(int(s) + BS - 1) // BS for s in seq_lens] + num_blocks = sum(nblk) + 3 + perm = rng.permutation(num_blocks).astype(np.int32) + v_perm = ( + rng.permutation(num_blocks).astype(np.int32) if sc.separate_v_table else perm + ) + bt_width = max(nblk) + 2 + block_tables = np.full((B, bt_width), GARBAGE_BLOCK, dtype=np.int32) + v_block_tables = np.full((B, bt_width), GARBAGE_BLOCK, dtype=np.int32) + nan_bits = _encode(np.array([np.nan], np.float32), dtype)[0] + if sc.kv_layout == "vllm": + cache = np.full((num_blocks, hkv, BS, 2 * D), nan_bits, np.uint16) + kv_block_stride, kv_head_stride, kv_tok_stride = ( + hkv * BS * 2 * D, + BS * 2 * D, + 2 * D, + ) + else: + k_cache = np.full((num_blocks, BS, hkv, D), nan_bits, np.uint16) + v_cache = np.full((num_blocks, BS, hkv, D), nan_bits, np.uint16) + kv_block_stride, kv_tok_stride, kv_head_stride = BS * hkv * D, hkv * D, D + kv_span_bytes = ((hkv - 1) * kv_head_stride + (BS - 1) * kv_tok_stride + D) * 2 + gathered = [] + used = 0 + for b in range(B): + n = nblk[b] + blocks = perm[used : used + n] + v_blocks = v_perm[used : used + n] + used += n + block_tables[b, :n] = blocks + v_block_tables[b, :n] = v_blocks + sl = int(seq_lens[b]) + kf = _encode(rng.standard_normal((sl, hkv, D)).astype(np.float32), dtype) + vf = _encode(rng.standard_normal((sl, hkv, D)).astype(np.float32), dtype) + for t in range(sl): + blk, vblk, tt = blocks[t // BS], v_blocks[t // BS], t % BS + if sc.kv_layout == "vllm": + cache[blk, :, tt, :D] = kf[t] + cache[vblk, :, tt, D:] = vf[t] + else: + k_cache[blk, tt] = kf[t] + v_cache[vblk, tt] = vf[t] + gathered.append((_decode(kf, dtype), _decode(vf, dtype))) + if bad_page is not None: + # The last sequence's page ids (K and V) all lie outside [0, num_blocks): + # they read as masked pages, so its K and V are zeros and its output is + # zero, whatever the cache holds there (NaN in the unowned blocks). + bad = {"past_end": num_blocks, "int_max": 0x7FFFFFFF, "negative": -1}[bad_page] + last = B - 1 + assert nblk[last] > 0, "the corrupted sequence must own blocks" + block_tables[last, : nblk[last]] = bad + v_block_tables[last, : nblk[last]] = bad + kf0, vf0 = gathered[last] + gathered[last] = (np.zeros_like(kf0), np.zeros_like(vf0)) + + # ---- launch ---- + bq = spec.block_q + if dense: + full_grid_y = B * ((sc.q_uniform_len + bq - 1) // bq) + else: + full_grid_y = int(offsets[-1]) // bq + B + grid_y = max(1, -(-full_grid_y // sc.grid_y_div)) + scale = 1.0 / math.sqrt(D) + + rt = Runtime() + bufs = [] + + def upload(a: np.ndarray) -> DeviceMem: + a = np.ascontiguousarray(a) + m = DeviceMem(max(a.nbytes, 4)) + if a.nbytes: + rt.memcpy_h2d(m.ptr(), as_u8_buffer(a), a.nbytes) + bufs.append(m) + return m + + q_dev = upload(q_host) + o_dev = upload(o_host) + seq_lens_dev = upload(seq_lens) + bt_dev = upload(block_tables) + v_bt_dev = upload(v_block_tables) if sc.separate_v_table else bt_dev + if sc.separate_v_table: + assert not np.array_equal(v_block_tables, block_tables) + slq_dev = upload(slq) if sc.has_seq_lens_q else seq_lens_dev + # DENSE: a one-entry offsets buffer, so only index 0 is addressable. + cu_dev = upload(offsets if offsets is not None else np.zeros(1, np.int32)) + if sc.kv_layout == "vllm": + cache_dev = upload(cache) + k_ptr, v_ptr = cache_dev.ptr(), cache_dev.ptr() + D * 2 + else: + k_ptr, v_ptr = upload(k_cache).ptr(), upload(v_cache).ptr() + # Sinks spread from negligible to row-dominating so a head that loses (or + # reads another head's) sink fails the comparison. fp32 logits when + # ``sink_f32``, else in the I/O dtype. + sinks_view = None + sink_ptr = 0 + if use_sinks: + sinks_f = rng.uniform(-4.0, 6.0, hq).astype(np.float32) + if sink_f32: + sinks_view = sinks_f + sink_ptr = upload(sinks_f) + else: + sinks_host = _encode(sinks_f, dtype) + sinks_view = _decode(sinks_host, dtype) + sink_ptr = upload(sinks_host) + values = { + "output_ptr": o_dev.ptr() + GUARD * 2, + "query_ptr": q_dev, + "key_cache_ptr": k_ptr, + "value_cache_ptr": v_ptr, + "sink_ptr": sink_ptr, + "block_tables_ptr": bt_dev, + "seq_lens_ptr": seq_lens_dev, + "alibi_slopes_ptr": 0, + "qq_bias_ptr": 0, + "query_start_len_ptr": cu_dev, + "scale": scale, + "k_scale": 1.0, + "v_scale": 1.0, + "out_scale": 1.0, + "softcap": 0.0, + "num_seqs": B, + # The engine passes the batch stride of hipDNN's page table, which is 0 for a + # batch of one (a unit extent's stride is irrelevant); the row width is its own + # argument. + "block_table_stride": bt_width if B > 1 else 0, + "qq_bias_stride_0": 0, + "seq_lens_q_ptr": slq_dev, + "block_tables_v_ptr": v_bt_dev, + "has_seq_lens_q": int(sc.has_seq_lens_q), + "q_uniform_len": q_uniform_len, + "num_query_heads": hq, + "num_kv_heads": hkv, + "sliding_window": sc.window, + "q_seq_stride": sc.q_uniform_len * q_tok if dense else q_tok, + "q_tok_stride": q_tok, + "q_head_stride": D, + "o_seq_stride": sc.q_uniform_len * o_tok if dense else o_tok, + "o_tok_stride": o_tok, + "o_head_stride": D, + "kv_block_stride": kv_block_stride, + "kv_tok_stride": kv_tok_stride, + "kv_head_stride": kv_head_stride, + "kv_block_span_bytes": kv_span_bytes, + "q_block_grid": grid_y, + "sink_is_f32": int(sink_f32), + "num_kv_blocks": num_blocks, + "block_table_width": bt_width, + } + launcher( + values, + config=LaunchConfig( + grid=(hkv, grid_y, 1), block=(64 * spec.num_warps, 1, 1), fence=True + ), + ) + rt.memcpy_d2h(as_u8_buffer(o_host), o_dev.ptr(), o_host.nbytes) + + # ---- check ---- + written = np.zeros(o_host.shape, dtype=bool) + for b in range(B): + ql = int(q_lens[b]) + if ql == 0: + continue + rows = int(starts[b]) + np.arange(ql) + kf, vf = gathered[b] + ref = _reference( + q_view[rows], + kf, + vf, + int(seq_lens[b]), + ql, + qpk, + sc.window, + scale, + sinks_view, + ) + idx = ( + GUARD + + rows[:, None, None] * o_tok + + np.arange(hq)[None, :, None] * D + + np.arange(D)[None, None, :] + ) + written[idx] = True + got = _decode(o_host[idx], dtype) + where = f"{sc.name} seq {b} (seq_len {seq_lens[b]}, q_len {ql})" + assert np.isfinite(got).all(), f"non-finite output in {where}" + no_key = ~np.any(ref != 0.0, axis=2) + assert ( + got[no_key] == 0.0 + ).all(), f"rows with no visible key not zero in {where}" + err = np.abs(got - ref) - (ATOL + RTOL * np.abs(ref)) + assert ( + err.max() <= 0.0 + ), f"{where}: max_abs {np.abs(got - ref).max():.3e} exceeds tolerance" + # A dense Q's rows past seq_lens_q are padding: they store zeros. A ragged + # Q's gap rows (past seq_lens_q, up to the next offset) belong to no + # sequence: the kernel must not write them, so they keep the sentinel. + for b in range(B if dense else 0): + pad = int(starts[b]) + np.arange(int(q_lens[b]), int(rows_per_seq[b])) + if pad.size == 0: + continue + idx = GUARD + pad[:, None] * o_tok + np.arange(hq * D)[None, :] + written[idx] = True + assert ( + _decode(o_host[idx], dtype) == 0.0 + ).all(), f"{sc.name} seq {b}: padding rows not zero" + untouched = o_host[~written] + assert (untouched == SENTINEL).all(), ( + f"{sc.name}: {(untouched != SENTINEL).sum()} O elements outside the owned " + "rows were written (token-stride padding or guard)" + ) + del bufs + + +@pytest.mark.gpu +@_NEEDS_GFX950 +@pytest.mark.parametrize("sc", SCENARIOS, ids=lambda s: s.name) +@pytest.mark.parametrize( + "dtype,head_size,block_size,qpk", + _kernel_cases(), + ids=lambda v: str(v), +) +def test_runtime_layout_matches_reference(dtype, head_size, block_size, qpk, sc): + _run(dtype, head_size, block_size, qpk, sc) + + +# Sink objects with NUM_KV_HEADS=2: heads of KV head 1 need the runtime query-head +# bound and mapping to find their sink. +_SINK_KERNEL_CASES = ( + ("bf16", 64, 16, 1), + ("bf16", 128, 32, 4), + ("fp16", 128, 64, 5), + ("bf16", 256, 16, 8), + ("fp16", 64, 32, 8), +) + + +@pytest.mark.gpu +@_NEEDS_GFX950 +@pytest.mark.parametrize("sink_f32", (False, True), ids=("sink_qdtype", "sink_f32")) +@pytest.mark.parametrize("sc", SCENARIOS, ids=lambda s: s.name) +@pytest.mark.parametrize( + "dtype,head_size,block_size,qpk", _SINK_KERNEL_CASES, ids=lambda v: str(v) +) +def test_runtime_layout_sinks_match_reference( + dtype, head_size, block_size, qpk, sc, sink_f32 +): + _run(dtype, head_size, block_size, qpk, sc, use_sinks=True, sink_f32=sink_f32) + + +@pytest.mark.gpu +@_NEEDS_GFX950 +@pytest.mark.parametrize("bad_page", ("past_end", "int_max", "negative")) +@pytest.mark.parametrize("use_sinks", (False, True), ids=("nosink", "sinks")) +@pytest.mark.parametrize( + "dtype,head_size,block_size,qpk", _SINK_KERNEL_CASES[:3], ids=lambda v: str(v) +) +def test_runtime_layout_contains_out_of_range_page_ids( + dtype, head_size, block_size, qpk, use_sinks, bad_page +): + """A page id outside the cache reads as masked: no memory outside the cache is read + (the other sequences are exact), and the corrupted sequence's output is zero.""" + sc = next(s for s in SCENARIOS if s.name == "dense_l1") + assert sc.seq_lens[-1] > 0 + _run(dtype, head_size, block_size, qpk, sc, use_sinks=use_sinks, bad_page=bad_page) + + +def test_runtime_layout_sinks_accepted(): + """runtime_layout composes with use_sinks; the object keeps ``sink_ptr``.""" + from kernels.gfx950.attention_tiled_2d import ( + build_unified_attention_2d_tiled, + runtime_layout_catalog_spec, + supports_tiled_2d_spec, + ) + + spec = runtime_layout_catalog_spec( + dtype="bf16", head_size=128, block_size=32, num_queries_per_kv=4, use_sinks=True + ) + ok, why = supports_tiled_2d_spec(spec, arch="gfx950") + assert ok, why + assert spec.use_sinks + assert "sinks" in spec.kernel_name() + assert spec.kernel_name().endswith("_rtl") + kernel = build_unified_attention_2d_tiled(spec) + assert "sink_ptr" in [p.name.lstrip("%") for p in kernel.params] + + +def test_runtime_layout_appends_v_block_table(): + """V's block table is the first appended kernarg, after the 18 fixed ones and + the runtime shape kernargs.""" + from kernels.gfx950.attention_tiled_2d import ( + _RTL_PARAMS, + build_unified_attention_2d_tiled, + runtime_layout_catalog_spec, + ) + + spec = runtime_layout_catalog_spec( + dtype="fp16", head_size=64, block_size=16, num_queries_per_kv=1 + ) + names = [p.name.lstrip("%") for p in build_unified_attention_2d_tiled(spec).params] + assert names[5] == "block_tables_ptr" + assert names[18:21] == ["num_query_heads", "num_kv_heads", "sliding_window"] + assert names[21:] == list(_RTL_PARAMS) + assert names[21] == "block_tables_v_ptr" + + +def test_runtime_layout_catalog_supported_and_named(): + """Every catalog combination passes the support predicate and carries ``rtl``.""" + from kernels.gfx950.attention_tiled_2d import ( + runtime_layout_catalog_spec, + supports_tiled_2d_spec, + ) + + for dtype, hd, bs, qpk in itertools.product( + ("fp16", "bf16"), (64, 128, 256), (16, 32, 64), (1, 2, 4, 5, 6, 7, 8, 16) + ): + spec = runtime_layout_catalog_spec( + dtype=dtype, head_size=hd, block_size=bs, num_queries_per_kv=qpk + ) + ok, why = supports_tiled_2d_spec(spec, arch="gfx950") + assert ok, (spec, why) + assert spec.kernel_name().endswith("_rtl") + + +@pytest.mark.parametrize( + "overrides,needle", + [ + (dict(use_additive_bias=True), "use_additive_bias"), + (dict(emit_lse=True), "emit_lse"), + (dict(sliding_window=128), "sliding_window"), + (dict(use_v_double_buffer=True), "use_v_double_buffer"), + (dict(use_qblock_reverse=True), "use_qblock_reverse"), + (dict(tile_size=64), "tile_size"), + (dict(tile_size=0), "tile_size"), + (dict(tile_size=-16), "tile_size"), + # Refused before the async-DMA divisibility check divides by it. + (dict(num_warps=0), r"runtime_layout requires num_warps in \{1, 2, 4, 8\}"), + ], +) +def test_runtime_layout_incompatible_spec_rejected(overrides, needle): + """Flags outside the runtime_layout pipeline are refused at spec construction.""" + import dataclasses + + from kernels.gfx950.attention_tiled_2d import runtime_layout_catalog_spec + + spec = runtime_layout_catalog_spec( + dtype="bf16", head_size=128, block_size=32, num_queries_per_kv=4 + ) + with pytest.raises(ValueError, match=needle): + dataclasses.replace(spec, **overrides) + + +@pytest.mark.parametrize("value", ["false", "", 1, 0, None]) +def test_runtime_layout_must_be_a_bool(value): + """A truthy non-bool would build the runtime_layout ABI for a caller that thinks it + asked for the fixed layout, so the flag is checked, never coerced.""" + import dataclasses + + from kernels.gfx950.attention_tiled_2d import runtime_layout_catalog_spec + + spec = runtime_layout_catalog_spec( + dtype="bf16", head_size=128, block_size=32, num_queries_per_kv=4 + ) + with pytest.raises(ValueError, match="runtime_layout must be a bool"): + dataclasses.replace(spec, runtime_layout=value) + + +@pytest.mark.parametrize( + "overrides,needle", + [ + # use_additive_bias is not a field of the C spec struct. + (dict(emit_lse=True), "emit_lse"), + (dict(sliding_window=128), "sliding_window"), + (dict(use_v_double_buffer=True), "use_v_double_buffer"), + (dict(use_qblock_reverse=True), "use_qblock_reverse"), + (dict(tile_size=64), "tile_size"), + (dict(tile_size=0), "tile_size"), + (dict(tile_size=-16), "tile_size"), + (dict(num_warps=0), r"runtime_layout requires num_warps in \{1, 2, 4, 8\}"), + ], +) +def test_runtime_layout_native_builder_rejects_incompatible_spec(overrides, needle): + """The C twin of the reject check refuses the same specs, with the same cause.""" + import dataclasses + + from kernels.gfx950.attention_tiled_2d import runtime_layout_catalog_spec + + engine = pytest.importorskip("rocke_engine") + spec = runtime_layout_catalog_spec( + dtype="bf16", head_size=128, block_size=32, num_queries_per_kv=4 + ) + with pytest.raises(RuntimeError, match=needle): + engine.gfx950_attention_tiled_2d_lower_llvm( + {**dataclasses.asdict(spec), **overrides}, "gfx950" + ) + + +_FASTKV_RTL = dict( + use_fast_paged_kv_desc=True, use_mfma_32x32=True, use_transposed_qk_32x32=True +) +# Both reject checks name use_mfma_32x32 (the first of these flags they meet). +_FASTKV_RTL_NEEDLE = "use_mfma_32x32" + + +def test_runtime_layout_fastkv_spec_rejected(): + """The fastKV register-P flags are outside the runtime_layout pipeline.""" + import dataclasses + + from kernels.gfx950.attention_tiled_2d import runtime_layout_catalog_spec + + spec = runtime_layout_catalog_spec( + dtype="bf16", head_size=128, block_size=32, num_queries_per_kv=4 + ) + with pytest.raises(ValueError, match=_FASTKV_RTL_NEEDLE): + dataclasses.replace(spec, **_FASTKV_RTL) + + +def test_runtime_layout_fastkv_native_builder_rejects(): + """The fastKV register-P binding reads ``runtime_layout`` and refuses it with + the reject check's cause, rather than building a fixed-layout kernel.""" + import dataclasses + + from kernels.gfx950.attention_tiled_2d import runtime_layout_catalog_spec + + engine = pytest.importorskip("rocke_engine") + spec = runtime_layout_catalog_spec( + dtype="bf16", head_size=128, block_size=32, num_queries_per_kv=4 + ) + with pytest.raises(RuntimeError, match=_FASTKV_RTL_NEEDLE): + engine.gfx950_attention_tiled_2d_fastkv_regp_lower_llvm( + {**dataclasses.asdict(spec), **_FASTKV_RTL, "runtime_layout": True}, + "gfx950", + ) diff --git a/dnn-providers/hip-kernel-provider/rocke/library/tests/test_gfx942_attention_runtime_layout.py b/dnn-providers/hip-kernel-provider/rocke/library/tests/test_gfx942_attention_runtime_layout.py new file mode 100644 index 000000000000..bd8d5f7bb728 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/rocke/library/tests/test_gfx942_attention_runtime_layout.py @@ -0,0 +1,827 @@ +# Copyright (c) Advanced Micro Devices, Inc., or its affiliates. +# SPDX-License-Identifier: MIT +"""gfx942 tiled-2D unified attention in ``runtime_layout`` mode. + +``runtime_layout=True`` makes one compiled object serve any head count, sliding +window, DENSE or RAGGED query layout, Q/O strides and paged-KV layout (vLLM's +interleaved ``[nb, Hkv, bs, 2D]`` view, NHD, HND): the head counts and window +are the body's runtime shape kernargs, the rest 17 appended kernargs. + +The CPU tests check that every catalog spec passes ``supports_tiled_2d_spec`` +and emits, and that the Python and native (C) checks reject incompatible specs. +The GPU test runs through the HIP runtime alone (no torch) and launches the +catalog kernels against an fp32 numpy gather-then-dense reference: shuffled page +tables with garbage past each sequence's used blocks, empty sequences, padded +DENSE rows, RAGGED offsets with gaps, fused-QKV Q strides, padded O strides, a +sliding window, grids smaller than the q-block count (grid-stride loop), and a +separate V block table that places V in other blocks than K. +Rows of sequences without visible keys, and padded DENSE rows past seq_lens_q, +must be exactly 0, and every O element the kernel must not write (RAGGED gap +rows past seq_lens_q, stride padding, guard regions) must keep its sentinel. +""" + +from __future__ import annotations + +import dataclasses +import itertools +import math +import re +import zlib + +import numpy as np +import pytest + +from kernels.gfx942.attention_tiled_2d import ( + RUNTIME_LAYOUT_EXTRA_ARGS, + UnifiedAttention2DTiledSpec, + build_unified_attention_2d_tiled, + runtime_layout_catalog_spec, + supports_tiled_2d_spec, +) + +_CATALOG = list( + itertools.product( + ("fp16", "bf16"), (64, 128, 256), (16, 32, 64), (1, 2, 4, 5, 6, 7, 8, 16) + ) +) + + +# --------------------------------------------------------------------------- +# CPU: catalog predicate + emit, rejections +# --------------------------------------------------------------------------- + + +@pytest.mark.parametrize("dtype,head_size,block_size,qpk", _CATALOG) +def test_catalog_spec_supported_and_emits(dtype, head_size, block_size, qpk): + spec = runtime_layout_catalog_spec( + dtype=dtype, head_size=head_size, block_size=block_size, num_queries_per_kv=qpk + ) + ok, why = supports_tiled_2d_spec(spec, arch="gfx942") + assert ok, why + kernel = build_unified_attention_2d_tiled(spec, arch="gfx942") + names = [p.name.lstrip("%") for p in kernel.params] + assert names[18:21] == list(UnifiedAttention2DTiledSpec.RUNTIME_KERNARG_FIELDS) + assert names[21:] == [n for n, _ in RUNTIME_LAYOUT_EXTRA_ARGS] + assert kernel.name.endswith("_rtl") + + +def _rtl_spec(**overrides): + base = dict( + head_size=128, + block_size=32, + num_query_heads=4, + num_kv_heads=1, + dtype="bf16", + use_sinks=False, + sliding_window=0, + has_softcap=False, + num_warps=4, + runtime_layout=True, + ) + base.update(overrides) + return base + + +_REJECTED = [ + (dict(has_softcap=True), "has_softcap"), + (dict(use_alibi=True), "use_alibi"), + (dict(use_qq_bias=True), "use_qq_bias"), + (dict(sliding_window=128), "sliding_window"), + (dict(use_fast_paged_kv_desc=True), "use_fast_paged_kv_desc"), + (dict(use_q_major_grid=True), "use_q_major_grid"), + (dict(block_m_per_warp=32), "block_m_per_warp"), + (dict(tile_size=24), "tile_size"), + (dict(tile_size=64), "tile_size"), + # Zero and negative tiles never reach the divisibility arithmetic. + (dict(tile_size=0), "tile_size"), + (dict(tile_size=-16), "tile_size"), + (dict(num_query_heads=5, num_kv_heads=2), "divisible"), + (dict(emit_lse=True), "emit_lse"), +] + + +@pytest.mark.parametrize("overrides,needle", _REJECTED) +def test_incompatible_spec_rejected(overrides, needle): + with pytest.raises(ValueError, match=needle): + UnifiedAttention2DTiledSpec(**_rtl_spec(**overrides)) + + +@pytest.mark.parametrize("value", ["false", "", 1, 0, None]) +def test_runtime_layout_must_be_a_bool(value): + """A truthy non-bool would build the runtime_layout ABI for a caller that thinks it + asked for the fixed layout, so the flag is checked, never coerced.""" + with pytest.raises(ValueError, match="runtime_layout must be a bool"): + UnifiedAttention2DTiledSpec(**_rtl_spec(runtime_layout=value)) + + +@pytest.mark.parametrize("overrides,needle", _REJECTED) +def test_native_builder_rejects_incompatible_spec(overrides, needle): + """The C twin of the reject check refuses the same specs, with the same cause.""" + engine = pytest.importorskip("rocke_engine") + with pytest.raises(RuntimeError, match=needle): + engine.gfx942_attention_tiled_2d_lower_llvm(_rtl_spec(**overrides), "gfx942") + + +def test_4warp_gqa_builder_refuses_runtime_layout(): + from kernels.gfx942.attention_tiled_2d import build_gfx942_4warp_gqa + + spec = UnifiedAttention2DTiledSpec(**_rtl_spec()) + with pytest.raises(NotImplementedError, match="runtime_layout"): + build_gfx942_4warp_gqa(spec) + + +def test_sinks_accepted_with_runtime_layout(): + spec = UnifiedAttention2DTiledSpec(**_rtl_spec(use_sinks=True)) + ok, why = supports_tiled_2d_spec(spec, arch="gfx942") + assert ok, why + catalog = runtime_layout_catalog_spec( + dtype="bf16", head_size=128, block_size=32, num_queries_per_kv=4, use_sinks=True + ) + assert catalog.use_sinks + assert "sinks" in catalog.kernel_name() + assert catalog.kernel_name().endswith("_rtl") + kernel = build_unified_attention_2d_tiled(catalog, arch="gfx942") + names = [p.name.lstrip("%") for p in kernel.params] + assert "sink_ptr" in names + assert names[21:] == [n for n, _ in RUNTIME_LAYOUT_EXTRA_ARGS] + + +# D256, 64-token tile, 4 warps: 2*64*256*2 + 64*264*2 + 64*72*2 + 64*256*2 +# = 141312 B, over gfx942's 65536 B. +_OVER_LDS = dict(head_size=256, block_size=64) +_OVER_LDS_NEEDLE = r"estimated LDS 141312 B .* exceeds the gfx942 65536 B LDS budget" + + +def test_lds_budget_rejected_with_reason(): + spec = UnifiedAttention2DTiledSpec(**_rtl_spec(**_OVER_LDS)) + ok, why = supports_tiled_2d_spec(spec, arch="gfx942") + assert not ok + assert re.search(_OVER_LDS_NEEDLE, why), why + + +def test_builder_rejects_lds_over_budget(): + spec = UnifiedAttention2DTiledSpec(**_rtl_spec(**_OVER_LDS)) + with pytest.raises(ValueError, match=_OVER_LDS_NEEDLE): + build_unified_attention_2d_tiled(spec, arch="gfx942") + + +def test_native_builder_rejects_lds_over_budget(): + """The C builder charges the same LDS bytes against the same capacity.""" + engine = pytest.importorskip("rocke_engine") + with pytest.raises(RuntimeError, match=_OVER_LDS_NEEDLE): + engine.gfx942_attention_tiled_2d_lower_llvm(_rtl_spec(**_OVER_LDS), "gfx942") + + +def test_runtime_layout_off_keeps_name(): + plain = UnifiedAttention2DTiledSpec(**_rtl_spec(runtime_layout=False)) + assert not plain.kernel_name().endswith("rtl") + rtl = dataclasses.replace(plain, runtime_layout=True) + assert rtl.kernel_name() == plain.kernel_name() + "_rtl" + + +# --------------------------------------------------------------------------- +# GPU +# --------------------------------------------------------------------------- + + +def _gpu_ready() -> bool: + # Through the HIP runtime only, no torch: TheRock's test environment has none. + try: + from rocke.runtime.hip_module import get_device_arch + + return get_device_arch(0) == "gfx942" + except Exception: # noqa: BLE001 - no runtime / no device + return False + + +requires_gfx942_gpu = pytest.mark.skipif(not _gpu_ready(), reason="needs a gfx942 GPU") + +_NO_WINDOW = 0x3FFFFFFF +_HKV = 2 +_GUARD = 1024 # elements of sentinel before and after the O view +_SENTINEL = -777.0 +_GPU_KERNELS = [ + (dt, hd, bs, qpk) + for dt in ("bf16", "fp16") + for hd in (64, 128, 256) + for bs in (16, 64) + for qpk in (1, 4, 5, 8) +] + [ + ("bf16", 128, 32, 4), + ("bf16", 128, 32, 8), + ("fp16", 64, 32, 1), + ("fp16", 64, 32, 5), + ("bf16", 256, 32, 8), +] + +_LAUNCHERS = {} + + +def _launcher(spec): + from kernels.common.attention_unified import _tiled_2d_signature + from rocke import compile_kernel + from rocke.helpers.spec import SignatureBuilder + from rocke.runtime import KernelLauncher + + key = spec.kernel_name() + if key not in _LAUNCHERS: + artifact = compile_kernel( + build_unified_attention_2d_tiled(spec, arch="gfx942"), + arch="gfx942", + capture_ir_text=False, + ) + sb = SignatureBuilder().extend(_tiled_2d_signature("gfx942", spec.dtype)) + for name, ty in RUNTIME_LAYOUT_EXTRA_ARGS: + if ty == "ptr": + sb.ptr(name, "i32") + else: + sb.scalar(name, ty) + _LAUNCHERS[key] = KernelLauncher( + hsaco=artifact.hsaco, + kernel_name=artifact.kernel_name, + signature=sb.build(), + cache_key=("rtl_test", key), + ) + return _LAUNCHERS[key] + + +# Scenario fields: mode (dense/ragged), seq_lens, q_lens (per-seq query rows), +# L (dense rows per seq), has_lq, gaps (ragged trailing gap per seq), offsets +# (ragged off[0..B] as given: non-decreasing, off[B] the end; needs has_lq), +# kv layout, fused_q (Q is the Q slice of a fused QKV row), o_pad (O +# token-stride padding), window (None = off), grid_y (None = full grid). +def _scenarios(bs): + return [ + # One sequence: the table's row stride is not passed (0), so the length cap + # must come from its width. + dict( + name="dense_L1_single_sequence", + mode="dense", + L=1, + has_lq=0, + seq_lens=[2 * bs + 20], + q_lens=None, + kv="vllm", + fused_q=False, + o_pad=0, + window=None, + grid_y=None, + ), + dict( + name="dense_L1_empty_seqs", + mode="dense", + L=1, + has_lq=0, + seq_lens=[0, 1, 17, 3 * bs + 5, 2 * bs, 70], + q_lens=None, + kv="nhd", + fused_q=False, + o_pad=0, + window=None, + grid_y=None, + ), + dict( + name="dense_L3_padded_rows_vllm_window", + mode="dense", + L=3, + has_lq=1, + seq_lens=[40, 2, 0, 0, 3, bs + 1], + q_lens=[3, 1, 0, 2, 3, 2], + kv="vllm", + fused_q=True, + o_pad=8, + window=5, + grid_y=None, + ), + dict( + name="dense_L3_gridstride_hnd", + mode="dense", + L=3, + has_lq=0, + seq_lens=[3, 50, 2 * bs + 7, 9], + q_lens=None, + kv="hnd", + fused_q=False, + o_pad=8, + window=None, + grid_y=1, + ), + dict( + name="ragged_mixed_gaps_vllm", + mode="ragged", + has_lq=1, + seq_lens=[33, 37 + 2 * bs + 3, 1, 0, 26, 64], + q_lens=[1, 37, 1, 0, 19, 1], + gaps=[2, 0, 5, 1, 3, 8], + kv="vllm", + fused_q=True, + o_pad=8, + window=None, + grid_y=None, + ), + dict( + name="ragged_offsets_window_hnd", + mode="ragged", + has_lq=0, + seq_lens=[4, 90, 60, 1], + q_lens=[4, 1, 50, 1], + gaps=None, + kv="hnd", + fused_q=False, + o_pad=0, + window=16, + grid_y=None, + ), + dict( + name="ragged_gridstride_nhd", + mode="ragged", + has_lq=0, + seq_lens=[70, 100, 2 * bs + 1], + q_lens=[70, 33, 1], + gaps=None, + kv="nhd", + fused_q=True, + o_pad=8, + window=None, + grid_y=2, + ), + # K and V page through two tables: V's blocks are another permutation. + dict( + name="dense_L1_separate_v_table_vllm", + mode="dense", + L=1, + has_lq=0, + seq_lens=[0, 1, 2 * bs + 3, 90, bs], + q_lens=None, + kv="vllm", + fused_q=False, + o_pad=0, + window=None, + grid_y=None, + v_table=True, + ), + dict( + name="ragged_separate_v_table_window_hnd", + mode="ragged", + has_lq=1, + seq_lens=[50, 3 * bs + 2, 1, 0], + q_lens=[50, 4, 1, 0], + gaps=[1, 0, 2, 0], + kv="hnd", + fused_q=True, + o_pad=8, + window=24, + grid_y=None, + v_table=True, + ), + # 0 < seq_len < q_len: the leading rows see no key (zeros), the rest see the + # keys up to their own bottom-right diagonal. + dict( + name="dense_L5_keyless_leading_rows", + mode="dense", + L=5, + has_lq=1, + seq_lens=[2, 1, 40, 4], + q_lens=[5, 5, 3, 5], + kv="vllm", + fused_q=True, + o_pad=0, + window=None, + grid_y=None, + ), + dict( + name="ragged_keyless_leading_rows_window", + mode="ragged", + has_lq=1, + seq_lens=[2, 30, 1], + q_lens=[5, 1, 4], + gaps=[1, 0, 2], + kv="nhd", + fused_q=False, + o_pad=8, + window=16, + grid_y=None, + ), + # One decode row whose origin lies past the first q-blocks: those blocks + # find no sequence and write nothing (rows before off[0] keep the + # sentinel). + dict( + name="ragged_shifted_first_origin", + mode="ragged", + has_lq=1, + seq_lens=[20], + q_lens=[1], + offsets=[64, 65], + kv="nhd", + fused_q=False, + o_pad=0, + window=None, + grid_y=None, + ), + ] + + +def _reference( + q_rows, + k_logical, + v_logical, + table, + seq_lens, + q_lens, + qpk, + bs, + window, + sinks=None, + v_table=None, +): + """fp32 gather-then-dense attention. Returns {(seq, s): [Hq, D]}. + + ``sinks`` ([Hq] logits, not scaled) join the softmax max and denominator; + rows with no visible key stay zero. V pages through ``v_table`` when given, + else through ``table``. + """ + hq = q_rows[0].shape[1] if q_rows else 0 + v_table = table if v_table is None else v_table + out = {} + for b, (sl, ql) in enumerate(zip(seq_lens, q_lens)): + if ql == 0: + continue + k = ( + np.stack([k_logical[table[b, t // bs], t % bs] for t in range(sl)]) + if sl + else None + ) + v = ( + np.stack([v_logical[v_table[b, t // bs], t % bs] for t in range(sl)]) + if sl + else None + ) + ctx = sl - ql + for s in range(ql): + d = ctx + s + keys = np.arange(sl) + vis = (keys <= d) & (d - keys < window) + res = np.zeros((hq, q_rows[b].shape[2]), np.float32) + if vis.any(): + for h in range(hq): + kv_h = h // qpk + sc = (k[vis, kv_h] @ q_rows[b][s, h]) / math.sqrt( + q_rows[b].shape[2] + ) + m = sc.max() if sinks is None else max(sc.max(), sinks[h]) + p = np.exp(sc - m) + denom = p.sum() + (0.0 if sinks is None else np.exp(sinks[h] - m)) + res[h] = (p @ v[vis, kv_h]) / denom + out[(b, s)] = res + return out + + +def _encode(a, dtype): + """fp32 -> raw 16-bit storage of ``dtype``.""" + from rocke.numeric.bf16 import f32_to_bf16 + + if dtype == "bf16": + return f32_to_bf16(np.ascontiguousarray(a, dtype=np.float32)) + return a.astype(np.float16).view(np.uint16) + + +def _decode(a, dtype): + from rocke.numeric.bf16 import bf16_to_f32 + + if dtype == "bf16": + return bf16_to_f32(a) + return a.view(np.float16).astype(np.float32) + + +def _run_case(spec, sc, rng, sink_f32=False, bad_page=None): + from rocke.runtime.hip_module import Runtime + from rocke.runtime.host_buffers import as_u8_buffer + from rocke.runtime.launcher import DeviceMem, LaunchConfig + + dt = spec.dtype + rt = Runtime() + keep = [] + + def upload(a): + a = np.ascontiguousarray(a) + m = DeviceMem(max(a.nbytes, 4)) + if a.nbytes: + rt.memcpy_h2d(m.ptr(), as_u8_buffer(a), a.nbytes) + keep.append(m) + return m.ptr() + + hd, bs, qpk = spec.head_size, spec.block_size, spec.num_queries_per_kv + hq = qpk * _HKV + nseq = len(sc["seq_lens"]) + seq_lens = list(sc["seq_lens"]) + bq = spec.block_q + dense = sc["mode"] == "dense" + + # ---- query layout ---- + if dense: + L = sc["L"] + q_lens = list(sc["q_lens"]) if sc["has_lq"] else [L] * nseq + q_lens_kernel = [min(L, x) for x in q_lens] + tok_base = [b * L for b in range(nseq)] + total_tok = nseq * L + else: + q_lens = list(sc["q_lens"]) + if sc.get("offsets") is not None: + assert sc["has_lq"], "explicit offsets need seq_lens_q" + off = list(sc["offsets"]) + rows = q_lens + else: + gaps = sc["gaps"] or [0] * nseq + off = [0] + for ql, g in zip(q_lens, gaps): + off.append(off[-1] + ql + g) + rows = [off[b + 1] - off[b] for b in range(nseq)] + q_lens_kernel = q_lens + tok_base = off[:nseq] + total_tok = max(t + r for t, r in zip(tok_base, rows)) + q_row = (hq + 2 * _HKV) * hd if sc["fused_q"] else hq * hd + q_alloc = rng.standard_normal((max(total_tok, 1), q_row)).astype(np.float32) + q_host = _encode(q_alloc, dt) + q_ptr = upload(q_host) + q_np = _decode(q_host, dt) + q_rows = [ + q_np[tok_base[b] : tok_base[b] + q_lens_kernel[b], : hq * hd].reshape( + -1, hq, hd + ) + for b in range(nseq) + ] + + # ---- paged KV ---- + used = [-(-sl // bs) for sl in seq_lens] + nb = sum(used) + 3 + perm = rng.permutation(nb) + max_blocks = max(used + [1]) + table = np.full((nseq, max_blocks + 1), 0x7FFFFFFF, np.int32) + nxt = 0 + for b in range(nseq): + for i in range(used[b]): + table[b, i] = perm[nxt] + nxt += 1 + v_table = table + if sc.get("v_table"): + # V's blocks: another permutation, so V lives in other blocks than K. + v_perm = rng.permutation(nb) + v_table = np.full_like(table, 0x7FFFFFFF) + nxt = 0 + for b in range(nseq): + for i in range(used[b]): + v_table[b, i] = v_perm[nxt] + nxt += 1 + assert not np.array_equal(v_table, table) + kv_layout = sc["kv"] + if kv_layout == "vllm": + kv = _encode(rng.standard_normal((nb, _HKV, bs, 2 * hd)), dt) + kv_np = _decode(kv, dt) + k_logical = kv_np[..., :hd].transpose(0, 2, 1, 3) + v_logical = kv_np[..., hd:].transpose(0, 2, 1, 3) + k_ptr = upload(kv) + v_ptr = k_ptr + hd * 2 + strides = (_HKV * bs * 2 * hd, 2 * hd, bs * 2 * hd) + else: + shape = (nb, bs, _HKV, hd) if kv_layout == "nhd" else (nb, _HKV, bs, hd) + k = _encode(rng.standard_normal(shape), dt) + v = _encode(rng.standard_normal(shape), dt) + k_np, v_np = _decode(k, dt), _decode(v, dt) + if kv_layout == "nhd": + k_logical, v_logical = k_np, v_np + strides = (bs * _HKV * hd, _HKV * hd, hd) + else: + k_logical, v_logical = k_np.transpose(0, 2, 1, 3), v_np.transpose( + 0, 2, 1, 3 + ) + strides = (_HKV * bs * hd, hd, bs * hd) + k_ptr, v_ptr = upload(k), upload(v) + kv_block_stride, kv_tok_stride, kv_head_stride = strides + span_bytes = ((_HKV - 1) * kv_head_stride + (bs - 1) * kv_tok_stride + hd) * 2 + + # ---- sinks (one per query head; fp32 when sink_f32, else I/O dtype) ---- + sinks_np = None + sink_ptr = 0 + if spec.use_sinks: + # Spread from "negligible" to "dominates the row" so a head that loses + # (or reads another head's) sink fails the comparison. + sinks_host = rng.uniform(-4.0, 6.0, hq).astype(np.float32) + if sink_f32: + sinks_np = sinks_host + sink_ptr = upload(sinks_host) + else: + sinks_raw = _encode(sinks_host, dt) + sinks_np = _decode(sinks_raw, dt) + sink_ptr = upload(sinks_raw) + + # ---- output with sentinel guards ---- + o_tok = hq * hd + sc["o_pad"] + o_elems = max(total_tok, 1) * o_tok + sentinel = _encode(np.array([_SENTINEL], np.float32), dt)[0] + o_host = np.full(_GUARD + o_elems + _GUARD, sentinel, np.uint16) + o_base = upload(o_host) + o_ptr = o_base + _GUARD * 2 + + seq_lens_dev = upload(np.array(seq_lens, np.int32)) + dev_table, dev_v_table = table, v_table + bad_seq = nseq - 1 + if bad_page is not None: + # The last sequence's page ids (K and V) all lie outside [0, nb): they read + # as masked pages, so its K and V are zeros and its output is zero. + assert used[bad_seq] > 0, "the corrupted sequence must own blocks" + bad = {"past_end": nb, "int_max": 0x7FFFFFFF, "negative": -1}[bad_page] + dev_table = table.copy() + dev_table[bad_seq, : used[bad_seq]] = bad + dev_v_table = dev_table if v_table is table else v_table.copy() + dev_v_table[bad_seq, : used[bad_seq]] = bad + table_dev = upload(dev_table) + v_table_dev = upload(dev_v_table) if dev_v_table is not dev_table else table_dev + lq_dev = upload(np.array(q_lens_kernel if not dense else q_lens, np.int32)) + off_dev = upload(np.array(off, np.int32)) if not dense else seq_lens_dev + + if dense: + full_grid = nseq * -(-sc["L"] // bq) + else: + full_grid = off[-1] // bq + nseq + if dense: + q_seq_stride, o_seq_stride = sc["L"] * q_row, sc["L"] * o_tok + else: + q_seq_stride, o_seq_stride = q_row, o_tok + grid_y = sc["grid_y"] or full_grid + window = sc["window"] + values = dict( + output_ptr=o_ptr, + query_ptr=q_ptr, + key_cache_ptr=k_ptr, + value_cache_ptr=v_ptr, + sink_ptr=sink_ptr, + block_tables_ptr=table_dev, + seq_lens_ptr=seq_lens_dev, + alibi_slopes_ptr=0, + qq_bias_ptr=0, + query_start_len_ptr=off_dev, + scale=1.0 / math.sqrt(hd), + k_scale=1.0, + v_scale=1.0, + out_scale=1.0, + softcap=0.0, + num_seqs=nseq, + # The engine passes hipDNN's page-table batch stride, which is 0 for a batch of + # one (a unit extent's stride is irrelevant); the row width is its own argument. + block_table_stride=table.shape[1] if nseq > 1 else 0, + qq_bias_stride_0=0, + seq_lens_q_ptr=lq_dev if sc["has_lq"] else seq_lens_dev, + block_tables_v_ptr=v_table_dev, + has_seq_lens_q=sc["has_lq"], + q_uniform_len=sc["L"] if dense else 0, + num_query_heads=hq, + num_kv_heads=_HKV, + sliding_window=window if window is not None else _NO_WINDOW, + q_seq_stride=q_seq_stride, + q_tok_stride=q_row, + q_head_stride=hd, + o_seq_stride=o_seq_stride, + o_tok_stride=o_tok, + o_head_stride=hd, + kv_block_stride=kv_block_stride, + kv_tok_stride=kv_tok_stride, + kv_head_stride=kv_head_stride, + kv_block_span_bytes=span_bytes, + q_block_grid=grid_y, + sink_is_f32=int(sink_f32), + num_kv_blocks=nb, + block_table_width=table.shape[1], + ) + _launcher(spec)( + values, + config=LaunchConfig( + grid=(_HKV, grid_y, 1), block=(spec.num_warps * 64, 1, 1), fence=True + ), + ) + rt.memcpy_d2h(as_u8_buffer(o_host), o_base, o_host.nbytes) + del keep + got = _decode(o_host, dt) + ref = _reference( + q_rows, + k_logical, + v_logical, + table, + seq_lens, + q_lens_kernel, + qpk, + bs, + window if window is not None else _NO_WINDOW, + sinks_np, + v_table, + ) + if bad_page is not None: + for (b, s), res in ref.items(): + if b == bad_seq: + res[:] = 0.0 + written = np.zeros(got.shape, bool) + for (b, s), res in ref.items(): + base = _GUARD + (tok_base[b] + s) * o_tok + for h in range(hq): + sl = slice(base + h * hd, base + (h + 1) * hd) + written[sl] = True + out = got[sl] + assert np.isfinite( + out + ).all(), f"{sc['name']}: non-finite seq {b} row {s} head {h}" + if not np.any(res[h]): + assert not np.any( + out + ), f"{sc['name']}: seq {b} row {s} head {h} not zero" + # The kernel rounds P and O to bf16/fp16 (8 or 11 mantissa bits); the + # reference stays in fp32. 2e-2 covers that rounding, not a looser kernel. + np.testing.assert_allclose( + out, + res[h], + atol=2e-2, + rtol=2e-2, + err_msg=f"{sc['name']}: seq {b} row {s} head {h}", + ) + # A dense Q's rows past seq_lens_q are padding: they store zeros. A ragged + # Q's gap rows (past seq_lens_q, up to the next offset) belong to no + # sequence: the kernel must not write them, so they keep the sentinel. + for b in range(nseq if dense else 0): + for s in range(q_lens_kernel[b], sc["L"]): + base = _GUARD + (tok_base[b] + s) * o_tok + sl = slice(base, base + hq * hd) + written[sl] = True + assert not np.any( + got[sl] + ), f"{sc['name']}: padding row {s} of seq {b} not zero" + untouched = o_host == sentinel + bad = np.flatnonzero(~written & ~untouched) + assert bad.size == 0, ( + f"{sc['name']}: {bad.size} elements outside the written rows changed " + f"(first at {bad[0] - _GUARD} relative to the O view)" + ) + + +@pytest.mark.gpu +@requires_gfx942_gpu +@pytest.mark.parametrize("dtype,head_size,block_size,qpk", _GPU_KERNELS) +def test_runtime_layout_numerics(dtype, head_size, block_size, qpk): + spec = runtime_layout_catalog_spec( + dtype=dtype, head_size=head_size, block_size=block_size, num_queries_per_kv=qpk + ) + rng = np.random.default_rng( + zlib.crc32(f"{dtype}:{head_size}:{block_size}:{qpk}".encode()) + ) + for sc in _scenarios(block_size): + _run_case(spec, sc, rng) + + +@pytest.mark.gpu +@requires_gfx942_gpu +@pytest.mark.parametrize("bad_page", ("past_end", "int_max", "negative")) +@pytest.mark.parametrize("dtype,head_size,block_size,qpk", _GPU_KERNELS[:3]) +def test_runtime_layout_contains_out_of_range_page_ids( + dtype, head_size, block_size, qpk, bad_page +): + """A page id outside the cache reads as masked: no memory outside the cache is read + (the other sequences are exact), and the corrupted sequence's output is zero.""" + spec = runtime_layout_catalog_spec( + dtype=dtype, head_size=head_size, block_size=block_size, num_queries_per_kv=qpk + ) + rng = np.random.default_rng( + zlib.crc32(f"bad:{dtype}:{head_size}:{block_size}:{qpk}".encode()) + ) + sc = next( + s + for s in _scenarios(block_size) + if s["seq_lens"][-1] > 0 and s["mode"] == "dense" + ) + _run_case(spec, sc, rng, bad_page=bad_page) + + +# Sink objects: _HKV=2 KV heads, so query heads of KV head 1 (h >= qpk) need +# the runtime query-head bound and mapping to find their sink. +_GPU_SINK_KERNELS = [ + ("bf16", 64, 16, 1), + ("bf16", 128, 32, 4), + ("fp16", 128, 64, 5), + ("bf16", 256, 16, 8), + ("fp16", 64, 32, 8), +] + + +@pytest.mark.gpu +@requires_gfx942_gpu +@pytest.mark.parametrize("sink_f32", (False, True), ids=("sink_qdtype", "sink_f32")) +@pytest.mark.parametrize("dtype,head_size,block_size,qpk", _GPU_SINK_KERNELS) +def test_runtime_layout_sinks_numerics(dtype, head_size, block_size, qpk, sink_f32): + spec = runtime_layout_catalog_spec( + dtype=dtype, + head_size=head_size, + block_size=block_size, + num_queries_per_kv=qpk, + use_sinks=True, + ) + rng = np.random.default_rng( + zlib.crc32(f"sinks:{dtype}:{head_size}:{block_size}:{qpk}".encode()) + ) + for sc in _scenarios(block_size): + _run_case(spec, sc, rng, sink_f32=sink_f32) diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/bindings/attention_tiled_parity_configs.py b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/bindings/attention_tiled_parity_configs.py index 76fa12cb41ed..17788ef135a4 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/bindings/attention_tiled_parity_configs.py +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/bindings/attention_tiled_parity_configs.py @@ -11,6 +11,36 @@ as a DIFF. """ + +def _rtl( + head_size, + block_size, + num_query_heads, + dtype, + *, + num_kv_heads=1, + use_sinks=False, + num_warps=4, + tile_size=None, +): + """A runtime_layout row, as the emitters' ``_rtl`` builds it.""" + cfg = { + "head_size": head_size, + "block_size": block_size, + "num_query_heads": num_query_heads, + "num_kv_heads": num_kv_heads, + "dtype": dtype, + "use_sinks": use_sinks, + "sliding_window": 0, + "has_softcap": False, + "num_warps": num_warps, + "runtime_layout": True, + } + if tile_size is not None: + cfg["tile_size"] = tile_size + return cfg + + GFX942_ATTENTION_TILED_2D = [ { "head_size": 64, @@ -265,6 +295,62 @@ "use_q_major_grid": True, "emit_lse": True, }, + { + "head_size": 64, + "block_size": 32, + "num_query_heads": 32, + "num_kv_heads": 8, + "dtype": "bf16", + "use_sinks": False, + "sliding_window": 0, + "has_softcap": False, + "num_warps": 4, + "block_m_per_warp": 32, + "tile_size": 64, + "use_mfma_32x32x8": True, + "use_transposed_qk_32x32": True, + "use_conflict_free_v_store": True, + }, + { + "head_size": 64, + "block_size": 32, + "num_query_heads": 32, + "num_kv_heads": 8, + "dtype": "bf16", + "use_sinks": False, + "sliding_window": 0, + "has_softcap": False, + "num_warps": 4, + "block_m_per_warp": 32, + "tile_size": 64, + "use_mfma_32x32x8": True, + "use_transposed_qk_32x32": True, + "use_conflict_free_v_store": True, + "use_i64_kv_addr": True, + }, +] + +# idx20-38: runtime_layout (catalog geometry; idx30-38 carry sinks). +GFX942_ATTENTION_TILED_2D += [ + _rtl(64, 16, 1, "fp16"), + _rtl(64, 32, 4, "bf16"), + _rtl(64, 64, 6, "fp16"), + _rtl(128, 16, 8, "bf16"), + _rtl(128, 32, 1, "fp16"), + _rtl(128, 64, 4, "bf16", tile_size=32), + _rtl(256, 16, 6, "fp16", num_warps=2), + _rtl(256, 32, 8, "bf16", num_warps=2, tile_size=16), + _rtl(256, 64, 1, "fp16", num_warps=2, tile_size=16), + _rtl(128, 32, 16, "bf16", num_kv_heads=4), + _rtl(64, 16, 2, "bf16", use_sinks=True), + _rtl(64, 32, 5, "fp16", use_sinks=True), + _rtl(64, 64, 7, "bf16", use_sinks=True), + _rtl(128, 16, 16, "fp16", use_sinks=True), + _rtl(128, 32, 2, "bf16", use_sinks=True), + _rtl(128, 64, 5, "fp16", use_sinks=True, tile_size=32), + _rtl(256, 16, 7, "bf16", use_sinks=True, num_warps=2), + _rtl(256, 32, 16, "fp16", use_sinks=True, num_warps=2, tile_size=16), + _rtl(256, 64, 2, "bf16", use_sinks=True, num_warps=2, tile_size=16), ] GFX950_ATTENTION_TILED_2D = [ @@ -1389,6 +1475,29 @@ }, ] +# idx77-95 of the emitters: runtime_layout (catalog geometry; idx87-95 carry sinks). +GFX950_ATTENTION_TILED_2D += [ + _rtl(64, 16, 1, "fp16", num_warps=2), + _rtl(64, 32, 4, "bf16"), + _rtl(64, 64, 6, "fp16"), + _rtl(128, 16, 8, "bf16"), + _rtl(128, 32, 1, "fp16"), + _rtl(128, 64, 4, "bf16"), + _rtl(256, 16, 6, "fp16"), + _rtl(256, 32, 8, "bf16"), + _rtl(256, 64, 1, "fp16"), + _rtl(128, 32, 16, "bf16", num_kv_heads=4), + _rtl(64, 16, 2, "bf16", use_sinks=True, num_warps=2), + _rtl(64, 32, 5, "fp16", use_sinks=True), + _rtl(64, 64, 7, "bf16", use_sinks=True), + _rtl(128, 16, 16, "fp16", use_sinks=True), + _rtl(128, 32, 2, "bf16", use_sinks=True), + _rtl(128, 64, 5, "fp16", use_sinks=True), + _rtl(256, 16, 7, "bf16", use_sinks=True), + _rtl(256, 32, 16, "fp16", use_sinks=True), + _rtl(256, 64, 2, "bf16", use_sinks=True), +] + GFX942_ATTENTION_TILED_3D = [ { "head_size": 64, diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/bindings/rocke_engine_attention.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/bindings/rocke_engine_attention.cpp index 317bf93f1695..64248b0d38a6 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/bindings/rocke_engine_attention.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/bindings/rocke_engine_attention.cpp @@ -852,6 +852,7 @@ rocke_attention_tiled_2d_spec_t t2d_build(const py::dict& d, Store& st) s.use_fast_paged_kv_desc = a_bool(d, "use_fast_paged_kv_desc", s.use_fast_paged_kv_desc); s.use_qblock_reverse = a_bool(d, "use_qblock_reverse", s.use_qblock_reverse); s.emit_lse = a_bool(d, "emit_lse", s.emit_lse); + s.runtime_layout = a_bool(d, "runtime_layout", s.runtime_layout); s.lse_head_major = t2d_lse_head_major(d); /* Every other field the C struct shares with the Python spec. A field left * out here silently keeps its C default, so the native builder would build @@ -1059,6 +1060,7 @@ rocke_attention_tiled_2d_spec_t fkv_build(const py::dict& d, Store& st) s.use_agpr_alloc_zero = a_bool(d, "use_agpr_alloc_zero", s.use_agpr_alloc_zero); s.use_grouped_kv2_softmax = a_bool(d, "use_grouped_kv2_softmax", s.use_grouped_kv2_softmax); s.emit_lse = a_bool(d, "emit_lse", s.emit_lse); + s.runtime_layout = a_bool(d, "runtime_layout", s.runtime_layout); s.lse_head_major = t2d_lse_head_major(d); std::string v; if(a_str(d, "dtype", v)) diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/abi.h b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/abi.h index bd6edf2eefae..586925aba91a 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/abi.h +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/abi.h @@ -136,8 +136,12 @@ extern "C" { * 20: rocke_mx_gemm_spec_t lost per_input_row and now declares the * workgroup tile (block_tile_m, block_tile_n) right after M, N, K, which * changes its size and the offsets of its fields; rocke_mx_gemm_block_size - * returns long long (it returned int), which changes its signature. */ -#define ROCKE_ABI_VERSION 20 + * returns long long (it returned int), which changes its signature. + * 21: rocke_attention_tiled_2d_spec_t gained runtime_layout at its end. The + * bool lands in the struct's tail padding, so sizeof is unchanged, but a + * caller built against the old header leaves the byte the builder now + * reads unset. */ +#define ROCKE_ABI_VERSION 21 /* Wire ABI: the CBOR recipe/bundle/guard vocabulary this engine understands. * 2: list-tagged ("l") kernel attrs such as cluster_dims; level-1 engines drop them. diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/helper_helper_rocke.instances.gfx942.attention_tiled_2d.h b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/helper_helper_rocke.instances.gfx942.attention_tiled_2d.h index b06d2e23466f..efa6de7c6187 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/helper_helper_rocke.instances.gfx942.attention_tiled_2d.h +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/helper_helper_rocke.instances.gfx942.attention_tiled_2d.h @@ -187,6 +187,13 @@ typedef struct rocke_attention_tiled_2d_spec * each sequence's LSE is a [num_query_heads, q_len] block; the kernel name's * "lse" token becomes "lsehm". Needs emit_lse. */ bool lse_head_major; /* False */ + /* Runtime-layout mode (hipDNN paged/ragged SDPA): the Q/O/KV strides and a + * dense-or-ragged Q become 18 appended kernel arguments (after the runtime + * head counts and window), + * the page tables and lengths are read on the device and the q-block grid + * is walked with a grid-stride loop. Off emits no new IR; on appends the + * "rtl" kernel-name token. See the Python spec field for the contract. */ + bool runtime_layout; /* False */ } rocke_attention_tiled_2d_spec_t; /* Materialise every defaulted field (the dataclass defaults). The required @@ -223,6 +230,24 @@ int rocke_attention_tiled_2d_spec_binary_search_iters(const rocke_attention_tile bool rocke_attention_tiled_2d_spec_validate(rocke_ir_builder_t* b, const rocke_attention_tiled_2d_spec_t* s); +/* _runtime_layout_reject_reason, gfx942 (kernels/gfx942/attention_tiled_2d.py) + * and gfx950 (kernels/gfx950/attention_tiled_2d.py). Each returns false when + * the spec is a valid runtime_layout spec on that arch (or runtime_layout is + * off); otherwise it returns true and writes the Python ValueError text into + * ``reason`` (capacity ``reason_cap``; ``reason`` may be NULL). Spec fields the + * Python spec has and this struct does not (always False here) are skipped. */ +bool rocke_gfx942_attention_tiled_2d_runtime_layout_reject_reason( + const rocke_attention_tiled_2d_spec_t* s, char* reason, size_t reason_cap); +bool rocke_gfx950_attention_tiled_2d_runtime_layout_reject_reason( + const rocke_attention_tiled_2d_spec_t* s, char* reason, size_t reason_cap); + +/* runtime_layout_lds_bytes, gfx942: static LDS bytes of a runtime_layout + * kernel (fp16/bf16). Both builders refuse a runtime_layout spec whose bytes + * exceed the target's ArchTarget lds_capacity_bytes. */ +int rocke_gfx942_attention_tiled_2d_runtime_layout_lds_bytes(int head_size, + int tile_size, + int num_warps); + /* ----------------------------------------------- config-from-spec (build head) * * * The pile of ALL-CAPS config constants the build function derives from the diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_attention_tiled_2d_rtl_internal.h b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_attention_tiled_2d_rtl_internal.h new file mode 100644 index 000000000000..8ee5e7e2be1c --- /dev/null +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_attention_tiled_2d_rtl_internal.h @@ -0,0 +1,130 @@ +// Copyright (c) Advanced Micro Devices, Inc., or its affiliates. +// SPDX-License-Identifier: MIT +/* runtime_layout kernel arguments of the gfx942 and gfx950 tiled 2D unified + * attention twins. Mirrors RUNTIME_LAYOUT_EXTRA_ARGS + * (kernels/gfx942/attention_tiled_2d.py) and _RTL_PARAMS + * (kernels/gfx950/attention_tiled_2d.py): the same 16 arguments, in the same + * order, appended after the fixed ones and the runtime shape arguments + * (num_query_heads, num_kv_heads, sliding_window). Not a public ABI. */ +#ifndef ROCKE_INSTANCE_ATTENTION_TILED_2D_RTL_INTERNAL_H +#define ROCKE_INSTANCE_ATTENTION_TILED_2D_RTL_INTERNAL_H + +#include + +#include "rocke/ir.h" + +/* Kernel argument index, in ABI order. The first two are ptr, the rest + * i32. Strides are in elements; kv_block_span_bytes is the byte range of one + * page's buffer resource. block_tables_v_ptr is V's block table; it shares + * block_table_stride with block_tables_ptr (K's) and may be the same pointer. + * q_uniform_len is L > 0 for a dense Q and 0 for a ragged one (offsets + * non-decreasing, off[b+1] - off[b] >= seq_lens_q[b], off[B] the end of the + * last block). sink_is_f32 nonzero: sink_ptr holds Hq fp32 logits, else Hq + * logits in the Q dtype. */ +typedef enum rocke_attn2d_rtl_param +{ + ROCKE_ATTN2D_RTL_BLOCK_TABLES_V = 0, + ROCKE_ATTN2D_RTL_SEQ_LENS_Q, + ROCKE_ATTN2D_RTL_HAS_SEQ_LENS_Q, + ROCKE_ATTN2D_RTL_Q_UNIFORM_LEN, + ROCKE_ATTN2D_RTL_Q_SEQ_STRIDE, + ROCKE_ATTN2D_RTL_Q_TOK_STRIDE, + ROCKE_ATTN2D_RTL_Q_HEAD_STRIDE, + ROCKE_ATTN2D_RTL_O_SEQ_STRIDE, + ROCKE_ATTN2D_RTL_O_TOK_STRIDE, + ROCKE_ATTN2D_RTL_O_HEAD_STRIDE, + ROCKE_ATTN2D_RTL_KV_BLOCK_STRIDE, + ROCKE_ATTN2D_RTL_KV_TOK_STRIDE, + ROCKE_ATTN2D_RTL_KV_HEAD_STRIDE, + ROCKE_ATTN2D_RTL_KV_BLOCK_SPAN_BYTES, + ROCKE_ATTN2D_RTL_Q_BLOCK_GRID, + ROCKE_ATTN2D_RTL_SINK_IS_F32, + ROCKE_ATTN2D_RTL_NUM_KV_BLOCKS, + ROCKE_ATTN2D_RTL_BLOCK_TABLE_WIDTH, + ROCKE_ATTN2D_RTL_NUM_PARAMS +} rocke_attn2d_rtl_param_t; + +/* Declare the appended arguments, in order, into out[0..NUM_PARAMS). The + * pointers are readonly with align 4, the scalars plain i32. */ +static inline void rocke_attn2d_rtl_declare_params(rocke_ir_builder_t* b, rocke_value_t** out) +{ + static const char* const names[ROCKE_ATTN2D_RTL_NUM_PARAMS] = { + "block_tables_v_ptr", + "seq_lens_q_ptr", + "has_seq_lens_q", + "q_uniform_len", + "q_seq_stride", + "q_tok_stride", + "q_head_stride", + "o_seq_stride", + "o_tok_stride", + "o_head_stride", + "kv_block_stride", + "kv_tok_stride", + "kv_head_stride", + "kv_block_span_bytes", + "q_block_grid", + "sink_is_f32", + "num_kv_blocks", + "block_table_width", + }; + const rocke_type_t* ptr_i32 = rocke_ptr_type(b, rocke_i32(), "global"); + for(int i = 0; i < ROCKE_ATTN2D_RTL_NUM_PARAMS; ++i) + { + if(i <= ROCKE_ATTN2D_RTL_SEQ_LENS_Q) + { + rocke_param_opts_t o; + memset(&o, 0, sizeof(o)); + o.readonly = true; + o.readonly_set = true; + o.align = 4; + o.align_set = true; + out[i] = rocke_b_param(b, names[i], ptr_i32, &o); + } + else + { + out[i] = rocke_b_param(b, names[i], rocke_i32(), NULL); + } + } +} + +/* Query head qh's sink logit in f32 in a runtime_layout kernel (Python + * ``_sink_logit``). sink_is_f32 picks the fp32 form (read as two 16-bit + * halves) or the Q-dtype form; each load masks on its own flag, so neither + * reads past the other's buffer. One builder call per statement, in Python + * order. */ +static inline rocke_value_t* rocke_attn2d_rtl_sink_logit(rocke_ir_builder_t* b, + rocke_value_t* const* rtl_p, + rocke_value_t* sinks, + rocke_value_t* qh, + rocke_value_t* qh_in, + const rocke_type_t* dtype) +{ + rocke_value_t* flag = rtl_p[ROCKE_ATTN2D_RTL_SINK_IS_F32]; + rocke_value_t* c0 = rocke_b_const_i32(b, 0); + rocke_value_t* is_f32 = rocke_b_cmp_ne(b, flag, c0); + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* is_q = rocke_b_cmp_eq(b, flag, c0); + rocke_value_t* f32_in = rocke_b_land(b, qh_in, is_f32); + rocke_value_t* qh2 = rocke_b_mul(b, qh, rocke_b_const_i32(b, 2)); + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* lo_idx = rocke_b_select(b, f32_in, qh2, c0); + rocke_value_t* lo = rocke_b_global_load(b, sinks, lo_idx, rocke_i16(), 2); + rocke_value_t* qh2_p1 = rocke_b_add(b, qh2, rocke_b_const_i32(b, 1)); + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* hi_idx = rocke_b_select(b, f32_in, qh2_p1, c0); + rocke_value_t* hi = rocke_b_global_load(b, sinks, hi_idx, rocke_i16(), 2); + rocke_value_t* lo32 = rocke_b_zext(b, lo, rocke_i32()); + rocke_value_t* hi32 = rocke_b_zext(b, hi, rocke_i32()); + rocke_value_t* hi_sh = rocke_b_shl(b, hi32, rocke_b_const_i32(b, 16)); + rocke_value_t* word = rocke_b_add(b, lo32, hi_sh); + rocke_value_t* sink_w = rocke_b_bitcast(b, word, rocke_f32()); + rocke_value_t* q_in = rocke_b_land(b, qh_in, is_q); + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* q_idx = rocke_b_select(b, q_in, qh, c0); + rocke_value_t* sink_h = rocke_b_global_load(b, sinks, q_idx, dtype, 2); + rocke_value_t* sink_hf = rocke_b_cast_to_f32(b, sink_h); + return rocke_b_select(b, is_f32, sink_w, sink_hf); +} + +#endif /* ROCKE_INSTANCE_ATTENTION_TILED_2D_RTL_INTERNAL_H */ diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_gfx942_attention_tiled_2d_internal.h b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_gfx942_attention_tiled_2d_internal.h index dd2274b84870..d12b2630670c 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_gfx942_attention_tiled_2d_internal.h +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_gfx942_attention_tiled_2d_internal.h @@ -71,6 +71,7 @@ #include "rocke/helper_rocke.helpers.atoms.h" /* rocke_mfma_atom_t */ #include "rocke/helper_rocke.helpers.attention.h" /* binary_search / softmax reduces */ #include "rocke/helper_rocke.helpers.transforms.h" /* rocke_tensor_descriptor_t */ +#include "rocke/instance_attention_tiled_2d_rtl_internal.h" /* ROCKE_ATTN2D_RTL_* */ #include "rocke/instance_gfx942_attention_tiled_2d.h" /* spec_t + config_t (via helper hdr) */ #include "rocke/ir.h" @@ -184,6 +185,10 @@ typedef struct rocke_gfx942_attn2d_build_ctx rocke_value_t* sliding_window_p; /* Trailing lse_ptr (F32*), declared only when spec->emit_lse; else NULL. */ rocke_value_t* lse; + /* runtime_layout (spec->runtime_layout): the 18 appended kernel arguments, + * indexed by ROCKE_ATTN2D_RTL_*; all NULL when off. */ + bool RTL; + rocke_value_t* rtl_p[ROCKE_ATTN2D_RTL_NUM_PARAMS]; /* ---- grid ids + wave decomposition (lines 1371-1388) ---- */ rocke_value_t* q_block_global_idx; @@ -204,6 +209,21 @@ typedef struct rocke_gfx942_attn2d_build_ctx rocke_value_t* context_len; rocke_value_t* qb_start_pos; + /* ---- runtime_layout q-block geometry (Python ``if RTL:`` seq lookup) ---- + * rtl_q_rows: the rows the kernel writes in Q/O (a dense Q's padding rows + * included; a ragged Q's live rows only); + * rtl_q_src / rtl_o_dst: the per-sequence 64-bit Q/O bases; rtl_q_desc / + * rtl_o_desc: the runtime-stride [token, head, dim] descriptors. The + * grid-stride q-block loop and the "block has rows" branch are entered in + * the prologue and closed by the epilogue. */ + rocke_value_t* rtl_q_rows; + rocke_value_t* rtl_q_src; + rocke_value_t* rtl_o_dst; + rocke_dynamic_tensor_descriptor_t* rtl_q_desc; + rocke_dynamic_tensor_descriptor_t* rtl_o_desc; + rocke_for_t rtl_qb_loop; + rocke_if_t rtl_rows_if; + /* ---- Acc_lds stripe geometry (lines 1436-1443) ---- */ int OUT_STRIPE_COLS, OUT_STRIPES; @@ -299,6 +319,16 @@ typedef struct rocke_gfx942_attn2d_build_ctx rocke_value_t* k_rsrc; /* make_buffer_resource(K) */ rocke_value_t* v_rsrc; /* make_buffer_resource(V) */ rocke_value_t* out_rsrc; + /* big_bytes (const 0x7FFF0000), the K/V/block-table resource range. */ + rocke_value_t* big_bytes_v; + /* runtime_layout paged K/V: i64 page stride in bytes, the per-page byte + * descriptor [token, kv_head, dim], the masked-lane voffset and the K / V + * block-table buffer resources. NULL when off. */ + rocke_value_t* rtl_kv_page_stride_b; + rocke_dynamic_tensor_descriptor_t* rtl_kv_desc; + rocke_value_t* rtl_kv_oob; + rocke_value_t* rtl_bt_rsrc; + rocke_value_t* rtl_bt_v_rsrc; /* ---- per-lane Q VGPR gather (lines 3426-3592) ---- * * The Q MFMA A-operand registers (one path: the legacy 16x16 gather; the @@ -392,7 +422,6 @@ bool rocke_gfx942_attn2d_build_ctx_init(rocke_gfx942_attn2d_build_ctx_t* ctx, * byte-identical Python order. Names track the Python source so a reviewer can * diff each .c against its closure. * ===================================================================== */ - /* ----- per-lane row map + bit helpers (lines 2031-2052) ----- */ rocke_value_t* rocke_gfx942_attn2d_in_warp_row(rocke_gfx942_attn2d_build_ctx_t* ctx, int r); rocke_value_t* rocke_gfx942_attn2d_state_row(rocke_gfx942_attn2d_build_ctx_t* ctx, int r); diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_gfx950_attention_tiled_2d_internal.h b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_gfx950_attention_tiled_2d_internal.h index b529d0c4fbee..189a90196fcc 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_gfx950_attention_tiled_2d_internal.h +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/include/rocke/instance_gfx950_attention_tiled_2d_internal.h @@ -71,6 +71,7 @@ #include "rocke/helper_rocke.helpers.distribution.h" /* static tile distribution (32x32 C dist) */ #include "rocke/helper_rocke.helpers.layouts.h" /* rocke_transpose_lds_reader_t (PV reader) */ #include "rocke/helper_rocke.helpers.transforms.h" /* rocke_tensor_descriptor_t */ +#include "rocke/instance_attention_tiled_2d_rtl_internal.h" /* ROCKE_ATTN2D_RTL_* */ #include "rocke/instance_gfx950_attention_tiled_2d.h" /* spec_t + config_t (via helper hdr) */ #include "rocke/ir.h" @@ -183,6 +184,10 @@ typedef struct rocke_gfx950_attn2d_build_ctx rocke_value_t* num_kv_p; rocke_value_t* sliding_window_p; rocke_value_t* lse; /* lse_ptr (spec->emit_lse only, else NULL) */ + /* runtime_layout (spec->runtime_layout): the 18 appended kernel arguments, + * indexed by ROCKE_ATTN2D_RTL_* (Python _RTL_PARAMS); all NULL when off. */ + bool RTL; + rocke_value_t* rtl_p[ROCKE_ATTN2D_RTL_NUM_PARAMS]; /* ---- grid ids + wave decomposition ---- */ rocke_value_t* q_block_global_idx; @@ -203,6 +208,18 @@ typedef struct rocke_gfx950_attn2d_build_ctx rocke_value_t* context_len; rocke_value_t* qb_start_pos; + /* ---- runtime_layout q-block geometry (Python ``if RTL:`` seq lookup) ---- + * rtl_q_rows: the rows the kernel writes in Q/O (a dense Q's padding rows + * included; a ragged Q's live rows only); + * rtl_q_ptr / rtl_o_ptr: the per-sequence 64-bit Q/O bases. The grid-stride + * q-block loop and the live-block branch are entered in the prologue and + * closed by the epilogue. */ + rocke_value_t* rtl_q_rows; + rocke_value_t* rtl_q_ptr; + rocke_value_t* rtl_o_ptr; + rocke_for_t rtl_qb_loop; + rocke_if_t rtl_live_block; + /* ---- Acc_lds stripe geometry (lines 935-960) ---- */ int OUT_STRIPE_COLS, OUT_STRIPES; /* 32x32 epilogue stripe geometry (lines 3658-3717). */ @@ -312,6 +329,10 @@ typedef struct rocke_gfx950_attn2d_build_ctx rocke_value_t* k_rsrc; /* make_buffer_resource(K) */ rocke_value_t* v_rsrc; /* make_buffer_resource(V) */ rocke_value_t* out_rsrc; + /* runtime_layout paged K/V: i64 page stride in bytes and the per-page byte + * descriptor [token, kv_head, dim]. NULL when off. */ + rocke_value_t* rtl_kv_page_stride_b; + rocke_dynamic_tensor_descriptor_t* rtl_kv_desc; /* ---- per-lane Q VGPR gather ---- * * The Q MFMA A-operand registers (legacy 16x16 gather q_regs; the 32x32x16 / diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d.cpp index 05077bbb5552..d2095b4f4566 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d.cpp @@ -33,8 +33,10 @@ #include #include +#include "rocke/arch_target.h" #include "rocke/error.hpp" #include "rocke/helper_helper_rocke.instances.gfx942.attention_tiled_2d.h" +#include "rocke/helper_rocke.instances.common._fmha_common.h" /* rocke_attention_check_head_counts */ #include "rocke/ir.h" /* ------------------------------------------------------------- error latch */ @@ -131,9 +133,240 @@ rocke_attention_tiled_2d_spec_t rocke_attention_tiled_2d_spec_default(void) s.use_qblock_reverse = false; s.emit_lse = false; s.lse_head_major = false; + s.runtime_layout = false; return s; } +/* ------------------------------------------------ runtime_layout spec checks */ + +static void rocke_attn2d_reason(char* reason, size_t cap, const char* fmt, ...) +{ + if(reason == NULL || cap == 0) + return; + va_list ap; + va_start(ap, fmt); + (void)vsnprintf(reason, cap, fmt, ap); + va_end(ap); + reason[cap - 1] = '\0'; +} + +typedef struct rocke_attn2d_rtl_flag +{ + const char* name; + bool on; +} rocke_attn2d_rtl_flag_t; + +/* gfx942 _runtime_layout_reject_reason: every _RTL_INCOMPATIBLE_FLAGS entry + * that is set (in Python order), then kv_storage_dtype, a compile-time window + * and block_m_per_warp != 16, reported together; then the GQA ratio; then the + * sub-block tile_size rule. use_v_hbm_direct, use_k_hbm_direct and + * use_causal_mask_phase_split are not fields of the C struct. */ +bool rocke_gfx942_attention_tiled_2d_runtime_layout_reject_reason( + const rocke_attention_tiled_2d_spec_t* s, char* reason, size_t reason_cap) +{ + if(s == NULL || !s->runtime_layout) + return false; + const rocke_attn2d_rtl_flag_t flags[] = { + {"has_softcap", s->has_softcap}, + {"use_alibi", s->use_alibi}, + {"use_qq_bias", s->use_qq_bias}, + {"use_fp8_mfma_qk", s->use_fp8_mfma_qk}, + {"use_fp8_mfma_pv", s->use_fp8_mfma_pv}, + {"use_register_pv", s->use_register_pv}, + {"use_mfma_32x32", s->use_mfma_32x32}, + {"use_mfma_32x32x8", s->use_mfma_32x32x8}, + {"use_transposed_qk_32x32", s->use_transposed_qk_32x32}, + {"use_transposed_scalar_state", s->use_transposed_scalar_state}, + {"use_transposed_invariant_hoist", s->use_transposed_invariant_hoist}, + {"use_transposed_mask_once", s->use_transposed_mask_once}, + {"use_transposed_half_local_pv", s->use_transposed_half_local_pv}, + {"use_mfma32_skip_legacy_qreg", s->use_mfma32_skip_legacy_qreg}, + {"use_transposed_mask_limit", s->use_transposed_mask_limit}, + {"use_grouped_kv2_softmax", s->use_grouped_kv2_softmax}, + {"use_fast_paged_kv_desc", s->use_fast_paged_kv_desc}, + {"use_i64_kv_addr", s->use_i64_kv_addr}, + {"use_early_v_schedule", s->use_early_v_schedule}, + {"use_agpr_alloc_zero", s->use_agpr_alloc_zero}, + {"use_conflict_free_v", s->use_conflict_free_v}, + {"use_conflict_free_v_store", s->use_conflict_free_v_store}, + {"use_k_single_buffer", s->use_k_single_buffer}, + {"use_k_sliced_ring", s->use_k_sliced_ring}, + {"use_k_sliced_ldsseq", s->use_k_sliced_ldsseq}, + {"use_iglp_opt", s->use_iglp_opt}, + {"use_qk_pv_sched_group_barrier", s->use_qk_pv_sched_group_barrier}, + {"use_q_direct_global", s->use_q_direct_global}, + {"use_global_load_lds_k", s->use_global_load_lds_k}, + {"use_q_major_grid", s->use_q_major_grid}, + {"emit_lse", s->emit_lse}, + {"kv_storage_dtype", s->kv_storage_dtype != NULL}, + {"sliding_window != 0 (the window is a runtime kernarg)", s->sliding_window != 0}, + {"block_m_per_warp != 16", s->block_m_per_warp != 16}, + }; + char bad[ROCKE_ERR_MSG_CAP]; + size_t used = 0; + bad[0] = '\0'; + for(size_t i = 0; i < sizeof(flags) / sizeof(flags[0]); ++i) + { + if(!flags[i].on) + continue; + int n = snprintf( + bad + used, sizeof(bad) - used, "%s%s", used == 0 ? "" : ", ", flags[i].name); + if(n > 0) + used = (used + (size_t)n < sizeof(bad)) ? used + (size_t)n : sizeof(bad) - 1; + } + if(used != 0) + { + rocke_attn2d_reason(reason, reason_cap, "runtime_layout is incompatible with: %s", bad); + return true; + } + if(!rocke_attention_check_head_counts(s->num_query_heads, s->num_kv_heads, reason, reason_cap)) + return true; + if(s->has_tile_size) + { + const int t = s->tile_size; + if(t < 16 || t % 16 != 0 || t > s->block_size || s->block_size % t != 0) + { + rocke_attn2d_reason(reason, + reason_cap, + "runtime_layout tile_size must be a multiple of 16 that divides " + "block_size (got tile_size=%d, block_size=%d)", + t, + s->block_size); + return true; + } + } + return false; +} + +/* gfx950 _runtime_layout_reject_reason: the first failing check, in Python + * order. use_additive_bias, causal_top_left, right_bound, use_kq_lds_pad and + * use_mask_phase_split are not fields of the C struct. */ +bool rocke_gfx950_attention_tiled_2d_runtime_layout_reject_reason( + const rocke_attention_tiled_2d_spec_t* s, char* reason, size_t reason_cap) +{ + if(s == NULL || !s->runtime_layout) + return false; + if(!rocke_attention_check_head_counts(s->num_query_heads, s->num_kv_heads, reason, reason_cap)) + return true; + if(s->sliding_window != 0) + { + rocke_attn2d_reason(reason, + reason_cap, + "runtime_layout takes the sliding window as a kernarg; " + "spec sliding_window must be 0"); + return true; + } + const rocke_attn2d_rtl_flag_t features[] = { + {"has_softcap", s->has_softcap}, + {"use_alibi", s->use_alibi}, + {"use_qq_bias", s->use_qq_bias}, + {"kv_storage_dtype (fp8 KV)", s->kv_storage_dtype != NULL}, + {"use_fp8_mfma_qk", s->use_fp8_mfma_qk}, + {"use_fp8_mfma_pv", s->use_fp8_mfma_pv}, + {"emit_lse", s->emit_lse}, + }; + for(size_t i = 0; i < sizeof(features) / sizeof(features[0]); ++i) + { + if(features[i].on) + { + rocke_attn2d_reason( + reason, reason_cap, "runtime_layout does not support %s", features[i].name); + return true; + } + } + const rocke_attn2d_rtl_flag_t pipeline[] = { + {"use_mfma_32x32", s->use_mfma_32x32}, + {"use_transposed_qk_32x32", s->use_transposed_qk_32x32}, + {"use_fast_paged_kv_desc", s->use_fast_paged_kv_desc}, + {"use_i64_kv_addr (always 64-bit in runtime_layout)", s->use_i64_kv_addr}, + {"use_register_pv", s->use_register_pv}, + {"use_v_double_buffer", s->use_v_double_buffer}, + {"kv_ring_depth != 2", s->kv_ring_depth != 2}, + {"use_staggered_iter_wait", s->use_staggered_iter_wait}, + {"use_early_v_schedule", s->use_early_v_schedule}, + {"use_k_single_buffer", s->use_k_single_buffer}, + {"use_grouped_kv2_softmax", s->use_grouped_kv2_softmax}, + {"use_q_reread", s->use_q_reread}, + {"use_q_direct_reg", s->use_q_direct_reg}, + {"use_agpr_alloc_zero", s->use_agpr_alloc_zero}, + {"use_sched_barrier", s->use_sched_barrier}, + {"use_softmax_mfma_interleave", s->use_softmax_mfma_interleave}, + {"use_qblock_reverse", s->use_qblock_reverse}, + }; + for(size_t i = 0; i < sizeof(pipeline) / sizeof(pipeline[0]); ++i) + { + if(pipeline[i].on) + { + rocke_attn2d_reason(reason, + reason_cap, + "runtime_layout runs the default 16x16x32 pipeline; " + "%s is not supported", + pipeline[i].name); + return true; + } + } + if(s->block_m_per_warp != 16) + { + rocke_attn2d_reason(reason, reason_cap, "runtime_layout requires block_m_per_warp=16"); + return true; + } + if(s->has_tile_size && s->tile_size != s->block_size) + { + rocke_attn2d_reason(reason, + reason_cap, + "runtime_layout requires tile_size == block_size " + "(one paged block per KV tile)"); + return true; + } + /* Checked before the DMA divisibility below, which divides by it. */ + if(!(s->num_warps == 1 || s->num_warps == 2 || s->num_warps == 4 || s->num_warps == 8)) + { + rocke_attn2d_reason(reason, + reason_cap, + "runtime_layout requires num_warps in {1, 2, 4, 8} (got %d)", + s->num_warps); + return true; + } + /* Python: ArchTarget.from_gfx("gfx950").wave_size. */ + const rocke_arch_target_t* gfx950 = rocke_arch_target_from_gfx("gfx950"); + if(gfx950 == NULL) + { + rocke_attn2d_reason(reason, reason_cap, "runtime_layout: no gfx950 arch target"); + return true; + } + const int threads = s->num_warps * gfx950->wave_size; + if((s->block_size * s->head_size) % (threads * 8) != 0) + { + rocke_attn2d_reason(reason, + reason_cap, + "runtime_layout: block_size*head_size=%d must be a multiple of " + "num_warps*512=%d (whole async-DMA calls per tile)", + s->block_size * s->head_size, + threads * 8); + return true; + } + return false; +} + +/* gfx942 runtime_layout_lds_bytes: every allocation is touched inside the + * q-block grid-stride loop, so none alias. K double buffer + V (with the + * bank-deconflict row pad, an upper bound) + P_lds + Q_lds (only when Q does + * not fit in K_lds) + Acc_lds. */ +int rocke_gfx942_attention_tiled_2d_runtime_layout_lds_bytes(int head_size, + int tile_size, + int num_warps) +{ + const int t = tile_size; + const int hd = head_size; + const int bm = num_warps * 16; + const int k_lds = 2 * t * hd * 2; + const int v_lds = t * (hd + 8) * 2; + const int p_lds = bm * (t + 8) * 2; + const int q_lds = (bm <= 2 * t) ? 0 : bm * hd * 2; + const int acc_lds = bm * (hd <= 64 ? 32 : hd) * 2; + return k_lds + v_lds + p_lds + q_lds + acc_lds; +} + /* ------------------------------------------------- derived @property bodies */ int rocke_attention_tiled_2d_spec_num_queries_per_kv(const rocke_attention_tiled_2d_spec_t* s) @@ -247,6 +480,16 @@ bool rocke_attention_tiled_2d_spec_validate(rocke_ir_builder_t* b, rocke_attn2d_set_err(b, ROCKE_ERR_VALUE, "attention_tiled_2d spec is NULL"); return false; } + { + /* runtime_layout restrictions first, as in __post_init__. */ + char rtl_reason[ROCKE_ERR_MSG_CAP]; + if(rocke_gfx942_attention_tiled_2d_runtime_layout_reject_reason( + s, rtl_reason, sizeof(rtl_reason))) + { + rocke_attn2d_set_err(b, ROCKE_ERR_VALUE, "%s", rtl_reason); + return false; + } + } /* gfx950-only experimental knobs rejected up front on gfx942. * NOTE: use_agpr_alloc_zero is NOT an ISA feature -- it is a backend codegen diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_ctx_prologue.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_ctx_prologue.cpp index 0e936195c0a6..fa0375754922 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_ctx_prologue.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_ctx_prologue.cpp @@ -99,6 +99,136 @@ static bool rocke_a2d_require_tiled_attention_arch(rocke_ir_builder_t* b, const return false; } +/* Python ``if RTL:`` seq lookup: the dense-or-ragged q-block mapping (ragged: + * binary search over non-decreasing offsets; a q-block before the first + * origin finds -1, reads sequence 0 and writes no row), the grid-stride + * q-block loop (entered here, closed by the epilogue), the per-sequence row + * counts and lengths, the "block has rows" branch (also closed by the + * epilogue) and the 64-bit Q/O bases + runtime-stride Q/O descriptors. */ +static void rocke_a2d_rtl_seq_lookup(rocke_gfx942_attn2d_build_ctx_t* ctx, int BLOCK_Q) +{ + rocke_ir_builder_t* b = ctx->b; + rocke_value_t* const* p = ctx->rtl_p; + rocke_value_t* num_seqs = ctx->num_seqs_p; + rocke_value_t* q_len_u = p[ROCKE_ATTN2D_RTL_Q_UNIFORM_LEN]; + + rocke_value_t* c0 = rocke_b_const_i32(b, 0); + rocke_value_t* dense = rocke_b_cmp_gt(b, q_len_u, c0); + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* ragged = rocke_b_cmp_eq(b, q_len_u, c0); + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* has_lq = rocke_b_cmp_ne(b, p[ROCKE_ATTN2D_RTL_HAS_SEQ_LENS_Q], c0); + rocke_value_t* bq_m1 = rocke_b_const_i32(b, BLOCK_Q - 1); + rocke_value_t* len_up = rocke_b_add(b, q_len_u, bq_m1); + rocke_value_t* bq = rocke_b_const_i32(b, BLOCK_Q); + rocke_value_t* bps_dense = rocke_b_div(b, len_up, bq); + rocke_value_t* c1 = rocke_b_const_i32(b, 1); + rocke_value_t* bps = rocke_b_select(b, dense, bps_dense, c1); + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* off_end + = rocke_b_masked_global_load(b, ctx->cu_q, num_seqs, ragged, c0, rocke_i32(), 4); + rocke_value_t* total_dense = rocke_b_mul(b, num_seqs, bps); + bq = rocke_b_const_i32(b, BLOCK_Q); + rocke_value_t* off_end_blocks = rocke_b_div(b, off_end, bq); + rocke_value_t* total_ragged = rocke_b_add(b, off_end_blocks, num_seqs); + rocke_value_t* total = rocke_b_select(b, dense, total_dense, total_ragged); + + ctx->rtl_qb_loop = rocke_b_scf_for( + b, ctx->q_block_global_idx, total, p[ROCKE_ATTN2D_RTL_Q_BLOCK_GRID], "rtl_qb"); + rocke_b_region_enter(b, ctx->rtl_qb_loop.body); + rocke_value_t* qb = ctx->rtl_qb_loop.iv; + ctx->q_block_global_idx = qb; + + /* DENSE maps q-blocks arithmetically: its search runs no iteration. */ + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* trip = rocke_binary_search_seq_idx_trip_count(b, num_seqs); + rocke_value_t* iters = rocke_b_select(b, dense, c0, trip); + rocke_value_t* seq_ragged + = rocke_binary_search_seq_idx_dyn(b, ctx->cu_q, qb, num_seqs, BLOCK_Q, iters, false); + rocke_value_t* seq_dense = rocke_b_div(b, qb, bps); + rocke_value_t* seq_found = rocke_b_select(b, dense, seq_dense, seq_ragged); + /* A q-block before the first origin finds no sequence (-1). */ + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* seq_ok = rocke_b_cmp_ge(b, seq_found, c0); + c0 = rocke_b_const_i32(b, 0); + ctx->seq_idx = rocke_b_smax(b, seq_found, c0); + rocke_value_t* seq_idx = ctx->seq_idx; + + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* off_start + = rocke_b_masked_global_load(b, ctx->cu_q, seq_idx, ragged, c0, rocke_i32(), 4); + c1 = rocke_b_const_i32(b, 1); + rocke_value_t* seq_p1 = rocke_b_add(b, seq_idx, c1); + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* off_stop + = rocke_b_masked_global_load(b, ctx->cu_q, seq_p1, ragged, c0, rocke_i32(), 4); + c0 = rocke_b_const_i32(b, 0); + rocke_value_t* lq = rocke_b_masked_global_load( + b, p[ROCKE_ATTN2D_RTL_SEQ_LENS_Q], seq_idx, has_lq, c0, rocke_i32(), 4); + + /* owned: the rows the sequence's block spans; a ragged Q writes only its live + * rows (rows of the block past seq_lens_q belong to no sequence). */ + rocke_value_t* rows_ragged = rocke_b_sub(b, off_stop, off_start); + rocke_value_t* owned = rocke_b_select(b, dense, q_len_u, rows_ragged); + rocke_value_t* live = rocke_b_smin(b, owned, lq); + ctx->cur_batch_q_len = rocke_b_select(b, has_lq, live, owned); + rocke_value_t* q_rows = rocke_b_select(b, dense, q_len_u, ctx->cur_batch_q_len); + /* Below the (negative) start position of a q-block with no sequence. */ + rocke_value_t* no_rows = rocke_b_const_i32(b, -2147483647 - 1); + ctx->rtl_q_rows = rocke_b_select(b, seq_ok, q_rows, no_rows); + rocke_value_t* seq_base_idx = rocke_b_select(b, dense, seq_idx, off_start); + rocke_value_t* qbs_dense = rocke_b_mul(b, seq_idx, bps); + bq = rocke_b_const_i32(b, BLOCK_Q); + rocke_value_t* off_start_blocks = rocke_b_div(b, off_start, bq); + rocke_value_t* qbs_ragged = rocke_b_add(b, off_start_blocks, seq_idx); + ctx->q_block_start_idx = rocke_b_select(b, dense, qbs_dense, qbs_ragged); + ctx->q_block_local_idx = rocke_b_sub(b, qb, ctx->q_block_start_idx); + ctx->seq_len = rocke_b_global_load_i32(b, ctx->seq_lens, seq_idx, 0); + /* A length past the table row would walk the page-table read off its end: + * bound it by the row's width (block_table_width * block_size). The width is + * its own argument: block_table_stride is the row-to-row step, which a batch + * of one has no use for. */ + { + rocke_value_t* c_bs_cap = rocke_b_const_i32(b, ctx->BS); + rocke_value_t* bt_cap + = rocke_b_mul(b, ctx->rtl_p[ROCKE_ATTN2D_RTL_BLOCK_TABLE_WIDTH], c_bs_cap); + rocke_value_t* in_cap = rocke_b_cmp_ult(b, ctx->seq_len, bt_cap); + ctx->seq_len = rocke_b_select(b, in_cap, ctx->seq_len, bt_cap); + } + ctx->context_len = rocke_b_sub(b, ctx->seq_len, ctx->cur_batch_q_len); + bq = rocke_b_const_i32(b, BLOCK_Q); + ctx->qb_start_pos = rocke_b_mul(b, ctx->q_block_local_idx, bq); + + rocke_value_t* has_rows = rocke_b_cmp_lt(b, ctx->qb_start_pos, ctx->rtl_q_rows); + ctx->rtl_rows_if = rocke_b_scf_if(b, has_rows); + rocke_b_region_enter(b, ctx->rtl_rows_if.then_region); + + /* 64-bit per-sequence Q/O bases; within-sequence offsets stay i32. */ + rocke_value_t* sb64 = rocke_b_zext(b, seq_base_idx, rocke_i64()); + rocke_value_t* q_seq64 = rocke_b_zext(b, p[ROCKE_ATTN2D_RTL_Q_SEQ_STRIDE], rocke_i64()); + rocke_value_t* q_elems = rocke_b_mul(b, sb64, q_seq64); + rocke_value_t* one64 = rocke_b_const_i64(b, 1); + rocke_value_t* q_bytes = rocke_b_shl(b, q_elems, one64); + ctx->rtl_q_src = rocke_b_global_ptr_add(b, ctx->query, q_bytes); + rocke_value_t* o_seq64 = rocke_b_zext(b, p[ROCKE_ATTN2D_RTL_O_SEQ_STRIDE], rocke_i64()); + rocke_value_t* o_elems = rocke_b_mul(b, sb64, o_seq64); + one64 = rocke_b_const_i64(b, 1); + rocke_value_t* o_bytes = rocke_b_shl(b, o_elems, one64); + ctx->rtl_o_dst = rocke_b_global_ptr_add(b, ctx->output, o_bytes); + + static const char* const qo_coords[3] = {"token", "head", "dim"}; + rocke_value_t* q_strides[3]; + q_strides[0] = p[ROCKE_ATTN2D_RTL_Q_TOK_STRIDE]; + q_strides[1] = p[ROCKE_ATTN2D_RTL_Q_HEAD_STRIDE]; + q_strides[2] = rocke_b_const_i32(b, 1); + ctx->rtl_q_desc = rocke_tensor_descriptor_naive_dynamic(b, "rtl_q", qo_coords, 3, q_strides); + rocke_value_t* o_strides[3]; + o_strides[0] = p[ROCKE_ATTN2D_RTL_O_TOK_STRIDE]; + o_strides[1] = p[ROCKE_ATTN2D_RTL_O_HEAD_STRIDE]; + o_strides[2] = rocke_b_const_i32(b, 1); + ctx->rtl_o_desc = rocke_tensor_descriptor_naive_dynamic(b, "rtl_o", qo_coords, 3, o_strides); +} + /* ===================================================================== * * rocke_gfx942_attn2d_build_ctx_init -- the prologue (lines 1104-1912) * ===================================================================== */ @@ -118,6 +248,18 @@ bool rocke_gfx942_attn2d_build_ctx_init(rocke_gfx942_attn2d_build_ctx_t* ctx, ctx->spec = spec; ctx->arch = arch; + /* ---- runtime_layout spec checks (__post_init__ raises them first) ---- */ + { + char rtl_reason[ROCKE_ERR_MSG_CAP]; + if(rocke_gfx942_attention_tiled_2d_runtime_layout_reject_reason( + spec, rtl_reason, sizeof(rtl_reason))) + { + b->status = ROCKE_ERR_VALUE; + snprintf(b->err, ROCKE_ERR_MSG_CAP, "%s", rtl_reason); + return false; + } + } + /* ---- require_tiled_attention_arch(arch) (lines 1139-1141) ---- */ if(!rocke_a2d_require_tiled_attention_arch(b, arch)) return false; @@ -162,6 +304,29 @@ bool rocke_gfx942_attn2d_build_ctx_init(rocke_gfx942_attn2d_build_ctx_t* ctx, * the op_id are consumed downstream. */ ctx->qk_atom = (const rocke_mfma_atom_t*)qk_atom; + /* ---- runtime_layout LDS budget (ArchTarget lds_capacity_bytes) ---- */ + if(spec->runtime_layout) + { + const int rtl_t = rocke_attention_tiled_2d_spec_tile_size_eff(spec); + const int rtl_lds = rocke_gfx942_attention_tiled_2d_runtime_layout_lds_bytes( + spec->head_size, rtl_t, spec->num_warps); + if(target == NULL || rtl_lds > target->lds_capacity_bytes) + { + b->status = ROCKE_ERR_VALUE; + snprintf(b->err, + ROCKE_ERR_MSG_CAP, + "runtime_layout: estimated LDS %d B (num_warps=%d, T=%d, HD=%d) " + "exceeds the %s %d B LDS budget", + rtl_lds, + spec->num_warps, + rtl_t, + spec->head_size, + arch, + target == NULL ? 0 : target->lds_capacity_bytes); + return false; + } + } + /* ---- ALL-CAPS geometry constants (lines 1161-1184) ---- */ const int HD = spec->head_size; const int T = rocke_attention_tiled_2d_spec_tile_size_eff(spec); @@ -421,6 +586,12 @@ bool rocke_gfx942_attn2d_build_ctx_init(rocke_gfx942_attn2d_build_ctx_t* ctx, o.align_set = true; ctx->lse = rocke_b_param(b, "lse_ptr", ptr_f32, &o); } + /* runtime_layout: the 18 appended arguments (RUNTIME_LAYOUT_EXTRA_ARGS). */ + if(spec->runtime_layout) + { + ctx->RTL = true; + rocke_attn2d_rtl_declare_params(b, ctx->rtl_p); + } } /* ---- grid ids + wave decomposition (lines 1371-1388) ---- */ @@ -450,28 +621,33 @@ bool rocke_gfx942_attn2d_build_ctx_init(rocke_gfx942_attn2d_build_ctx_t* ctx, } /* ---- seq lookup + Q-block geometry (lines 1390-1409) ---- */ + if(ctx->RTL) + { + rocke_a2d_rtl_seq_lookup(ctx, BLOCK_Q); + } + else { rocke_value_t* trip = rocke_binary_search_seq_idx_trip_count(b, ctx->num_seqs_p); ctx->seq_idx = rocke_binary_search_seq_idx_dyn( b, ctx->cu_q, ctx->q_block_global_idx, ctx->num_seqs_p, BLOCK_Q, trip, false); - } - ctx->cu_q_start = rocke_b_global_load_i32(b, ctx->cu_q, ctx->seq_idx, 0); - ctx->cu_q_stop = rocke_b_global_load_i32( - b, ctx->cu_q, rocke_b_add(b, ctx->seq_idx, rocke_b_const_i32(b, 1)), 0); - ctx->cur_batch_q_len = rocke_b_sub(b, ctx->cu_q_stop, ctx->cu_q_start); - ctx->q_block_start_idx = rocke_b_add( - b, rocke_b_div(b, ctx->cu_q_start, rocke_b_const_i32(b, BLOCK_Q)), ctx->seq_idx); - ctx->q_block_local_idx = rocke_b_sub(b, ctx->q_block_global_idx, ctx->q_block_start_idx); - ctx->seq_len = rocke_b_global_load_i32(b, ctx->seq_lens, ctx->seq_idx, 0); - ctx->context_len = rocke_b_sub(b, ctx->seq_len, ctx->cur_batch_q_len); - - ctx->qb_start_pos = rocke_b_mul(b, ctx->q_block_local_idx, rocke_b_const_i32(b, BLOCK_Q)); - { - rocke_if_t f - = rocke_b_scf_if(b, rocke_b_cmp_ge(b, ctx->qb_start_pos, ctx->cur_batch_q_len)); - rocke_b_region_enter(b, f.then_region); - rocke_b_ret(b); - rocke_b_region_leave(b); + ctx->cu_q_start = rocke_b_global_load_i32(b, ctx->cu_q, ctx->seq_idx, 0); + ctx->cu_q_stop = rocke_b_global_load_i32( + b, ctx->cu_q, rocke_b_add(b, ctx->seq_idx, rocke_b_const_i32(b, 1)), 0); + ctx->cur_batch_q_len = rocke_b_sub(b, ctx->cu_q_stop, ctx->cu_q_start); + ctx->q_block_start_idx = rocke_b_add( + b, rocke_b_div(b, ctx->cu_q_start, rocke_b_const_i32(b, BLOCK_Q)), ctx->seq_idx); + ctx->q_block_local_idx = rocke_b_sub(b, ctx->q_block_global_idx, ctx->q_block_start_idx); + ctx->seq_len = rocke_b_global_load_i32(b, ctx->seq_lens, ctx->seq_idx, 0); + ctx->context_len = rocke_b_sub(b, ctx->seq_len, ctx->cur_batch_q_len); + + ctx->qb_start_pos = rocke_b_mul(b, ctx->q_block_local_idx, rocke_b_const_i32(b, BLOCK_Q)); + { + rocke_if_t f + = rocke_b_scf_if(b, rocke_b_cmp_ge(b, ctx->qb_start_pos, ctx->cur_batch_q_len)); + rocke_b_region_enter(b, f.then_region); + rocke_b_ret(b); + rocke_b_region_leave(b); + } } /* ---- Acc_lds stripe geometry (lines 1436-1443) ---- */ diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_epilogue.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_epilogue.cpp index 1fb7c7b97637..802828762783 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_epilogue.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_epilogue.cpp @@ -375,11 +375,15 @@ rocke_kernel_def_t* rocke_gfx942_attn2d_emit_epilogue(rocke_gfx942_attn2d_build_ rocke_value_t* op_pos = rocke_b_add(b, qb_start_pos, rocke_b_div(b, OUT_ROW_BASE, rocke_b_const_i32(b, NQK))); /* op_qh = kv_head*NQK + OUT_ROW_BASE%NQK (mul before mod); op_mask = (op_pos - * < q_len) && (op_qh < NUM_QH) (pos cmp before qh cmp). Sequence via temps. */ + * < q_len) && (op_qh < NUM_QH) (pos cmp before qh cmp). Sequence via temps. + * runtime_layout stores every row it owns (rtl_q_rows): live rows get their + * attention, and a dense Q's padding rows past seq_lens_q were masked like + * keyless rows, so they store zeros. A ragged Q owns only its live rows. */ rocke_value_t* op_qh_mul = rocke_b_mul(b, kv_head_idx, rocke_b_const_i32(b, NQK)); rocke_value_t* op_qh_mod = rocke_b_mod(b, OUT_ROW_BASE, rocke_b_const_i32(b, NQK)); rocke_value_t* op_qh = rocke_b_add(b, op_qh_mul, op_qh_mod); - rocke_value_t* op_mask_pos = rocke_b_cmp_lt(b, op_pos, cur_batch_q_len); + rocke_value_t* op_mask_pos + = rocke_b_cmp_lt(b, op_pos, ctx->RTL ? ctx->rtl_q_rows : cur_batch_q_len); rocke_value_t* op_mask_qh = rocke_b_cmp_lt(b, op_qh, ctx->num_qh_p); rocke_value_t* op_mask_inner = rocke_b_land(b, op_mask_pos, op_mask_qh); /* Skip the VALID_ROWS guard when VALID_ROWS == BLOCK_M (NQK divides BLOCK_M). */ @@ -396,10 +400,27 @@ rocke_kernel_def_t* rocke_gfx942_attn2d_emit_epilogue(rocke_gfx942_attn2d_build_ } /* Python evaluates token=add(cu_q_start, op_pos) BEFORE dim=const(0) * (kwargs left-to-right). Bind them in that order so C's arg-eval order - * does not allocate the dim const ahead of the token add and shift it. */ - rocke_value_t* out_token = rocke_b_add(b, cu_q_start, op_pos); - rocke_value_t* out_dim0 = rocke_b_const_i32(b, 0); - rocke_value_t* out_base = epilogue_q_desc_offset(ctx, out_token, op_qh, out_dim0); + * does not allocate the dim const ahead of the token add and shift it. + * runtime_layout: rtl_o_desc.offset(token=op_pos, head=op_qh, dim=0) from + * the per-sequence base rtl_o_dst. */ + rocke_value_t* out_base = NULL; + if(ctx->RTL) + { + static const char* const o_names[3] = {"token", "head", "dim"}; + rocke_value_t* o_vals[3]; + o_vals[0] = op_pos; + o_vals[1] = op_qh; + o_vals[2] = rocke_b_const_i32(b, 0); + (void)rocke_dynamic_tensor_descriptor_offset( + b, ctx->rtl_o_desc, o_names, o_vals, 3, &out_base, NULL); + output = ctx->rtl_o_dst; + } + else + { + rocke_value_t* out_token = rocke_b_add(b, cu_q_start, op_pos); + rocke_value_t* out_dim0 = rocke_b_const_i32(b, 0); + out_base = epilogue_q_desc_offset(ctx, out_token, op_qh, out_dim0); + } for(stripe = 0; stripe < OUT_STRIPES; ++stripe) { @@ -470,5 +491,15 @@ rocke_kernel_def_t* rocke_gfx942_attn2d_emit_epilogue(rocke_gfx942_attn2d_build_ } } + if(ctx->RTL) + { + /* Close the "block has rows" branch, then fence LDS reuse before the + * next grid-stride q-block (its Q staging and K/V DMA rewrite the slabs + * this q-block's epilogue just read), then close the q-block loop. */ + rocke_b_region_leave(b); + rocke_b_sync(b); + rocke_b_region_leave(b); + } + return rocke_ir_builder_kernel(b); } diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_kv_body_qk_softmax.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_kv_body_qk_softmax.cpp index ca504a72a79d..fc33df2dc65b 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_kv_body_qk_softmax.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_kv_body_qk_softmax.cpp @@ -1099,7 +1099,7 @@ void rocke_gfx942_attn2d_emit_kv_body(rocke_gfx942_attn2d_build_ctx_t* ctx) rocke_value_t* in_prefix = rocke_b_cmp_lt(b, col_abs, max_seq_prefix_len); rocke_value_t* m_ok = rocke_b_land(b, rocke_b_land(b, row_ok, causal_ok), in_prefix); - if(ctx->SLIDING_WINDOW > 0) + if(ctx->SLIDING_WINDOW > 0 || ctx->RTL) { rocke_value_t* dist = rocke_b_sub(b, causal_lim, col_abs); m_ok = rocke_b_land(b, m_ok, rocke_b_cmp_lt(b, dist, sw_const)); diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_kv_descriptors_loads.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_kv_descriptors_loads.cpp index c1a400150979..a465b3ea6437 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_kv_descriptors_loads.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_kv_descriptors_loads.cpp @@ -323,6 +323,7 @@ void rocke_gfx942_attn2d_emit_preloop(rocke_gfx942_attn2d_build_ctx_t* ctx) /* big-bytes K/V buffer resources (2166-2168). The buffer rsrc bounds OOB * voffsets to return zero; size it large so valid offsets never trip it. */ rocke_value_t* big_bytes = rocke_b_const_i32(b, 0x7FFF0000); + ctx->big_bytes_v = big_bytes; ctx->k_rsrc = rocke_b_buffer_rsrc(b, ctx->key, big_bytes); ctx->v_rsrc = rocke_b_buffer_rsrc(b, ctx->value, big_bytes); @@ -388,6 +389,36 @@ void rocke_gfx942_attn2d_emit_preloop(rocke_gfx942_attn2d_build_ctx_t* ctx) rocke_value_t* seq_base = rocke__seq_base(ctx); rocke_value_t* max_idx = rocke__block_table_max_idx(ctx); + if(ctx->RTL) + { + /* Runtime-stride paged K/V (bytes): K and V share all strides. A tile + * never crosses a cache block (tile_size divides block_size), so each + * tile load reads its page id once and builds one buffer resource at the + * page's 64-bit base, with range kv_block_span_bytes. Block-table reads + * go through a buffer resource so a masked entry is an out-of-range + * voffset. K pages through block_tables_ptr, V through + * block_tables_v_ptr. */ + rocke_value_t* const* p = ctx->rtl_p; + (void)max_idx; + rocke_value_t* blk_stride64 + = rocke_b_sext(b, p[ROCKE_ATTN2D_RTL_KV_BLOCK_STRIDE], rocke_i64()); + rocke_value_t* one64 = rocke_b_const_i64(b, 1); + ctx->rtl_kv_page_stride_b = rocke_b_shl(b, blk_stride64, one64); + static const char* const kv_coords_rtl[3] = {"token", "kv_head", "dim"}; + rocke_value_t* strides[3]; + rocke_value_t* one = rocke_b_const_i32(b, 1); + strides[0] = rocke_b_shl(b, p[ROCKE_ATTN2D_RTL_KV_TOK_STRIDE], one); + one = rocke_b_const_i32(b, 1); + strides[1] = rocke_b_shl(b, p[ROCKE_ATTN2D_RTL_KV_HEAD_STRIDE], one); + strides[2] = rocke_b_const_i32(b, 2); + ctx->rtl_kv_desc = rocke_tensor_descriptor_naive_dynamic( + b, "rtl_kv_page_bytes", kv_coords_rtl, 3, strides); + ctx->rtl_kv_oob = rocke_b_const_i32(b, 0x7FFFFFF0); + ctx->rtl_bt_rsrc = rocke_b_buffer_rsrc(b, ctx->block_tables, big_bytes); + ctx->rtl_bt_v_rsrc = rocke_b_buffer_rsrc(b, p[ROCKE_ATTN2D_RTL_BLOCK_TABLES_V], big_bytes); + ctx->kv_desc = NULL; + return; + } /* _kv_base = naive("paged_kv_bytes", * lengths=[1<<24, BS, NUM_KV, HD], * strides=[kv_stride_blk_b, kv_stride_tok_b, kv_stride_h_b, KV_BYTES], @@ -684,6 +715,83 @@ static rocke_value_t* return rocke_gfx942_attn2d_kv_page_off(ctx, token, dim, kv_head_b); } +/* ========================================================================== + * runtime_layout paged K/V (Python _rtl_kv_block / _rtl_kv_call). + * ========================================================================== */ + +typedef struct rocke__rtl_kv_block +{ + rocke_value_t* tok0; /* first token of the tile */ + rocke_value_t* tok_in_blk0; /* its offset within the cache block */ + rocke_value_t* rsrc; /* the page's buffer resource */ +} rocke__rtl_kv_block_t; + +/* _rtl_kv_block(cache, bt_rsrc, kv_tile_idx): one page-table read and one + * buffer resource per tile load. Entries at or past ceil(seq_len / BS) read + * through an out-of-range voffset and return block 0 without touching memory. */ +static rocke__rtl_kv_block_t rocke__rtl_kv_block(rocke_gfx942_attn2d_build_ctx_t* ctx, + rocke_value_t* cache, + rocke_value_t* bt_rsrc, + rocke_value_t* kv_tile_idx) +{ + rocke_ir_builder_t* b = ctx->b; + rocke__rtl_kv_block_t blk; + rocke_value_t* c_t = rocke_b_const_i32(b, ctx->T); + blk.tok0 = rocke_b_mul(b, kv_tile_idx, c_t); + rocke_value_t* c_bs = rocke_b_const_i32(b, ctx->BS); + rocke_value_t* lblk = rocke_b_div(b, blk.tok0, c_bs); + c_bs = rocke_b_const_i32(b, ctx->BS); + rocke_value_t* lblk_tok = rocke_b_mul(b, lblk, c_bs); + rocke_value_t* blk_ok = rocke_b_cmp_lt(b, lblk_tok, ctx->seq_len); + rocke_value_t* bt_idx = rocke_b_add(b, rocke__seq_base(ctx), lblk); + rocke_value_t* c2 = rocke_b_const_i32(b, 2); + rocke_value_t* bt_byte = rocke_b_shl(b, bt_idx, c2); + rocke_value_t* bt_voff = rocke_b_select(b, blk_ok, bt_byte, ctx->rtl_kv_oob); + rocke_value_t* phys_v + = rocke_b_buffer_load_vN(b, bt_rsrc, bt_voff, rocke__zero_soff(ctx), rocke_i32(), 1); + rocke_value_t* phys_e = rocke_b_vec_extract(b, phys_v, 0); + rocke_value_t* phys = rocke_b_to_sgpr_u32(b, phys_e); + /* A page id outside [0, num_kv_blocks) would address memory outside the + * cache: it reads as a masked page (block 0, zero-size resource). */ + rocke_value_t* phys_ok = rocke_b_cmp_ult(b, phys, ctx->rtl_p[ROCKE_ATTN2D_RTL_NUM_KV_BLOCKS]); + phys = rocke_b_select(b, phys_ok, phys, rocke_b_const_i32(b, 0)); + rocke_value_t* phys64 = rocke_b_zext(b, phys, rocke_i64()); + rocke_value_t* page_off = rocke_b_mul(b, phys64, ctx->rtl_kv_page_stride_b); + rocke_value_t* page = rocke_b_global_ptr_add(b, cache, page_off); + rocke_value_t* span = rocke_b_select( + b, phys_ok, ctx->rtl_p[ROCKE_ATTN2D_RTL_KV_BLOCK_SPAN_BYTES], rocke_b_const_i32(b, 0)); + blk.rsrc = rocke_b_buffer_rsrc(b, page, span); + blk.tok_in_blk0 = rocke_b_sub(b, blk.tok0, lblk_tok); + return blk; +} + +/* _rtl_kv_call(call, blk): this lane's voffset within the page for one async + * K/V call; lanes whose token is at or past seq_len read nothing. */ +static rocke_value_t* rocke__rtl_kv_call(rocke_gfx942_attn2d_build_ctx_t* ctx, + int call, + const rocke__rtl_kv_block_t* blk) +{ + rocke_ir_builder_t* b = ctx->b; + rocke_value_t* c_call = rocke_b_const_i32(b, call * rocke__kv_halves_per_call(ctx)); + rocke_value_t* linear_half = rocke_b_add(b, c_call, rocke__lane_half_base(ctx)); + rocke_value_t* c_hd = rocke_b_const_i32(b, ctx->HD); + rocke_value_t* tok = rocke_b_div(b, linear_half, c_hd); + c_hd = rocke_b_const_i32(b, ctx->HD); + rocke_value_t* dim = rocke_b_mod(b, linear_half, c_hd); + static const char* const in_names[3] = {"token", "kv_head", "dim"}; + rocke_value_t* in_values[3]; + in_values[0] = rocke_b_add(b, blk->tok_in_blk0, tok); + in_values[1] = ctx->kv_head_idx; + in_values[2] = dim; + rocke_value_t* within = NULL; + if(!rocke_dynamic_tensor_descriptor_offset( + b, ctx->rtl_kv_desc, in_names, in_values, 3, &within, NULL)) + return NULL; + rocke_value_t* tok_abs = rocke_b_add(b, blk->tok0, tok); + rocke_value_t* tok_ok = rocke_b_cmp_lt(b, tok_abs, ctx->seq_len); + return rocke_b_select(b, tok_ok, within, ctx->rtl_kv_oob); +} + /* ========================================================================== * Standard K/V async-DMA loaders (Python lines 2440-2619). * ========================================================================== */ @@ -711,14 +819,17 @@ void rocke_gfx942_attn2d_issue_k_load_runtime(rocke_gfx942_attn2d_build_ctx_t* c rocke_value_t* fast_block0 = NULL; rocke_value_t* fast_block1 = NULL; - if(ctx->FAST_PAGED_KV_DESC) - rocke_gfx942_attn2d_fast_paged_kv_blocks(ctx, kv_tile_idx, &fast_block0, &fast_block1); + rocke__rtl_kv_block_t rtl_blk = {NULL, NULL, NULL}; bool page_rsrc = rocke_gfx942_attn2d_page_rsrc_i64(ctx); rocke_value_t** page_ptrs = NULL; rocke_value_t** page_rsrcs = NULL; rocke_value_t* kv_head_b = NULL; - if(page_rsrc - && !rocke__tile_pages(ctx, ctx->key, kv_tile_idx, &page_ptrs, &page_rsrcs, &kv_head_b)) + if(ctx->FAST_PAGED_KV_DESC) + rocke_gfx942_attn2d_fast_paged_kv_blocks(ctx, kv_tile_idx, &fast_block0, &fast_block1); + else if(ctx->RTL) + rtl_blk = rocke__rtl_kv_block(ctx, ctx->key, ctx->rtl_bt_rsrc, kv_tile_idx); + else if(page_rsrc + && !rocke__tile_pages(ctx, ctx->key, kv_tile_idx, &page_ptrs, &page_rsrcs, &kv_head_b)) return; for(int call = 0; call < kv_calls_per_tile; ++call) @@ -726,7 +837,12 @@ void rocke_gfx942_attn2d_issue_k_load_runtime(rocke_gfx942_attn2d_build_ctx_t* c rocke_value_t* k_rsrc = ctx->k_rsrc; rocke_value_t* k_ptr = ctx->key; rocke_value_t* voff = NULL; - if(ctx->FAST_PAGED_KV_DESC) + if(ctx->RTL) + { + k_rsrc = rtl_blk.rsrc; + voff = rocke__rtl_kv_call(ctx, call, &rtl_blk); + } + else if(ctx->FAST_PAGED_KV_DESC) { rocke_value_t* base_i64 = NULL; rocke__fast_paged_kv_voff_split( @@ -848,21 +964,30 @@ void rocke_gfx942_attn2d_issue_v_load_runtime(rocke_gfx942_attn2d_build_ctx_t* c rocke_value_t* fast_block0 = NULL; rocke_value_t* fast_block1 = NULL; - if(ctx->FAST_PAGED_KV_DESC) - rocke_gfx942_attn2d_fast_paged_kv_blocks(ctx, kv_tile_idx, &fast_block0, &fast_block1); + rocke__rtl_kv_block_t rtl_blk = {NULL, NULL, NULL}; bool page_rsrc = rocke_gfx942_attn2d_page_rsrc_i64(ctx); rocke_value_t** page_ptrs = NULL; rocke_value_t** page_rsrcs = NULL; rocke_value_t* kv_head_b = NULL; - if(page_rsrc - && !rocke__tile_pages(ctx, ctx->value, kv_tile_idx, &page_ptrs, &page_rsrcs, &kv_head_b)) + if(ctx->FAST_PAGED_KV_DESC) + rocke_gfx942_attn2d_fast_paged_kv_blocks(ctx, kv_tile_idx, &fast_block0, &fast_block1); + else if(ctx->RTL) + rtl_blk = rocke__rtl_kv_block(ctx, ctx->value, ctx->rtl_bt_v_rsrc, kv_tile_idx); + else if(page_rsrc + && !rocke__tile_pages( + ctx, ctx->value, kv_tile_idx, &page_ptrs, &page_rsrcs, &kv_head_b)) return; for(int call = 0; call < kv_calls_per_tile; ++call) { rocke_value_t* v_rsrc = ctx->v_rsrc; rocke_value_t* voff = NULL; - if(ctx->FAST_PAGED_KV_DESC) + if(ctx->RTL) + { + v_rsrc = rtl_blk.rsrc; + voff = rocke__rtl_kv_call(ctx, call, &rtl_blk); + } + else if(ctx->FAST_PAGED_KV_DESC) { rocke_value_t* base_i64 = NULL; rocke__fast_paged_kv_voff_split( diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_loop_scaffold.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_loop_scaffold.cpp index c3edf6420ac4..098d3f186e82 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_loop_scaffold.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_loop_scaffold.cpp @@ -54,6 +54,16 @@ static rocke_value_t* sc_rcp_ln2(rocke_gfx942_attn2d_build_ctx_t* ctx) return rocke_b_const_f32(B, 1.4426950408889634); } +/* Python ``_sink_logit``: query head qh's sink logit in f32 (runtime-layout + * kernels pick the fp32 or Q-dtype sink form from sink_is_f32). */ +static rocke_value_t* + sc_sink_logit(rocke_gfx942_attn2d_build_ctx_t* ctx, rocke_value_t* qh, rocke_value_t* qh_in) +{ + if(!ctx->RTL) + return rocke_b_cast_to_f32(B, rocke_b_global_load(B, ctx->sinks, qh, ctx->dtype, 2)); + return rocke_attn2d_rtl_sink_logit(B, ctx->rtl_p, ctx->sinks, qh, qh_in, ctx->dtype); +} + /* _in_warp_row(r) (Python 2031-2037): the in-warp row for softmax state slot r * on the narrow (block_m_per_warp=16/32) layout. */ static rocke_value_t* @@ -107,9 +117,17 @@ void rocke_gfx942_attn2d_emit_loop_bounds_and_inits(rocke_gfx942_attn2d_build_ct * const) emitted before the outer divisor const, matching Python. */ rocke_value_t* nt_inner = rocke_b_add(B, max_seq_prefix_len, rocke_b_const_i32(B, T - 1)); rocke_value_t* num_tiles = rocke_b_div(B, nt_inner, rocke_b_const_i32(B, T)); + if(ctx->RTL) + { + /* A q-block of padding rows only reads no key: its rows store zeros. */ + rocke_value_t* has_live = rocke_b_cmp_lt(B, ctx->qb_start_pos, ctx->cur_batch_q_len); + rocke_value_t* c0 = rocke_b_const_i32(B, 0); + num_tiles = rocke_b_select(B, has_live, num_tiles, c0); + } - /* tile_start / tile_end (1987-2005). */ - if(SLIDING_WINDOW > 0) + /* tile_start / tile_end (1987-2005). runtime_layout always compiles the + * window bounds (the window is a kernel argument). */ + if(SLIDING_WINDOW > 0 || ctx->RTL) { /* Reuse the cached sw_const (line 1910), do NOT create a fresh const * here -- Python references the same SSA value. */ @@ -183,8 +201,8 @@ void rocke_gfx942_attn2d_emit_loop_bounds_and_inits(rocke_gfx942_attn2d_build_ct rocke_value_t* qh_mod = rocke_b_mod(B, row, rocke_b_const_i32(B, NQK)); rocke_value_t* qh = rocke_b_add(B, qh_mul, qh_mod); rocke_value_t* qh_in = rocke_b_cmp_lt(B, qh, ctx->num_qh_p); - rocke_value_t* sink_h = rocke_b_global_load(B, ctx->sinks, qh, ctx->dtype, 2); - rocke_value_t* sink_f = rocke_b_fmul(B, rocke_b_cast_to_f32(B, sink_h), rcp_ln2); + rocke_value_t* sink_l = sc_sink_logit(ctx, qh, qh_in); + rocke_value_t* sink_f = rocke_b_fmul(B, sink_l, rcp_ln2); m_inits[0] = rocke_b_select(B, qh_in, sink_f, neg_inf); } else if(ctx->USE_SINKS) @@ -199,8 +217,8 @@ void rocke_gfx942_attn2d_emit_loop_bounds_and_inits(rocke_gfx942_attn2d_build_ct rocke_value_t* qh_mod = rocke_b_mod(B, row, rocke_b_const_i32(B, NQK)); rocke_value_t* qh = rocke_b_add(B, qh_mul, qh_mod); rocke_value_t* qh_in = rocke_b_cmp_lt(B, qh, ctx->num_qh_p); - rocke_value_t* sink_h = rocke_b_global_load(B, ctx->sinks, qh, ctx->dtype, 2); - rocke_value_t* sink_f = rocke_b_fmul(B, rocke_b_cast_to_f32(B, sink_h), rcp_ln2); + rocke_value_t* sink_l = sc_sink_logit(ctx, qh, qh_in); + rocke_value_t* sink_f = rocke_b_fmul(B, sink_l, rcp_ln2); m_inits[r] = rocke_b_select(B, qh_in, sink_f, neg_inf); } } diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_public_entry_glue.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_public_entry_glue.cpp index 79e3128f5fb6..8b12b78271f3 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_public_entry_glue.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_public_entry_glue.cpp @@ -639,6 +639,7 @@ static rocke_status_t s->use_iglp_opt ? "iglp1" : "", s->use_k_single_buffer ? "k1buf" : "", s->emit_lse ? "lse" : "", + s->runtime_layout ? "rtl" : "", }; size_t num_parts = sizeof(parts) / sizeof(parts[0]); return rocke_kernel_name_join( diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_q_load_gather.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_q_load_gather.cpp index 81135a4eb790..cfa357ebe94e 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_q_load_gather.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx942/attention_tiled_2d_q_load_gather.cpp @@ -169,19 +169,37 @@ void rocke_gfx942_attn2d_emit_q_load(rocke_gfx942_attn2d_build_ctx_t* ctx) qh_safe = rocke_b_select(b, qmask_t, qh_t, rocke_b_const_i32(b, 0)); /* q_off_base, _ = q_desc.offset(b, token=cu_q_start+q_pos_safe, - * head=qh_safe, dim=0) */ + * head=qh_safe, dim=0) + * runtime_layout: rtl_q_desc.offset(token=q_pos_safe, head=qh_safe, + * dim=0) from the per-sequence base rtl_q_src. */ { static const char* const in_names[3] = {"token", "head", "dim"}; rocke_value_t* in_values[3]; - in_values[0] = rocke_b_add(b, ctx->cu_q_start, q_pos_safe); - in_values[1] = qh_safe; - in_values[2] = rocke_b_const_i32(b, 0); - rocke_transforms_descriptor_offset( - b, ctx->q_desc, in_names, in_values, 3, &q_off_base, NULL); + if(ctx->RTL) + { + in_values[0] = q_pos_safe; + in_values[1] = qh_safe; + in_values[2] = rocke_b_const_i32(b, 0); + rocke_dynamic_tensor_descriptor_offset( + b, ctx->rtl_q_desc, in_names, in_values, 3, &q_off_base, NULL); + } + else + { + in_values[0] = rocke_b_add(b, ctx->cu_q_start, q_pos_safe); + in_values[1] = qh_safe; + in_values[2] = rocke_b_const_i32(b, 0); + rocke_transforms_descriptor_offset( + b, ctx->q_desc, in_names, in_values, 3, &q_off_base, NULL); + } } - /* v8 = b.global_load_vN(query, q_off_base + Q_col, dtype, 8, align=16) */ - v8 = rocke_b_global_load_vN(b, ctx->query, rocke_b_add(b, q_off_base, Q_col), dtype, 8, 16); + /* v8 = b.global_load_vN(_q_src, q_off_base + Q_col, dtype, 8, align=16) */ + v8 = rocke_b_global_load_vN(b, + ctx->RTL ? ctx->rtl_q_src : ctx->query, + rocke_b_add(b, q_off_base, Q_col), + dtype, + 8, + 16); /* Q store index: K_lds-aliased (buf,row_in_buf,col) or plain (row,col). */ if(ctx->Q_ALIAS_K) diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_fastkv_regp_helpers.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_fastkv_regp_helpers.cpp index 63576e573ee0..0f0fe47b2917 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_fastkv_regp_helpers.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_fastkv_regp_helpers.cpp @@ -124,6 +124,7 @@ static rocke_status_t rocke__fastkv_gfx950_base_name(const rocke_attention_tiled s->use_fp8_mfma_pv ? "fp8pv" : "", s->use_register_pv ? "regpv" : "", s->emit_lse ? (s->lse_head_major ? "lsehm" : "lse") : "", + s->runtime_layout ? "rtl" : "", }; size_t num_parts = sizeof(parts) / sizeof(parts[0]); return rocke_kernel_name_join( diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_body_pv_epilogue.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_body_pv_epilogue.cpp index 5ba1b8b62034..56a694fbf2a1 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_body_pv_epilogue.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_body_pv_epilogue.cpp @@ -1062,7 +1062,12 @@ rocke_kernel_def_t* rocke_gfx950_attn2d_emit_epilogue(rocke_gfx950_attn2d_build_ op_qh = rocke_b_add(b, qh_mul, qh_mod); } { - rocke_value_t* mask_pos = rocke_b_cmp_lt(b, op_pos, ctx->cur_batch_q_len); + /* runtime_layout stores every row it owns (rtl_q_rows): live rows get + * their attention, and a dense Q's padding rows past seq_lens_q were + * masked like keyless rows, so they store zeros. A ragged Q owns only + * its live rows. */ + rocke_value_t* mask_pos + = rocke_b_cmp_lt(b, op_pos, ctx->RTL ? ctx->rtl_q_rows : ctx->cur_batch_q_len); rocke_value_t* mask_qh = rocke_b_cmp_lt(b, op_qh, ctx->num_qh_p); rocke_value_t* mask_inner = rocke_b_land(b, mask_pos, mask_qh); if(ctx->VALID_ROWS < ctx->BLOCK_M) @@ -1076,15 +1081,29 @@ rocke_kernel_def_t* rocke_gfx950_attn2d_emit_epilogue(rocke_gfx950_attn2d_build_ op_mask = mask_inner; } } - in_names[0] = coord_names[0]; - in_names[1] = coord_names[1]; - in_names[2] = coord_names[2]; - in_values[0] = rocke_b_add(b, ctx->cu_q_start, op_pos); - in_values[1] = op_qh; - in_values[2] = rocke_b_const_i32(b, 0); - if(!rocke_transforms_descriptor_offset( - b, ctx->q_desc, in_names, in_values, 3, &out_base, NULL)) - return NULL; + /* out_base = _o_row_off(op_pos, op_qh): q_desc.offset(token=cu_q_start+ + * op_pos, head=op_qh, dim=0), or in runtime_layout op_pos*o_tok_stride + + * op_qh*o_head_stride from rtl_o_ptr. */ + if(ctx->RTL) + { + rocke_value_t* pos_off + = rocke_b_mul(b, op_pos, ctx->rtl_p[ROCKE_ATTN2D_RTL_O_TOK_STRIDE]); + rocke_value_t* head_off + = rocke_b_mul(b, op_qh, ctx->rtl_p[ROCKE_ATTN2D_RTL_O_HEAD_STRIDE]); + out_base = rocke_b_add(b, pos_off, head_off); + } + else + { + in_names[0] = coord_names[0]; + in_names[1] = coord_names[1]; + in_names[2] = coord_names[2]; + in_values[0] = rocke_b_add(b, ctx->cu_q_start, op_pos); + in_values[1] = op_qh; + in_values[2] = rocke_b_const_i32(b, 0); + if(!rocke_transforms_descriptor_offset( + b, ctx->q_desc, in_names, in_values, 3, &out_base, NULL)) + return NULL; + } for(stripe = 0; stripe < ctx->OUT_STRIPES; ++stripe) { int n_start = stripe * N_TILES_PER_STRIPE; @@ -1134,8 +1153,12 @@ rocke_kernel_def_t* rocke_gfx950_attn2d_emit_epilogue(rocke_gfx950_attn2d_build_ col_in_stripe); iff = rocke_b_scf_if(b, op_mask); rocke_b_region_enter(b, iff.then_region); - rocke_b_global_store_vN( - b, ctx->output, rocke_b_add(b, out_base, out_col), v8h, OUT_VEC, 16); + rocke_b_global_store_vN(b, + ctx->RTL ? ctx->rtl_o_ptr : ctx->output, + rocke_b_add(b, out_base, out_col), + v8h, + OUT_VEC, + 16); rocke_b_region_leave(b); } if(stripe + 1 < ctx->OUT_STRIPES) @@ -1173,6 +1196,16 @@ rocke_kernel_def_t* rocke_gfx950_attn2d_emit_epilogue(rocke_gfx950_attn2d_build_ } } + if(ctx->RTL) + { + /* Close the live-block branch, then a barrier between grid-stride + * iterations (the next q-block reuses the same LDS: Q staging aliases + * K_lds; Acc_lds is rewritten), then close the q-block loop. */ + rocke_b_region_leave(b); + rocke_b_sync(b); + rocke_b_region_leave(b); + } + (void)i; return ctx->b->kernel; } diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_body_qk_softmax.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_body_qk_softmax.cpp index 06cf9fb90932..3ff6ba1dc08c 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_body_qk_softmax.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_body_qk_softmax.cpp @@ -792,7 +792,7 @@ void rocke_gfx950_attn2d_emit_kv_body(rocke_gfx950_attn2d_build_ctx_t* ctx) causal_ok = rocke_b_cmp_le(b, col_abs, causal_lim); in_prefix = rocke_b_cmp_lt(b, col_abs, max_seq_prefix_len); m_ok = rocke_b_land(b, rocke_b_land(b, row_ok, causal_ok), in_prefix); - if(ctx->SLIDING_WINDOW > 0) + if(ctx->SLIDING_WINDOW > 0 || ctx->RTL) /* SW_ACTIVE */ { rocke_value_t* dist = rocke_b_sub(b, causal_lim, col_abs); m_ok = rocke_b_land(b, m_ok, rocke_b_cmp_lt(b, dist, sw_const)); @@ -989,7 +989,7 @@ void rocke_gfx950_attn2d_emit_kv_body(rocke_gfx950_attn2d_build_ctx_t* ctx) rocke_value_t* s_raw; rocke_value_t* s_scaled; rocke_value_t* score; - if(ctx->SLIDING_WINDOW > 0) + if(ctx->SLIDING_WINDOW > 0 || ctx->RTL) /* SW_ACTIVE */ { rocke_value_t* dist = rocke_b_sub(b, causal_lim, col_abs); m_ok = rocke_b_land(b, m_ok, rocke_b_cmp_lt(b, dist, sw_const)); @@ -1167,7 +1167,7 @@ void rocke_gfx950_attn2d_emit_kv_body(rocke_gfx950_attn2d_build_ctx_t* ctx) rocke_value_t* in_prefix = rocke_b_cmp_lt(b, col_abs, max_seq_prefix_len); rocke_value_t* m_ok = rocke_b_land(b, rocke_b_land(b, row_ok, causal_ok), in_prefix); - if(ctx->SLIDING_WINDOW > 0) + if(ctx->SLIDING_WINDOW > 0 || ctx->RTL) /* SW_ACTIVE */ { rocke_value_t* dist = rocke_b_sub(b, causal_lim, col_abs); m_ok = rocke_b_land(b, m_ok, rocke_b_cmp_lt(b, dist, sw_const)); diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_descriptors_loads.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_descriptors_loads.cpp index 08a70cb37b86..f83e9eff403a 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_descriptors_loads.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_kv_descriptors_loads.cpp @@ -195,9 +195,11 @@ static int rocke__copy_tokens(const rocke_gfx950_attn2d_build_ctx_t* ctx) return rocke__kv_halves_per_call(ctx) / ctx->HD; } +/* runtime_layout builds its own page resources (rocke__rtl_kv_page). */ static bool rocke__page_copies(const rocke_gfx950_attn2d_build_ctx_t* ctx) { - return !ctx->FAST_PAGED_KV_DESC && !ctx->KV_FP8 && rocke__kv_halves_per_call(ctx) % ctx->HD == 0 + return !ctx->RTL && !ctx->FAST_PAGED_KV_DESC && !ctx->KV_FP8 + && rocke__kv_halves_per_call(ctx) % ctx->HD == 0 && ctx->BS % rocke__copy_tokens(ctx) == 0; } @@ -391,14 +393,51 @@ void rocke_gfx950_attn2d_emit_preloop(rocke_gfx950_attn2d_build_ctx_t* ctx) /* seq_base (1525) + block_table_max_idx (1538): the per-sequence base index * into block_tables and the global footprint bound; both wave-uniform SGPRs. * Python emits these BEFORE the FAST_PAGED_KV_DESC branch, so both paths see - * them in the same source position. */ + * them in the same source position. runtime_layout bounds the lookups by + * this sequence's ceil(seq_len / BS) entries instead. */ rocke_value_t* seq_base = rocke__seq_base(ctx); + if(ctx->RTL) + { + rocke_value_t* bs_m1 = rocke_b_const_i32(b, ctx->BS - 1); + rocke_value_t* len_up = rocke_b_add(b, ctx->seq_len, bs_m1); + rocke_value_t* bs = rocke_b_const_i32(b, ctx->BS); + rocke_value_t* n_blocks = rocke_b_div(b, len_up, bs); + ctx->block_table_max_idx = rocke_b_to_sgpr_u32(b, rocke_b_add(b, seq_base, n_blocks)); + } rocke_value_t* max_idx = rocke__block_table_max_idx(ctx); (void)rocke__bytes_per_buf; (void)rocke__bytes_per_call; (void)rocke__kv_calls_per_tile; + if(ctx->RTL) + { + /* Runtime-stride paged KV bytes. One paged block per tile (T == BS): + * each tile load reads its page id once and builds one buffer resource + * at the page's 64-bit base, with range kv_block_span_bytes. + * Token/head/dim stay in the i32 voffset. K and V share strides. */ + rocke_value_t* const* p = ctx->rtl_p; + rocke_value_t* blk_stride64 + = rocke_b_zext(b, p[ROCKE_ATTN2D_RTL_KV_BLOCK_STRIDE], rocke_i64()); + rocke_value_t* kv_bytes64 = rocke_b_const_i64(b, ctx->KV_BYTES); + ctx->rtl_kv_page_stride_b = rocke_b_mul(b, blk_stride64, kv_bytes64); + static const char* const kv_coords_rtl[3] = {"token", "kv_head", "dim"}; + rocke_value_t* strides[3]; + rocke_value_t* kv_bytes = rocke_b_const_i32(b, ctx->KV_BYTES); + strides[0] = rocke_b_mul(b, p[ROCKE_ATTN2D_RTL_KV_TOK_STRIDE], kv_bytes); + kv_bytes = rocke_b_const_i32(b, ctx->KV_BYTES); + strides[1] = rocke_b_mul(b, p[ROCKE_ATTN2D_RTL_KV_HEAD_STRIDE], kv_bytes); + strides[2] = rocke_b_const_i32(b, ctx->KV_BYTES); + ctx->rtl_kv_desc = rocke_tensor_descriptor_naive_dynamic( + b, "rtl_kv_page_bytes", kv_coords_rtl, 3, strides); + ctx->kv_desc = NULL; + (void)max_idx; + /* fp8 async-loader setup (Python 1785-1796) runs after the paged-KV + * descriptor branch on every path. */ + rocke_gfx950_attn2d_emit_fp8_async_preloop_setup(ctx); + return; + } + /* FAST_PAGED_KV_DESC (1539): the gfx950 production fast paged-KV path emits no * standalone descriptor object -- the per-call byte offsets are built directly * by _fast_paged_kv_blocks / _fast_paged_kv_voff (1550-1589). */ @@ -547,6 +586,64 @@ rocke_value_t* rocke_gfx950_attn2d_fast_paged_kv_voff(rocke_gfx950_attn2d_build_ return voff; } +/* ========================================================================== + * runtime_layout paged K/V (Python _rtl_kv_page / _rtl_kv_voff). + * ========================================================================== */ + +/* _rtl_kv_page(src, table, kv_tile_idx): the buffer resource of the tile's + * page (block 0 past the table). ``table`` is K's block_tables_ptr or V's + * block_tables_v_ptr; both rows start at seq_base. */ +static rocke_value_t* rocke__rtl_kv_page(rocke_gfx950_attn2d_build_ctx_t* ctx, + rocke_value_t* src, + rocke_value_t* table, + rocke_value_t* kv_tile_idx) +{ + rocke_ir_builder_t* b = ctx->b; + rocke_value_t* idx = rocke_b_add(b, rocke__seq_base(ctx), kv_tile_idx); + rocke_value_t* in_table = rocke_b_cmp_lt(b, idx, rocke__block_table_max_idx(ctx)); + rocke_value_t* c0 = rocke_b_const_i32(b, 0); + rocke_value_t* phys = rocke_b_masked_global_load(b, table, idx, in_table, c0, rocke_i32(), 4); + rocke_value_t* phys_s = rocke_b_to_sgpr_u32(b, phys); + /* A page id outside [0, num_kv_blocks) would address memory outside the + * cache: it reads as a masked page (block 0, zero-size resource). */ + rocke_value_t* phys_ok = rocke_b_cmp_ult(b, phys_s, ctx->rtl_p[ROCKE_ATTN2D_RTL_NUM_KV_BLOCKS]); + phys_s = rocke_b_select(b, phys_ok, phys_s, rocke_b_const_i32(b, 0)); + rocke_value_t* phys64 = rocke_b_zext(b, phys_s, rocke_i64()); + rocke_value_t* page_off = rocke_b_mul(b, phys64, ctx->rtl_kv_page_stride_b); + rocke_value_t* page = rocke_b_global_ptr_add(b, src, page_off); + rocke_value_t* span = rocke_b_select( + b, phys_ok, ctx->rtl_p[ROCKE_ATTN2D_RTL_KV_BLOCK_SPAN_BYTES], rocke_b_const_i32(b, 0)); + return rocke_b_buffer_rsrc(b, page, span); +} + +/* _rtl_kv_voff(kv_tile_idx, linear_half): this lane's voffset within the page + * for one async-DMA call. Lanes whose token is at or past seq_len get an + * out-of-range voffset, so the DMA writes zeros without touching memory. */ +static rocke_value_t* rocke__rtl_kv_voff(rocke_gfx950_attn2d_build_ctx_t* ctx, + rocke_value_t* kv_tile_idx, + rocke_value_t* linear_half) +{ + rocke_ir_builder_t* b = ctx->b; + rocke_value_t* c_hd = rocke_b_const_i32(b, ctx->HD); + rocke_value_t* tok_in_tile = rocke_b_div(b, linear_half, c_hd); + c_hd = rocke_b_const_i32(b, ctx->HD); + rocke_value_t* dim = rocke_b_mod(b, linear_half, c_hd); + static const char* const in_names[3] = {"token", "kv_head", "dim"}; + rocke_value_t* in_values[3]; + in_values[0] = tok_in_tile; + in_values[1] = ctx->kv_head_idx; + in_values[2] = dim; + rocke_value_t* within = NULL; + if(!rocke_dynamic_tensor_descriptor_offset( + b, ctx->rtl_kv_desc, in_names, in_values, 3, &within, NULL)) + return NULL; + rocke_value_t* c_t = rocke_b_const_i32(b, ctx->T); + rocke_value_t* tile_tok0 = rocke_b_mul(b, kv_tile_idx, c_t); + rocke_value_t* tok = rocke_b_add(b, tile_tok0, tok_in_tile); + rocke_value_t* tok_ok = rocke_b_cmp_lt(b, tok, ctx->seq_len); + return rocke_b_select(b, tok_ok, within, ctx->rtl_p[ROCKE_ATTN2D_RTL_KV_BLOCK_SPAN_BYTES]); +} + /* ========================================================================== * Standard (bf16) K/V async-DMA loaders (Python lines 1631-1739). * ========================================================================== */ @@ -576,8 +673,11 @@ void rocke_gfx950_attn2d_issue_k_load_runtime(rocke_gfx950_attn2d_build_ctx_t* c rocke_value_t* fast_block0 = NULL; rocke_value_t* fast_block1 = NULL; + rocke_value_t* rtl_rsrc = NULL; if(ctx->FAST_PAGED_KV_DESC) rocke_gfx950_attn2d_fast_paged_kv_blocks(ctx, kv_tile_idx, &fast_block0, &fast_block1); + else if(ctx->RTL) + rtl_rsrc = rocke__rtl_kv_page(ctx, ctx->key, ctx->block_tables, kv_tile_idx); /* This tile's page ids by block, read on first use. */ rocke_value_t** pages = rocke__value_table(ctx, ctx->N_BLOCKS_PER_TILE); @@ -609,13 +709,19 @@ void rocke_gfx950_attn2d_issue_k_load_runtime(rocke_gfx950_attn2d_build_ctx_t* c * linear_half = call*KV_HALVES_PER_CALL + lane_half_base * voff, _ = paged_kv_desc.offset(tile_idx=, linear_half=, kv_head=) * (Python 1660-1681). I64_KV_ADDR uses offset_i64_split, folding the - * physical_block term into a 64-bit buffer base. */ + * physical_block term into a 64-bit buffer base. runtime_layout uses + * the tile's page resource and the page voffset. */ rocke_value_t* linear_half = rocke_b_add(b, rocke_b_const_i32(b, call * kv_halves_per_call), lane_half_base); const char* in_names[3] = {"tile_idx", "linear_half", "kv_head"}; rocke_value_t* in_values[3] = {kv_tile_idx, linear_half, ctx->kv_head_idx}; rocke_value_t* valid = NULL; - if(ctx->I64_KV_ADDR) + if(ctx->RTL) + { + k_rsrc = rtl_rsrc; + voff = rocke__rtl_kv_voff(ctx, kv_tile_idx, linear_half); + } + else if(ctx->I64_KV_ADDR) { rocke_value_t* base_i64 = NULL; if(!rocke_transforms_descriptor_offset_i64_split(b, @@ -664,8 +770,12 @@ void rocke_gfx950_attn2d_issue_v_load_runtime(rocke_gfx950_attn2d_build_ctx_t* c rocke_value_t* fast_block0 = NULL; rocke_value_t* fast_block1 = NULL; + rocke_value_t* rtl_rsrc = NULL; if(ctx->FAST_PAGED_KV_DESC) rocke_gfx950_attn2d_fast_paged_kv_blocks(ctx, kv_tile_idx, &fast_block0, &fast_block1); + else if(ctx->RTL) + rtl_rsrc = rocke__rtl_kv_page( + ctx, ctx->value, ctx->rtl_p[ROCKE_ATTN2D_RTL_BLOCK_TABLES_V], kv_tile_idx); /* This tile's page ids by block, read on first use. */ rocke_value_t** pages = rocke__value_table(ctx, ctx->N_BLOCKS_PER_TILE); @@ -696,13 +806,19 @@ void rocke_gfx950_attn2d_issue_v_load_runtime(rocke_gfx950_attn2d_build_ctx_t* c /* Non-fast paged-KV: voff = paged_kv_desc.offset(tile_idx=, * linear_half=call*KV_HALVES_PER_CALL+lane_half_base, kv_head=) * (Python 1711-1732). I64_KV_ADDR uses offset_i64_split, folding the - * physical_block term into a 64-bit buffer base. */ + * physical_block term into a 64-bit buffer base. runtime_layout uses + * the tile's page resource and the page voffset. */ rocke_value_t* linear_half = rocke_b_add(b, rocke_b_const_i32(b, call * kv_halves_per_call), lane_half_base); const char* in_names[3] = {"tile_idx", "linear_half", "kv_head"}; rocke_value_t* in_values[3] = {kv_tile_idx, linear_half, ctx->kv_head_idx}; rocke_value_t* valid = NULL; - if(ctx->I64_KV_ADDR) + if(ctx->RTL) + { + v_rsrc = rtl_rsrc; + voff = rocke__rtl_kv_voff(ctx, kv_tile_idx, linear_half); + } + else if(ctx->I64_KV_ADDR) { rocke_value_t* base_i64 = NULL; if(!rocke_transforms_descriptor_offset_i64_split(b, diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_public_entry_glue.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_public_entry_glue.cpp index a545016f0de3..6f058fc51738 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_public_entry_glue.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_public_entry_glue.cpp @@ -368,6 +368,106 @@ bool rocke_gfx950_attention_tiled_2d_supports( return true; } +/* Python ``if RTL:`` seq lookup. DENSE (q_uniform_len = L > 0): bps = + * ceil(L / BLOCK_Q) q-blocks per sequence, seq = qb / bps, base token seq. + * RAGGED (L == 0): query_start_len_ptr holds token offsets (non-decreasing, + * off[b+1] - off[b] >= seq_lens_q[b], off[B] the end of the last block); seq + * comes from the q-block binary search, base token off[seq]. A q-block before + * the first origin (search result -1) reads sequence 0 and writes no row. + * Enters the grid-stride q-block loop (closed by the epilogue). One builder + * call per statement, in Python order. */ +static void rocke_g950_rtl_seq_lookup(rocke_gfx950_attn2d_build_ctx_t* ctx, int BLOCK_Q) +{ + rocke_ir_builder_t* b = ctx->b; + rocke_value_t* const* p = ctx->rtl_p; + rocke_value_t* num_seqs = ctx->num_seqs_p; + rocke_value_t* zero = rocke_b_const_i32(b, 0); + rocke_value_t* one = rocke_b_const_i32(b, 1); + rocke_value_t* bq = rocke_b_const_i32(b, BLOCK_Q); + rocke_value_t* q_len_u = p[ROCKE_ATTN2D_RTL_Q_UNIFORM_LEN]; + rocke_value_t* dense = rocke_b_cmp_gt(b, q_len_u, zero); + rocke_value_t* ragged = rocke_b_cmp_le(b, q_len_u, zero); + rocke_value_t* has_slq = rocke_b_cmp_ne(b, p[ROCKE_ATTN2D_RTL_HAS_SEQ_LENS_Q], zero); + rocke_value_t* bq_m1 = rocke_b_const_i32(b, BLOCK_Q - 1); + rocke_value_t* len_up = rocke_b_add(b, q_len_u, bq_m1); + rocke_value_t* bps_dense = rocke_b_div(b, len_up, bq); + rocke_value_t* bps = rocke_b_select(b, dense, bps_dense, one); + rocke_value_t* off_total + = rocke_b_masked_global_load(b, ctx->cu_q, num_seqs, ragged, zero, rocke_i32(), 4); + rocke_value_t* total_dense = rocke_b_mul(b, num_seqs, bps); + rocke_value_t* off_total_blocks = rocke_b_div(b, off_total, bq); + rocke_value_t* total_ragged = rocke_b_add(b, off_total_blocks, num_seqs); + rocke_value_t* total = rocke_b_select(b, dense, total_dense, total_ragged); + + ctx->rtl_qb_loop = rocke_b_scf_for( + b, ctx->q_block_global_idx, total, p[ROCKE_ATTN2D_RTL_Q_BLOCK_GRID], "rtl_qb"); + rocke_b_region_enter(b, ctx->rtl_qb_loop.body); + rocke_value_t* qb = ctx->rtl_qb_loop.iv; + ctx->q_block_global_idx = qb; + + /* DENSE maps q-blocks arithmetically: its search runs no iteration. */ + rocke_value_t* trip = rocke_binary_search_seq_idx_trip_count(b, num_seqs); + rocke_value_t* iters = rocke_b_select(b, dense, zero, trip); + rocke_value_t* seq_ragged + = rocke_binary_search_seq_idx_dyn(b, ctx->cu_q, qb, num_seqs, BLOCK_Q, iters, false); + rocke_value_t* seq_dense = rocke_b_div(b, qb, bps); + rocke_value_t* seq_found = rocke_b_select(b, dense, seq_dense, seq_ragged); + /* A q-block before the first origin finds no sequence (-1). */ + rocke_value_t* seq_ok = rocke_b_cmp_ge(b, seq_found, zero); + ctx->seq_idx = rocke_b_smax(b, seq_found, zero); + rocke_value_t* seq_idx = ctx->seq_idx; + rocke_value_t* off_start + = rocke_b_masked_global_load(b, ctx->cu_q, seq_idx, ragged, zero, rocke_i32(), 4); + rocke_value_t* seq_p1 = rocke_b_add(b, seq_idx, one); + rocke_value_t* off_stop + = rocke_b_masked_global_load(b, ctx->cu_q, seq_p1, ragged, zero, rocke_i32(), 4); + rocke_value_t* slq = rocke_b_masked_global_load( + b, p[ROCKE_ATTN2D_RTL_SEQ_LENS_Q], seq_idx, has_slq, zero, rocke_i32(), 4); + + /* owned: the rows the sequence's block spans; a ragged Q writes only its live + * rows (rows of the block past seq_lens_q belong to no sequence). */ + rocke_value_t* rows_ragged = rocke_b_sub(b, off_stop, off_start); + rocke_value_t* owned = rocke_b_select(b, dense, q_len_u, rows_ragged); + rocke_value_t* live = rocke_b_smin(b, owned, slq); + ctx->cur_batch_q_len = rocke_b_select(b, has_slq, live, owned); + rocke_value_t* q_rows = rocke_b_select(b, dense, q_len_u, ctx->cur_batch_q_len); + /* Below the (negative) start position of a q-block with no sequence. */ + rocke_value_t* no_rows = rocke_b_const_i32(b, -2147483647 - 1); + ctx->rtl_q_rows = rocke_b_select(b, seq_ok, q_rows, no_rows); + rocke_value_t* qbs_dense = rocke_b_mul(b, seq_idx, bps); + rocke_value_t* off_start_blocks = rocke_b_div(b, off_start, bq); + rocke_value_t* qbs_ragged = rocke_b_add(b, off_start_blocks, seq_idx); + ctx->q_block_start_idx = rocke_b_select(b, dense, qbs_dense, qbs_ragged); + ctx->q_block_local_idx = rocke_b_sub(b, qb, ctx->q_block_start_idx); + ctx->seq_len = rocke_b_global_load_i32(b, ctx->seq_lens, seq_idx, 0); + /* A length past the table row would walk the page-table read off its end: + * bound it by the row's width (block_table_width * block_size). The width is + * its own argument: block_table_stride is the row-to-row step, which a batch + * of one has no use for. */ + { + rocke_value_t* c_bs_cap = rocke_b_const_i32(b, ctx->BS); + rocke_value_t* bt_cap + = rocke_b_mul(b, ctx->rtl_p[ROCKE_ATTN2D_RTL_BLOCK_TABLE_WIDTH], c_bs_cap); + rocke_value_t* in_cap = rocke_b_cmp_ult(b, ctx->seq_len, bt_cap); + ctx->seq_len = rocke_b_select(b, in_cap, ctx->seq_len, bt_cap); + } + ctx->context_len = rocke_b_sub(b, ctx->seq_len, ctx->cur_batch_q_len); + + /* Per-sequence Q/O base terms in i64 (ragged offsets times the multiplier + * can pass 2^31 elements); within-sequence terms stay i32. */ + rocke_value_t* sb = rocke_b_select(b, dense, seq_idx, off_start); + rocke_value_t* sb64 = rocke_b_zext(b, sb, rocke_i64()); + rocke_value_t* elem_bytes = rocke_b_const_i64(b, 2); + rocke_value_t* q_seq64 = rocke_b_zext(b, p[ROCKE_ATTN2D_RTL_Q_SEQ_STRIDE], rocke_i64()); + rocke_value_t* q_elems = rocke_b_mul(b, sb64, q_seq64); + rocke_value_t* q_bytes = rocke_b_mul(b, q_elems, elem_bytes); + ctx->rtl_q_ptr = rocke_b_global_ptr_add(b, ctx->query, q_bytes); + rocke_value_t* o_seq64 = rocke_b_zext(b, p[ROCKE_ATTN2D_RTL_O_SEQ_STRIDE], rocke_i64()); + rocke_value_t* o_elems = rocke_b_mul(b, sb64, o_seq64); + rocke_value_t* o_bytes = rocke_b_mul(b, o_elems, elem_bytes); + ctx->rtl_o_ptr = rocke_b_global_ptr_add(b, ctx->output, o_bytes); +} + /* ===================================================================== * * rocke_gfx950_attn2d_build_ctx_init -- the prologue (Python 711-1151) * @@ -391,6 +491,14 @@ static bool rocke_gfx950_attn2d_build_ctx_init(rocke_gfx950_attn2d_build_ctx_t* ctx->spec = spec; ctx->arch = arch; + /* ---- runtime_layout spec checks (__post_init__ raises them first) ---- */ + { + char rtl_reason[ROCKE_ERR_MSG_CAP]; + if(rocke_gfx950_attention_tiled_2d_runtime_layout_reject_reason( + spec, rtl_reason, sizeof(rtl_reason))) + rocke_g950_fail(b, ROCKE_ERR_VALUE, rtl_reason); + } + /* ---- require_tiled_attention_arch(arch) (Py748) ---- */ if(!rocke_g950_require_tiled_attention_arch(b, arch)) return false; @@ -761,6 +869,12 @@ static bool rocke_gfx950_attn2d_build_ctx_init(rocke_gfx950_attn2d_build_ctx_t* o.align_set = true; ctx->lse = rocke_b_param(b, "lse_ptr", ptr_f32, &o); } + /* runtime_layout: the 18 appended arguments (_RTL_PARAMS). */ + if(spec->runtime_layout) + { + ctx->RTL = true; + rocke_attn2d_rtl_declare_params(b, ctx->rtl_p); + } } /* ---- grid ids + wave decomposition (Py891-904) ---- */ @@ -793,22 +907,36 @@ static bool rocke_gfx950_attn2d_build_ctx_init(rocke_gfx950_attn2d_build_ctx_t* } /* ---- seq lookup + Q-block geometry (Py906-925) ---- */ + if(ctx->RTL) + { + rocke_g950_rtl_seq_lookup(ctx, BLOCK_Q); + } + else { rocke_value_t* trip = rocke_binary_search_seq_idx_trip_count(b, ctx->num_seqs_p); ctx->seq_idx = rocke_binary_search_seq_idx_dyn( b, ctx->cu_q, ctx->q_block_global_idx, ctx->num_seqs_p, BLOCK_Q, trip, false); + ctx->cu_q_start = rocke_b_global_load_i32(b, ctx->cu_q, ctx->seq_idx, 0); + ctx->cu_q_stop = rocke_b_global_load_i32( + b, ctx->cu_q, rocke_b_add(b, ctx->seq_idx, rocke_b_const_i32(b, 1)), 0); + ctx->cur_batch_q_len = rocke_b_sub(b, ctx->cu_q_stop, ctx->cu_q_start); + ctx->q_block_start_idx = rocke_b_add( + b, rocke_b_div(b, ctx->cu_q_start, rocke_b_const_i32(b, BLOCK_Q)), ctx->seq_idx); + ctx->q_block_local_idx = rocke_b_sub(b, ctx->q_block_global_idx, ctx->q_block_start_idx); + ctx->seq_len = rocke_b_global_load_i32(b, ctx->seq_lens, ctx->seq_idx, 0); + ctx->context_len = rocke_b_sub(b, ctx->seq_len, ctx->cur_batch_q_len); } - ctx->cu_q_start = rocke_b_global_load_i32(b, ctx->cu_q, ctx->seq_idx, 0); - ctx->cu_q_stop = rocke_b_global_load_i32( - b, ctx->cu_q, rocke_b_add(b, ctx->seq_idx, rocke_b_const_i32(b, 1)), 0); - ctx->cur_batch_q_len = rocke_b_sub(b, ctx->cu_q_stop, ctx->cu_q_start); - ctx->q_block_start_idx = rocke_b_add( - b, rocke_b_div(b, ctx->cu_q_start, rocke_b_const_i32(b, BLOCK_Q)), ctx->seq_idx); - ctx->q_block_local_idx = rocke_b_sub(b, ctx->q_block_global_idx, ctx->q_block_start_idx); - ctx->seq_len = rocke_b_global_load_i32(b, ctx->seq_lens, ctx->seq_idx, 0); - ctx->context_len = rocke_b_sub(b, ctx->seq_len, ctx->cur_batch_q_len); ctx->qb_start_pos = rocke_b_mul(b, ctx->q_block_local_idx, rocke_b_const_i32(b, BLOCK_Q)); + if(ctx->RTL) + { + /* Inside the grid-stride loop a q-block past the owned rows skips its + * body instead of returning; closed after the epilogue. */ + rocke_value_t* has_rows = rocke_b_cmp_lt(b, ctx->qb_start_pos, ctx->rtl_q_rows); + ctx->rtl_live_block = rocke_b_scf_if(b, has_rows); + rocke_b_region_enter(b, ctx->rtl_live_block.then_region); + } + else { rocke_if_t f = rocke_b_scf_if(b, rocke_b_cmp_ge(b, ctx->qb_start_pos, ctx->cur_batch_q_len)); @@ -1155,6 +1283,7 @@ static rocke_status_t rocke_g950_attn2d_kernel_name(const rocke_attention_tiled_ s->use_register_pv ? "regpv" : "", s->use_qblock_reverse ? "qrev" : "", s->emit_lse ? (s->lse_head_major ? "lsehm" : "lse") : "", + s->runtime_layout ? "rtl" : "", }; size_t num_parts = sizeof(parts) / sizeof(parts[0]); return rocke_kernel_name_join( diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_q_load_gather.cpp b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_q_load_gather.cpp index ae3d0609cf0f..5c326c9e94f2 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_q_load_gather.cpp +++ b/dnn-providers/hip-kernel-provider/rocke/platform/cpp/instances/gfx950/attention_tiled_2d_q_load_gather.cpp @@ -83,6 +83,17 @@ static rocke_value_t* sc_rcp_ln2(rocke_gfx950_attn2d_build_ctx_t* ctx) return rocke_b_const_f32(B, 1.4426950408889634); } +/* Python ``_sink_logit``: query head qh's sink logit in f32 (runtime-layout + * kernels pick the fp32 or Q-dtype sink form from sink_is_f32). */ +static rocke_value_t* rocke_g950_sink_logit(rocke_gfx950_attn2d_build_ctx_t* ctx, + rocke_value_t* qh, + rocke_value_t* qh_in) +{ + if(!ctx->RTL) + return rocke_b_cast_to_f32(B, rocke_b_global_load(B, ctx->sinks, qh, ctx->dtype, 2)); + return rocke_attn2d_rtl_sink_logit(B, ctx->rtl_p, ctx->sinks, qh, qh_in, ctx->dtype); +} + /* ============================================================ * * Q -> LDS cooperative stage (Python lines 1151-1215). * ============================================================ */ @@ -185,8 +196,18 @@ void rocke_gfx950_attn2d_emit_q_load(rocke_gfx950_attn2d_build_ctx_t* ctx) q_pos_safe = rocke_b_select(b, qmask_t, q_pos_t, rocke_b_const_i32(b, 0)); qh_safe = rocke_b_select(b, qmask_t, qh_t, rocke_b_const_i32(b, 0)); - /* q_off_base, _ = q_desc.offset(b, token=cu_q_start+q_pos_safe, - * head=qh_safe, dim=0) */ + /* q_off_base = _q_row_off(q_pos_safe, qh_safe): + * q_desc.offset(token=cu_q_start+q_pos_safe, head=qh_safe, dim=0), or in + * runtime_layout pos*q_tok_stride + head*q_head_stride from rtl_q_ptr. */ + if(ctx->RTL) + { + rocke_value_t* pos_off + = rocke_b_mul(b, q_pos_safe, ctx->rtl_p[ROCKE_ATTN2D_RTL_Q_TOK_STRIDE]); + rocke_value_t* head_off + = rocke_b_mul(b, qh_safe, ctx->rtl_p[ROCKE_ATTN2D_RTL_Q_HEAD_STRIDE]); + q_off_base = rocke_b_add(b, pos_off, head_off); + } + else { static const char* const in_names[3] = {"token", "head", "dim"}; rocke_value_t* in_values[3]; @@ -197,8 +218,13 @@ void rocke_gfx950_attn2d_emit_q_load(rocke_gfx950_attn2d_build_ctx_t* ctx) b, ctx->q_desc, in_names, in_values, 3, &q_off_base, NULL); } - /* v8 = b.global_load_vN(query, q_off_base + Q_col, dtype, 8, align=16) */ - v8 = rocke_b_global_load_vN(b, ctx->query, rocke_b_add(b, q_off_base, Q_col), dtype, 8, 16); + /* v8 = b.global_load_vN(q_base_ptr, q_off_base + Q_col, dtype, 8, align=16) */ + v8 = rocke_b_global_load_vN(b, + ctx->RTL ? ctx->rtl_q_ptr : ctx->query, + rocke_b_add(b, q_off_base, Q_col), + dtype, + 8, + 16); /* Q store index: K_lds-aliased (buf,row_in_buf,col) or plain (row,col). */ if(ctx->Q_ALIAS_K) @@ -264,9 +290,17 @@ void rocke_gfx950_attn2d_emit_loop_bounds_and_inits(rocke_gfx950_attn2d_build_ct * const) emitted before the outer divisor const, matching Python. */ rocke_value_t* nt_inner = rocke_b_add(B, max_seq_prefix_len, rocke_b_const_i32(B, T - 1)); rocke_value_t* num_tiles = rocke_b_div(B, nt_inner, rocke_b_const_i32(B, T)); + if(ctx->RTL) + { + /* A q-block of padding rows only reads no key: its rows store zeros. */ + rocke_value_t* has_live = rocke_b_cmp_lt(B, ctx->qb_start_pos, ctx->cur_batch_q_len); + rocke_value_t* c0 = rocke_b_const_i32(B, 0); + num_tiles = rocke_b_select(B, has_live, num_tiles, c0); + } - /* tile_start / tile_end (1226-1244). */ - if(SLIDING_WINDOW > 0) + /* tile_start / tile_end (1226-1244). SW_ACTIVE: a compile-time window, or + * always in runtime_layout mode (window kernel argument). */ + if(SLIDING_WINDOW > 0 || ctx->RTL) { /* Reuse the cached sw_const (line 1244 in the prologue), do NOT create a * fresh const here -- Python references the same SSA value. */ @@ -333,8 +367,8 @@ void rocke_gfx950_attn2d_emit_loop_bounds_and_inits(rocke_gfx950_attn2d_build_ct rocke_value_t* qh_mod = rocke_b_mod(B, row, rocke_b_const_i32(B, NQK)); rocke_value_t* qh = rocke_b_add(B, qh_mul, qh_mod); rocke_value_t* qh_in = rocke_b_cmp_lt(B, qh, ctx->num_qh_p); - rocke_value_t* sink_h = rocke_b_global_load(B, ctx->sinks, qh, ctx->dtype, 2); - rocke_value_t* sink_f = rocke_b_fmul(B, rocke_b_cast_to_f32(B, sink_h), rcp_ln2); + rocke_value_t* sink_l = rocke_g950_sink_logit(ctx, qh, qh_in); + rocke_value_t* sink_f = rocke_b_fmul(B, sink_l, rcp_ln2); m_inits[0] = rocke_b_select(B, qh_in, sink_f, neg_inf); } else @@ -348,8 +382,8 @@ void rocke_gfx950_attn2d_emit_loop_bounds_and_inits(rocke_gfx950_attn2d_build_ct rocke_value_t* qh_mod = rocke_b_mod(B, row, rocke_b_const_i32(B, NQK)); rocke_value_t* qh = rocke_b_add(B, qh_mul, qh_mod); rocke_value_t* qh_in = rocke_b_cmp_lt(B, qh, ctx->num_qh_p); - rocke_value_t* sink_h = rocke_b_global_load(B, ctx->sinks, qh, ctx->dtype, 2); - rocke_value_t* sink_f = rocke_b_fmul(B, rocke_b_cast_to_f32(B, sink_h), rcp_ln2); + rocke_value_t* sink_l = rocke_g950_sink_logit(ctx, qh, qh_in); + rocke_value_t* sink_f = rocke_b_fmul(B, sink_l, rcp_ln2); m_inits[r] = rocke_b_select(B, qh_in, sink_f, neg_inf); } } diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/dsl_docs/instances/attention.md b/dnn-providers/hip-kernel-provider/rocke/platform/dsl_docs/instances/attention.md index 84d176bdeff0..e27f071bbc12 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/dsl_docs/instances/attention.md +++ b/dnn-providers/hip-kernel-provider/rocke/platform/dsl_docs/instances/attention.md @@ -427,6 +427,42 @@ Detailed flow: Tiled 2D is useful for chunked prefill, sliding-window rows, and moderate contexts. It can under-occupy for long single-token decode compared with split-KV 3D. +### Runtime layout (`runtime_layout=True`, gfx942 and gfx950) + +A tiled 2D spec with `runtime_layout=True` builds one object that serves any +dense or ragged Q over a paged K/V cache. The layout is read from kernargs +appended after the fixed ones (`RUNTIME_LAYOUT_EXTRA_ARGS` in each arch's +`attention_tiled_2d.py`): the Q/O/KV element strides, a separate V block table, +`seq_lens_q`, the dense row count `q_uniform_len` (0 for a ragged Q), the +q-block grid size, `sink_is_f32` (whether `sink_ptr` holds fp32 or Q-dtype sink +logits), and two bounds on device-read values: `num_kv_blocks` (a page id outside +`[0, num_kv_blocks)` reads as a masked page) and `block_table_width` (a length is +capped at `block_table_width * block_size`, the table row's width). Head counts and the sliding window are runtime kernargs as +in the fixed-layout kernel. hip-kernel-provider's `hipkernel:AttentionPagedUnified` +engine is the consumer. + +- fp16/bf16, head size 64/128/256, paged block 16/32/64, 1-16 query heads per + KV head. +- Only the default 16x16 pipeline: softcap, ALiBi, QQ bias, fp8 KV, LSE output + and the 32x32/transposed/fast-KV variants are refused at spec construction + (`_runtime_layout_reject_reason`, mirrored in C++). +- gfx942 may split a block into 16-row multiples (`tile_size`); gfx950 uses one + block per KV tile. `runtime_layout_catalog_spec` picks the geometry. +- A ragged Q needs non-decreasing offsets with + `off[b+1] - off[b] >= seq_lens_q[b]`, and `off[B]` the end of the last block. +- On gfx942, `supports_tiled_2d_spec` and both builders charge + `runtime_layout_lds_bytes` against `ArchTarget.lds_capacity_bytes`. On gfx950 + no gate models the runtime_layout LDS pool: the catalog geometry (at most four + warps) fits, but a hand-built spec past it, such as head size 256 with eight + warps and block 32 or 64, needs more than the 160 KiB the arch holds and is + refused only when clang compiles it. + +Byte identity is checked by the parity emitters +(`library/tests/parity/gfx94{2,50}_attention_tiled_2d_emit.*`), and +representative objects are pinned in +`platform/tests/golden/rocke_representative_ir_sha256/attention.json` +(`attention/gfx9{42,50}/2d_rtl_*`). + ## Tiled 3D Split-KV Kernel Files: diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/python/rocke/instances/SUPPORT_MATRIX.md b/dnn-providers/hip-kernel-provider/rocke/platform/python/rocke/instances/SUPPORT_MATRIX.md index 5f98bd8eb99d..b2e9d6f5783b 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/python/rocke/instances/SUPPORT_MATRIX.md +++ b/dnn-providers/hip-kernel-provider/rocke/platform/python/rocke/instances/SUPPORT_MATRIX.md @@ -160,6 +160,7 @@ be smaller than 2 GiB. | `unified_attention_reduce` | ✅ | ✅ | ✅ | scalar | | `attention_dense` | ✅ | ✅ | ❌ | dense (non-paged) flash prefill, separate per-arch bodies; bf16/fp16 D64/D128. gfx950 grid body also takes fp8 e4m3 (OCP) K/V with per-tensor scales (aligned contiguous KV, no sinks). Lives in `library/kernels/{gfx942,gfx950}/attention_dense.py` | | tiled 3D `kv_layout="strided"` | ✅ | ✅ | ❌ | non-paged Sq=1, fp16/bf16 D64/128/256, aligned unit-D KV views; existing tiled segment/reduce pipeline | +| tiled 2D `runtime_layout=True` | ✅ | ✅ | ❌ | fp16/bf16 D64/128/256, paged block 16/32/64, 1-16 query heads per KV head, default 16x16 pipeline only (no softcap, ALiBi, QQ bias, fp8 KV or LSE). One object serves a dense or ragged Q and paged K/V: strides, separate K/V block tables, `seq_len_q`, the window and Q-dtype or fp32 sinks are kernargs. Specs over the `ArchTarget` LDS budget are refused (on gfx942 by the support gate and both builders). GPU-numeric-verified on both arches (`test_gfx942_attention_runtime_layout.py`, `test_attention_tiled_2d_runtime_layout_gfx950.py`) | | `mla_prefill_fwd` | ✅ | ❌ | ❌ | bf16 only; paged compressed KV, `W_UK` absorbed into the query and `W_UV` applied in the epilogue (the latent KV is never expanded). Takes an already projected, RoPE-rotated query. Lives in `library/kernels/mla/`, dispatched by the separate `dispatch.mla` registry (not `dispatch.attention`). gfx950 is a later phase. | --- diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/python/rocke/portable_ir/src/abi.py b/dnn-providers/hip-kernel-provider/rocke/platform/python/rocke/portable_ir/src/abi.py index f3db50da2b78..7f79d41cbd16 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/python/rocke/portable_ir/src/abi.py +++ b/dnn-providers/hip-kernel-provider/rocke/platform/python/rocke/portable_ir/src/abi.py @@ -81,7 +81,7 @@ #: is checked at library load: ctypes argtypes are a hand-written mirror of the C #: signatures, and calling a mismatched library with them is memory-unsafe rather #: than merely wrong. -BINARY_ABI = 20 +BINARY_ABI = 21 class AbiError(RuntimeError): diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/tests/golden/rocke_representative_ir_sha256/attention.json b/dnn-providers/hip-kernel-provider/rocke/platform/tests/golden/rocke_representative_ir_sha256/attention.json index 65e2fb652e1b..e82fcfbb304d 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/tests/golden/rocke_representative_ir_sha256/attention.json +++ b/dnn-providers/hip-kernel-provider/rocke/platform/tests/golden/rocke_representative_ir_sha256/attention.json @@ -51,6 +51,30 @@ "sha256": "27c4214a59e53bcfcc30a9f02c1a20727c449ab2ece75c3f32b8a931f6518551", "status": "ok" }, + "attention/gfx942/2d_rtl_bf16_d128_b16": { + "arch": "gfx942", + "bytes": 106654, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_bf16_w4_rtl", + "sha256": "ddba7a92486ff7641f2a6702170b3b7f7727f38ffbab7842e468e8ddeb00f23f", + "status": "ok" + }, + "attention/gfx942/2d_rtl_sinks_bf16_d256_b64_w2": { + "arch": "gfx942", + "bytes": 206920, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d256_b64_t16_g8_bf16_sinks_w2_rtl", + "sha256": "14eb699157c9d7e099aa9f5b44b85bd87dee6770ba51c2b125b633be70e59178", + "status": "ok" + }, + "attention/gfx942/2d_rtl_sinks_fp16_d128_b16": { + "arch": "gfx942", + "bytes": 109647, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_fp16_sinks_w4_rtl", + "sha256": "c7b8ac55fc17c6b0dcae418605f3e103bc6ece2a8ac5f017e959633d4cdbd8bb", + "status": "ok" + }, "attention/gfx942/3d_bf16_d128_b64": { "arch": "gfx942", "bytes": 358681, @@ -243,6 +267,30 @@ "sha256": "38b1d7f491d94811aaa3896b9f9af52514ca18b0ea5f0e44907bfeb9f8eaaf21", "status": "ok" }, + "attention/gfx950/2d_rtl_bf16_d128_b16": { + "arch": "gfx950", + "bytes": 82130, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_bf16_w4_rtl", + "sha256": "6c6a2e94819e7165956dec4bf2e69ab33133b46f9c41624eef43cb7bc02f8f38", + "status": "ok" + }, + "attention/gfx950/2d_rtl_sinks_bf16_d256_b64": { + "arch": "gfx950", + "bytes": 240446, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d256_b64_g8_bf16_sinks_w4_rtl", + "sha256": "b911fb8d8dc9b7f284385bf4c77b4b7c69a22100bd0a6010f7c22368946bda8c", + "status": "ok" + }, + "attention/gfx950/2d_rtl_sinks_fp16_d128_b16": { + "arch": "gfx950", + "bytes": 86679, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_fp16_sinks_w4_rtl", + "sha256": "681acb39ad635ecff6ef213735d950230e498f4e28bab8bc677f21bffc707c39", + "status": "ok" + }, "attention/gfx950/3d_bf16_d128_b64": { "arch": "gfx950", "bytes": 163351, @@ -432,6 +480,30 @@ "sha256": "a9dbaec67c78fcb6c6c76534dc8b04ac846f42b208ab11c310fd3ec4bb058151", "status": "ok" }, + "attention/gfx942/2d_rtl_bf16_d128_b16": { + "arch": "gfx942", + "bytes": 106976, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_bf16_w4_rtl", + "sha256": "0ebcbd3257a688137007a94ea3a284ef022ede96f42618dc7459f9b4a2069bab", + "status": "ok" + }, + "attention/gfx942/2d_rtl_sinks_bf16_d256_b64_w2": { + "arch": "gfx942", + "bytes": 207231, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d256_b64_t16_g8_bf16_sinks_w2_rtl", + "sha256": "dffee890474a7723370ca0ec982aab92bdc134004d26ea75f70b3384cf9cbb6f", + "status": "ok" + }, + "attention/gfx942/2d_rtl_sinks_fp16_d128_b16": { + "arch": "gfx942", + "bytes": 109989, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_fp16_sinks_w4_rtl", + "sha256": "33b9c25e2566c1da5608889822386427cfc1e8d0e6cebdb168505bbb8cacca13", + "status": "ok" + }, "attention/gfx942/3d_bf16_d128_b64": { "arch": "gfx942", "bytes": 358781, @@ -624,6 +696,30 @@ "sha256": "93bd2edc732ca53cd5e117784d69a00f546afde218e90ebfa4ea10d620cb33ba", "status": "ok" }, + "attention/gfx950/2d_rtl_bf16_d128_b16": { + "arch": "gfx950", + "bytes": 82355, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_bf16_w4_rtl", + "sha256": "de95fe108e0b4b8ef4f0c06f752186ab1c5531670f6098b0dfa341a857532bf1", + "status": "ok" + }, + "attention/gfx950/2d_rtl_sinks_bf16_d256_b64": { + "arch": "gfx950", + "bytes": 240671, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d256_b64_g8_bf16_sinks_w4_rtl", + "sha256": "0f76a48d69f33bb681369b4f87853b08047308b1c55bd6319c39b381c2d05c04", + "status": "ok" + }, + "attention/gfx950/2d_rtl_sinks_fp16_d128_b16": { + "arch": "gfx950", + "bytes": 86904, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_fp16_sinks_w4_rtl", + "sha256": "b8cd20eaad3c3b9c375f02e8e6fdf070bd0ebed3443ae0bc6b7ba85ef757eb1c", + "status": "ok" + }, "attention/gfx950/3d_bf16_d128_b64": { "arch": "gfx950", "bytes": 163447, @@ -813,6 +909,30 @@ "sha256": "3ac893853f42bfd8d5e49b6a101a80e0ac5b180dfff3684dace64cd2b3bd04f7", "status": "ok" }, + "attention/gfx942/2d_rtl_bf16_d128_b16": { + "arch": "gfx942", + "bytes": 107040, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_bf16_w4_rtl", + "sha256": "8b7f4bb5f824e6fad3e70bc21d6ef1c5ae13b9fbe1b7cdc767246f68d9a662a2", + "status": "ok" + }, + "attention/gfx942/2d_rtl_sinks_bf16_d256_b64_w2": { + "arch": "gfx942", + "bytes": 207295, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d256_b64_t16_g8_bf16_sinks_w2_rtl", + "sha256": "0dc3571efb93816449957df9154ef3d6bdc68dd3b182ed78559d426b7c38d0a2", + "status": "ok" + }, + "attention/gfx942/2d_rtl_sinks_fp16_d128_b16": { + "arch": "gfx942", + "bytes": 110053, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_fp16_sinks_w4_rtl", + "sha256": "df705bab630caf36bed01a78e215555bad1171bd2bb63378a96627e040e87872", + "status": "ok" + }, "attention/gfx942/3d_bf16_d128_b64": { "arch": "gfx942", "bytes": 358845, @@ -1005,6 +1125,30 @@ "sha256": "364a9ed632be83a20cff8147f4cc1e66ead3ad5f5f0da3ab171dd8adbcacce8a", "status": "ok" }, + "attention/gfx950/2d_rtl_bf16_d128_b16": { + "arch": "gfx950", + "bytes": 82419, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_bf16_w4_rtl", + "sha256": "969e3f1ca771532273dc64125eeee6fcc1f459477c57e1a828bf688151b9eaa9", + "status": "ok" + }, + "attention/gfx950/2d_rtl_sinks_bf16_d256_b64": { + "arch": "gfx950", + "bytes": 240735, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d256_b64_g8_bf16_sinks_w4_rtl", + "sha256": "6edc45954a21466dddb772c5f6f347b36ca01047d998a3edf0fb6e74842e70a5", + "status": "ok" + }, + "attention/gfx950/2d_rtl_sinks_fp16_d128_b16": { + "arch": "gfx950", + "bytes": 86968, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_fp16_sinks_w4_rtl", + "sha256": "e60e865ae109de88601ec3dd0fa1cbbedf342119f571c389911a8d89d3c80f78", + "status": "ok" + }, "attention/gfx950/3d_bf16_d128_b64": { "arch": "gfx950", "bytes": 163511, @@ -1194,6 +1338,30 @@ "sha256": "3ac893853f42bfd8d5e49b6a101a80e0ac5b180dfff3684dace64cd2b3bd04f7", "status": "ok" }, + "attention/gfx942/2d_rtl_bf16_d128_b16": { + "arch": "gfx942", + "bytes": 107040, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_bf16_w4_rtl", + "sha256": "8b7f4bb5f824e6fad3e70bc21d6ef1c5ae13b9fbe1b7cdc767246f68d9a662a2", + "status": "ok" + }, + "attention/gfx942/2d_rtl_sinks_bf16_d256_b64_w2": { + "arch": "gfx942", + "bytes": 207295, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d256_b64_t16_g8_bf16_sinks_w2_rtl", + "sha256": "0dc3571efb93816449957df9154ef3d6bdc68dd3b182ed78559d426b7c38d0a2", + "status": "ok" + }, + "attention/gfx942/2d_rtl_sinks_fp16_d128_b16": { + "arch": "gfx942", + "bytes": 110053, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_fp16_sinks_w4_rtl", + "sha256": "df705bab630caf36bed01a78e215555bad1171bd2bb63378a96627e040e87872", + "status": "ok" + }, "attention/gfx942/3d_bf16_d128_b64": { "arch": "gfx942", "bytes": 358845, @@ -1386,6 +1554,30 @@ "sha256": "364a9ed632be83a20cff8147f4cc1e66ead3ad5f5f0da3ab171dd8adbcacce8a", "status": "ok" }, + "attention/gfx950/2d_rtl_bf16_d128_b16": { + "arch": "gfx950", + "bytes": 82419, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_bf16_w4_rtl", + "sha256": "969e3f1ca771532273dc64125eeee6fcc1f459477c57e1a828bf688151b9eaa9", + "status": "ok" + }, + "attention/gfx950/2d_rtl_sinks_bf16_d256_b64": { + "arch": "gfx950", + "bytes": 240735, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d256_b64_g8_bf16_sinks_w4_rtl", + "sha256": "6edc45954a21466dddb772c5f6f347b36ca01047d998a3edf0fb6e74842e70a5", + "status": "ok" + }, + "attention/gfx950/2d_rtl_sinks_fp16_d128_b16": { + "arch": "gfx950", + "bytes": 86968, + "family": "attention", + "kernel_name": "rocke_uattn2d_tiled_d128_b16_g8_fp16_sinks_w4_rtl", + "sha256": "e60e865ae109de88601ec3dd0fa1cbbedf342119f571c389911a8d89d3c80f78", + "status": "ok" + }, "attention/gfx950/3d_bf16_d128_b64": { "arch": "gfx950", "bytes": 163511, diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/tests/instances/rocke_ir_parity_harness.py b/dnn-providers/hip-kernel-provider/rocke/platform/tests/instances/rocke_ir_parity_harness.py index c98edb5c48eb..658beb8505d8 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/tests/instances/rocke_ir_parity_harness.py +++ b/dnn-providers/hip-kernel-provider/rocke/platform/tests/instances/rocke_ir_parity_harness.py @@ -1477,6 +1477,34 @@ def add(family, case_id, arch, build): **_branch_kw, ), ) + # runtime_layout tiled 2D (the hipkernel:AttentionPagedUnified objects). + # Dense or ragged Q and Q-dtype or fp32 sinks are kernargs, so one object + # per case covers both layouts and both sink forms. + for _case, _kw in ( + ("2d_rtl_bf16_d128_b16", dict(head_size=128, block_size=16, dtype="bf16")), + ( + "2d_rtl_sinks_fp16_d128_b16", + dict(head_size=128, block_size=16, dtype="fp16", use_sinks=True), + ), + ( + "2d_rtl_sinks_bf16_d256_b64", + dict(head_size=256, block_size=64, dtype="bf16", use_sinks=True), + ), + ): + add( + "attention", + f"attention/gfx950/{_case}", + "gfx950", + build_attention_2d( + f"irhash_attn_950_{_case}", + "gfx950", + num_query_heads=8, + num_kv_heads=1, + num_warps=4, + runtime_layout=True, + **_kw, + ), + ) add( "attention", "attention/gfx942/2d_fp16_d128_b64", @@ -1557,6 +1585,43 @@ def add(family, case_id, arch, build): **_branch_kw, ), ) + # runtime_layout tiled 2D, as on gfx950; d256 runs the 2-warp body. + for _case, _kw in ( + ( + "2d_rtl_bf16_d128_b16", + dict(head_size=128, block_size=16, dtype="bf16", num_warps=4), + ), + ( + "2d_rtl_sinks_fp16_d128_b16", + dict( + head_size=128, block_size=16, dtype="fp16", num_warps=4, use_sinks=True + ), + ), + ( + "2d_rtl_sinks_bf16_d256_b64_w2", + dict( + head_size=256, + block_size=64, + dtype="bf16", + num_warps=2, + tile_size=16, + use_sinks=True, + ), + ), + ): + add( + "attention", + f"attention/gfx942/{_case}", + "gfx942", + build_attention_2d( + f"irhash_attn_942_{_case}", + "gfx942", + num_query_heads=8, + num_kv_heads=1, + runtime_layout=True, + **_kw, + ), + ) add( "attention", "attention/gfx942/3d_fp16_d128_b64", diff --git a/dnn-providers/hip-kernel-provider/src/CMakeLists.txt b/dnn-providers/hip-kernel-provider/src/CMakeLists.txt index 91213a7278d4..4b03ca810188 100644 --- a/dnn-providers/hip-kernel-provider/src/CMakeLists.txt +++ b/dnn-providers/hip-kernel-provider/src/CMakeLists.txt @@ -179,7 +179,7 @@ if(HIPKERNELPROVIDER_ENABLE_TESTS) # Bundle filters for the attention engines' external integration checks below and # their GPU-reference targets in integration_tests/. Under YAML categorization the # checks' CTest suites select from each engine's - # ../hipkernel_Gfx9*Attention*_test_categories_integration.yaml instead, and + # ../hipkernel_*Attention*_test_categories_integration.yaml instead, and # ../descriptor-packaging/tests/test_attention_bundle_filters.py fails on a mismatch. string(JOIN ":" HKP_SDPA_FWD_DEFAULT_GTEST_FILTER "quick_SdpaFwd_Default.*" "standard_SdpaFwd_Default.*" @@ -188,6 +188,11 @@ if(HIPKERNELPROVIDER_ENABLE_TESTS) # output Gfx942AttentionDense serves. set(HKP_GFX942_ATTENTION_DENSE_GTEST_FILTER "${HKP_SDPA_FWD_DEFAULT_GTEST_FILTER}:*_SdpaFwd_bshd_*_stats_*") + # Every SdpaFwd bundle: AttentionPagedUnified's support claims pick the paged bundles + # it must pass, and it declines (skips) the rest. + string(JOIN ":" HKP_SDPA_FWD_ALL_GTEST_FILTER + "quick_SdpaFwd_*.*" "standard_SdpaFwd_*.*" + "comprehensive_SdpaFwd_*.*" "full_SdpaFwd_*.*") # Plus the BSHD stats bundles the gfx950 unified engines' LSE-on twins serve. The # gfx950 rows share one categories YAML, so they share this filter. set(HKP_GFX950_ATTENTION_GTEST_FILTER @@ -198,6 +203,8 @@ if(HIPKERNELPROVIDER_ENABLE_TESTS) # engine: , then its # TOML under ../config/ and its categories YAML variable from ../CMakeLists.txt. # test_attention_bundle_filters.py reads the rows to pair each filter with its YAML. + # An engine that ships for several architectures takes one row per architecture, each + # TOML skipping the others so a package carrying several shards runs its bundles once. set(HKP_PINNED_ATTENTION_ENGINES gfx950 dense Gfx950AttentionDense HKP_GFX950_ATTENTION_GTEST_FILTER hipkernel_Gfx950Attention.toml @@ -217,6 +224,12 @@ if(HIPKERNELPROVIDER_ENABLE_TESTS) gfx942 dense Gfx942AttentionDense HKP_GFX942_ATTENTION_DENSE_GTEST_FILTER hipkernel_Gfx942AttentionDense.toml HIPKERNELPROVIDER_GFX942_ATTENTION_DENSE_INTEGRATION_CATEGORIES_YAML + gfx942 paged_unified AttentionPagedUnified HKP_SDPA_FWD_ALL_GTEST_FILTER + hipkernel_AttentionPagedUnified_gfx942.toml + HIPKERNELPROVIDER_ATTENTION_PAGED_UNIFIED_INTEGRATION_CATEGORIES_YAML + gfx950 paged_unified AttentionPagedUnified HKP_SDPA_FWD_ALL_GTEST_FILTER + hipkernel_AttentionPagedUnified_gfx950.toml + HIPKERNELPROVIDER_ATTENTION_PAGED_UNIFIED_INTEGRATION_CATEGORIES_YAML ) add_subdirectory(tests) diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/CMakeLists.txt b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/CMakeLists.txt index 9c002f74758e..eff66817819e 100644 --- a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/CMakeLists.txt +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/CMakeLists.txt @@ -30,6 +30,7 @@ target_sources(hip_kernel_provider_impl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/packs/Gfx942AttentionDenseNative.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/Gfx1151WmmaAttentionNative.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/ConvDgradAotNative.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/packs/AttentionPagedUnifiedNative.cpp ${CMAKE_CURRENT_SOURCE_DIR}/serialization/IngestorPlanHeader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/serialization/IngestorPlanCodec.cpp ) diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/IngestorPacks.cpp b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/IngestorPacks.cpp index e09d0c5ea446..065dfba4aeeb 100644 --- a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/IngestorPacks.cpp +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/IngestorPacks.cpp @@ -83,6 +83,9 @@ const std::vector& ingestorPacks() {"hipkernel:Gfx950ConvDgradAot", ®isterGfx950ConvDgradAotSymbols, &resetGfx950ConvDgradAotModuleCache}, + {ATTENTION_PAGED_UNIFIED_ENGINE_NAME, + ®isterAttentionPagedUnifiedSymbols, + &resetAttentionPagedUnifiedModuleCache}, {"hipkernel:Gfx1250ConvDgradAot", ®isterGfx1250ConvDgradAotSymbols, &resetGfx1250ConvDgradAotModuleCache}, diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/IngestorPacks.hpp b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/IngestorPacks.hpp index d0c6865f7761..13cd7aef67a1 100644 --- a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/IngestorPacks.hpp +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/IngestorPacks.hpp @@ -304,6 +304,15 @@ void setConvDgradAotBatchChunkByteLimitForTesting(int64_t limit); /// process, one per batch slice: how a test sees that a plan ran sliced. FOR TESTS ONLY. int64_t convDgradAotImplicitLaunchCountForTesting(); +/// The engine name attention_paged_unified.ued.json declares; read by the pack table, the +/// pack's decline log lines and its descriptor census. +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_ENGINE_NAME + = "hipkernel:AttentionPagedUnified"; + +/// @see packs/AttentionPagedUnifiedNative.cpp +void registerAttentionPagedUnifiedSymbols(hipdnn_plugin_sdk::ingestor::SymbolScope& scope); +void resetAttentionPagedUnifiedModuleCache(); + /// Drops every pack's cached kpack modules and closes every kpack archive /// SharedKpackArchives retains, so the next dispatch re-reads its archive from disk. Leases /// stay held: the archive that next dispatch opens is retained again. diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/README.md b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/README.md new file mode 100644 index 000000000000..525decbcd6d2 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/README.md @@ -0,0 +1,186 @@ +# hipkernel:AttentionPagedUnified + +Paged (and ragged-query) SDPA forward for gfx942 and gfx950, served by rocKE's tiled 2D +unified-attention kernels (`rocke/library/kernels/{gfx942,gfx950}/attention_tiled_2d.py`, +`build_unified_attention_2d_tiled`) built with `runtime_layout=True`. The catalog source +of truth is `projects/hipdnn/tools/IngestorGenerator/configs/attention_paged_unified.yaml`; +the native half is `packs/AttentionPagedUnifiedNative.cpp`. + +## Graphs served + +cuDNN paged-attention semantics (`projects/hipdnn/docs/SdpaSemanticsRegister.md`, SEM-008 +padding, SEM-009 paged K/V, SEM-010 empty rows), one SDPA-forward node, compute type FLOAT: + +| Operand | Logical dims | Rules | +|---|---|---| +| Q, O | `[B, Hq, Sq, D]` | FP16 or BF16 (all four operands alike); dense with arbitrary strides, or both ragged through the same INT32 `[B+1,1,1,1]` `ragged_offset` (token units times each tensor's `ragged_offset_multiplier`) | +| K, V | `[num_blocks, Hkv, block_size, D]` | paged containers with equal, arbitrary strides (the interleaved K\|V views of one cache allocation included), a unit D stride, and one block size | +| page tables | `[B, 1, M, 1]` INT32 | `page_table_k` and `page_table_v`: one tensor for both, or two tensors with the same `M` and batch stride; unit stride along M; not packed | +| `seq_len_q`, `seq_len_kv` | `[B,1,1,1]` INT32 | both required, as for every paged graph | +| `max_seq_len_kv` | | set or unset; unset is inferred as `M * block_size` | +| `sink_token` | `[1, Hq, 1, 1]` | optional; FLOAT (cuDNN's form) or the Q/K/V/O data type, with a unit head stride (see [Attention sinks](#attention-sinks)) | + +- Head size 64, 128 or 256; block size 16, 32 or 64; `Hq / Hkv` in {1, 2, 4, 5, 6, 7, 8, 16}. +- Masking: bottom-right causal (`right_bound` 0), optionally with a `left_bound` L, which + keeps the L keys ending at the diagonal as in cuDNN: key k is visible to diagonal d iff + `d - L < k <= d`, with `d = row + seq_len_kv - seq_len_q`. A vLLM sliding window W is + `left_bound = W`. The kernel's `sliding_window` argument is L. +- Strides of non-unit axes and both buffer bases must keep 16-byte alignment. + +A dense Q's rows past `seq_len_q[b]` (up to `Sq`) are padding and get O = 0. A ragged Q +writes only its live rows, the first `seq_len_q[b]` rows from its origin: rows of the offset +block past them belong to no sequence (RFC 0014), so the kernel leaves them untouched and +never writes past the last live row. A live row with no visible key, including every row +of a sequence with `seq_len_kv == 0`, also gets O = 0, with or without a sink. The kernel never +loads K/V past `seq_len_kv` nor page-table entries past `ceil(seq_len_kv / block_size)`, so +unused entries may hold anything (`-1`, a null block). K pages through `page_table_k` and V +through `page_table_v`, so with two tables V may sit in other blocks than K. + +The engine does not clamp `seq_len_kv`: `0 <= seq_len_kv[b] <= max_seq_len_kv <= M * +block_size` is a precondition (with `max_seq_len_kv` unset, `M * block_size`), and a length +past it reads page-table entries past row `b`. + +A ragged Q needs vLLM's `query_start_loc` layout: non-decreasing origins with +`ragged_offset[b+1] - ragged_offset[b] >= seq_len_q[b]` and `ragged_offset[B]` the end of +the last block. The first origin need not be 0. The kernel finds each query block's +sequence by a binary search over the offsets and sizes its grid from `ragged_offset[B]`. +RFC 0014 also allows origins in any order and an unused `ragged_offset[B]` when +`seq_len_q` is bound; those are valid graphs whose offset values this engine cannot see at +match time, so it cannot decline them, and its output for them is wrong. The follow-up is +a packed query-block numbering driven by `seq_len_q` (a wave prefix sum over the +sequences' block counts), which reads each sequence's own origin and does not grow the +grid for a mixed batch. + +Every other graph is declined, with the cause logged at INFO as +`hipkernel:AttentionPagedUnified declined the graph []: `. Some are valid +hipDNN graphs this kernel cannot read: + +| Cause | Graphs | +|---|---| +| `not_paged` | neither K nor V paged | +| `one_sided_paging` | only K or only V paged | +| `page_table` | K and V page tables of different widths `M` or batch strides, a packed table (with a ragged offset), a table that is not INT32 `[B, 1, M, 1]` with a unit entry stride | +| `alignment` | a declared tensor `alignment` (engine API 1.3.0) below what the kernels load: Q, K, V, O or `sink_token` not a multiple of 16 bytes (16-byte vectors), or a page table, `seq_len_q`, `seq_len_kv` or ragged offset not a multiple of 4 bytes (INT32 words) | +| `block_size` | K and V block sizes differ, or a block size outside 16/32/64 | +| `seq_len_q`, `seq_len_kv` | a missing or malformed length tensor | +| `ragged` | a ragged Q/O whose `ragged_offset_multiplier` is not its token (sequence-axis) stride, i.e. offsets stored in other units than tokens (RFC 0014 allows them; the kernel reads offsets as token counts); a ragged K or V; Q and O not ragged through one offset tensor; an offset tensor that is not INT32 `[B+1, 1, 1, 1]` | +| `mask` | no causal mask, top-left alignment, a right bound other than 0, `left_bound = 0` | +| `sinks` | a `sink_token` that is not `[1, Hq, 1, 1]`, one in a data type other than FLOAT or the Q data type, or a sink without a unit head stride | + +Other causes: `alibi_mask`, `fp8`, `stats`, `dropout`, `attn_mask`, +`scale_tensor`, `block_mask`, `implementation`, `gqa`, `head_size`, `kv_layout`, `layout`, +`size_limit`, `operand`, `node`, `compute_data_type`, `shape`, `mma_core_mode`, `scale`. + +## Execution + +Workspace is zero. `execute()` performs one kernel launch with no host synchronization +and no allocation, so after a first (warm-up) execution on a device, which loads the +module, a plan can be captured into a HIP graph and replayed with new lengths, block ids +and data (`IntegrationGpuAttentionPagedUnified.HipGraphCaptureReplaysWithChangedLengthsAndBlocks`). + +Each kernel is one object per (arch, dtype, head size, block size, GQA ratio, sinks): every +combination ships twice, as `paged_unified._d_bs_g.` and as +`..._g_sinks.` (KMD `use_sinks` 1), which the matcher selects exactly when the +graph has a `sink_token`. The grid +is `(Hkv, q_block_grid)` with `num_warps * 64` threads; query blocks are walked by a +grid-stride loop, so a ragged batch whose total token count exceeds `Sq` is still covered. +K and V are read through one 64-bit buffer resource per page; K's page ids come from +`block_tables_ptr` and V's from `block_tables_v_ptr` (the same buffer for one table), with +one `block_table_stride`. +Split-KV (3D) decode needs kernel slots and is not part of this engine. + +### Register pressure + +The `runtime_layout` kernels take the Q/O/K/V strides, the head count, the window and the +query form as kernel arguments, which the fixed-layout kernels fold into constants. Those +values live in SGPRs, and most kernels run out: the compiler spills SGPRs into VGPR lanes +(`v_writelane`/`v_readlane`), never to scratch memory. Measured on the shipped catalog +(288 kernels per architecture, `runtime_layout_catalog_spec`), against the same specs with +`runtime_layout` off and no window: + +| | gfx942 | gfx950 | +|---|---|---| +| Kernels that spill SGPRs | 264 of 288 | 232 of 288 | +| SGPRs spilled, per kernel (max) / in total | 57 / 4869 | 76 / 5596 | +| VGPR spills, scratch use | none | none | +| Lane moves added per kernel, median (max) | 30 (114) | 24 (152) | +| Lane moves as a share of the kernel's instructions, median (max) | 1.7% (7.4%) | 1.5% (6.3%) | +| Fixed-layout twins that spill | 0 of 192 that build | 4 of 288, 1 SGPR each | + +The runtime head count, window and batch arguments of the tiled 2D kernel barely move the fixed layout +(gfx942: no spills before or after; gfx950: 2 kernels spilling 6 SGPRs before, 4 spilling 4 +after), so the spills come from the runtime strides. The lane moves are a small part of +each kernel, but the lanes they hold count against VGPRs: the VGPR-limited occupancy +estimate is lower than the fixed twin's for 70 of 192 gfx942 kernels (higher for 20) and +for 209 of 288 gfx950 kernels. Removing the spills means fewer runtime arguments, and the +runtime arguments are what lets one plan serve every layout and step, so the cost is +accepted. The runtime cost has not been measured: no fixed-layout kernel serves the same +paged graph. + +## One plan for every step + +`B` in the graph is an upper bound. Batch size, lengths, offsets and block ids are read on +the device, so a plan built once serves every step of a serving loop: sequences past the +live batch carry `seq_len_q = seq_len_kv = 0` and their rows come back zero. For vLLM, bind +the cache's K and V halves as two containers over one allocation, its `block_table` as both +page tables (one tensor, `[B, 1, max_blocks, 1]`), `seq_lens` as `seq_len_kv`, the query lengths as +`seq_len_q`, and `query_start_loc` as the ragged offset of Q and O. + +### Device-read inputs are contained + +The page tables and lengths are read only on the device, so the engine cannot check their +contents at execute without a device-to-host copy, which would break HIP graph capture. +The kernels contain them instead, with the container's block count and the tables' width +passed as the `num_kv_blocks` and `block_table_width` arguments: + +- a K or V page id outside `[0, num_kv_blocks)` (negative included) reads as a masked page: + block 0 with a zero-size buffer resource, so it touches no memory and the tile contributes + zeros; +- `seq_len_kv[b]` is bounded by the table row's width, `block_table_width * block_size` + (`block_table_width` is the tables' `M`; it is not `block_table_stride`, the step + between rows, which a batch of one does not carry), so the page-table read stays inside + its row. A longer length is a caller bug and attends to masked pages past the table. + +An invalid page id or length makes that sequence's output wrong (no error is reported); it +cannot read or write outside the cache, the table or the output. Other device-read values +(`seq_len_q`, ragged offsets) keep their documented preconditions: the kernel writes only +rows the offsets and `seq_len_q` own. What the graph's descriptors fix (ranks, dtypes, +strides, extents, alignment, table widths, `M * block_size` within int32) is checked when +the engine matches. + +## Saved plans + +The engine reports `SUPPORTS_EXECUTION_PLAN_SERIALIZATION`: a built plan saves with +`to_binary()` or `to_compiled_plan_binary()` and loads into a fresh handle without matching, +descriptor search or archive reads. The payload holds the kernel's code object and, under +the dispatch contract `hipkernel.attention_paged_unified.dispatch.v1` +(`packs/AttentionPagedUnifiedLaunchValues.hpp`), the launch values: the uids of Q, K, V, O, +both page tables, `seq_len_kv`, `seq_len_q`, the ragged offset and the sink (`-1` when +absent), the scale (any finite float, stored exactly as a double), every by-value kernel +argument (`num_seqs`, `block_table_stride`, the head counts, `sliding_window`, +`q_uniform_len` (`Sq` for a dense Q, 0 for a ragged one), the Q/O/KV strides, +`kv_block_span_bytes`, `q_block_grid`, `sink_is_f32` (1 for a FLOAT sink, else 0), +`num_kv_blocks`, `block_table_width`) and +`block_threads`. The loaded plan +launches the same grid, `(num_kv_heads, q_block_grid)`, with `block_threads` threads. A load +refuses a value of another type, an extra or missing value, or one outside what the kernel +takes. Lengths, page tables, offsets and sinks stay device buffers bound at execute, so a +loaded plan serves every step just as the original does +(`IntegrationGpuAttentionPagedUnifiedSaveLoad`). + +## Attention sinks + +`sink_token` adds one logit per query head to the softmax max and denominator, with no value +row and no `attn_scale` (SdpaSemanticsRegister SEM-022); a row with no visible key still gets +O = 0. Both forms are served by the same `use_sinks` objects, and the launch argument +`sink_is_f32` tells the kernel which one `sink_ptr` holds: + +- FLOAT `[1, Hq, 1, 1]`, cuDNN's form and the one the hipDNN frontend admits. +- The Q data type (FP16 or BF16), because vLLM keeps sinks in the model dtype + (`layer.sinks`, a `[Hq]` tensor of raw logits): bind it without a copy as the view + `[1, Hq, 1, 1]` with strides `[Hq, 1, 1, 1]`. A frontend that accepts only FLOAT sinks + rejects such a graph before any engine sees it; the Q-dtype sink integration tests skip + with that reason there. + +The kernel reads exactly `Hq` logits of the declared type. The buffer must be 16-byte +aligned; a graph declaring a smaller `alignment` for it is declined with cause `alignment`. diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified.kmd.json b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified.kmd.json new file mode 100644 index 000000000000..fc8d9092254d --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified.kmd.json @@ -0,0 +1,43 @@ +{ + "version": "1.0", + "id": "29593010-20c8-41e6-9197-d4d617e1d25b", + "name": "AttentionPagedUnified variant fields", + "fields": [ + { + "name": "dtype", + "type": "string" + }, + { + "name": "head_size", + "type": "int" + }, + { + "name": "block_size", + "type": "int" + }, + { + "name": "num_query_heads", + "type": "int" + }, + { + "name": "num_kv_heads", + "type": "int", + "default_value": 1 + }, + { + "name": "num_warps", + "type": "int", + "default_value": 1 + }, + { + "name": "block_m_per_warp", + "type": "int", + "default_value": 16 + }, + { + "name": "use_sinks", + "type": "int", + "default_value": 0 + } + ] +} diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified.udd.json b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified.udd.json new file mode 100644 index 000000000000..ab79bcaa1172 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified.udd.json @@ -0,0 +1,6 @@ +{ + "version": "1.0", + "id": "b4085b75-ea3b-4d38-878d-9998a03e15c7", + "name": "AttentionPagedUnified dispatch", + "dispatch_symbol": "hipkernel.attention_paged_unified.dispatch" +} diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified.ued.json b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified.ued.json new file mode 100644 index 000000000000..0e92010fdfe6 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified.ued.json @@ -0,0 +1,10 @@ +{ + "version": "1.0", + "id": "c9af5aa1-86fc-4186-aa3c-307b929710af", + "name": "hipkernel:AttentionPagedUnified", + "sdk_version": "1.4.0", + "graph_match": { + "native": "hipkernel.attention_paged_unified.graph_match" + }, + "metadata": "29593010-20c8-41e6-9197-d4d617e1d25b" +} diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified_gfx942.kdp.json b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified_gfx942.kdp.json new file mode 100644 index 000000000000..3aa8a625f610 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified_gfx942.kdp.json @@ -0,0 +1,9958 @@ +{ + "version": "1.0", + "id": "bde2bdfd-013d-4775-a8e4-850d05605d39", + "name": "hipkernel:attention_paged_unified_gfx942", + "matchers": [ + "cb28d2d1-dbfc-43cf-92bf-b2c1b6fc0f90", + "2af4cb01-70e7-485f-9f09-da2d3aa55fd2" + ], + "engine": "c9af5aa1-86fc-4186-aa3c-307b929710af", + "dispatch": "b4085b75-ea3b-4d38-878d-9998a03e15c7", + "provenance": { + "specialization_contract": { + "schema_version": 1, + "consumers": [ + { + "engine_id": "c9af5aa1-86fc-4186-aa3c-307b929710af", + "kmd_id": "29593010-20c8-41e6-9197-d4d617e1d25b", + "metadata_fields": [ + "dtype", + "head_size", + "block_size", + "num_query_heads", + "num_kv_heads", + "num_warps", + "block_m_per_warp", + "use_sinks" + ], + "matcher_only_fields": [], + "bindings": { + "dtype": { + "field": "dtype" + }, + "head_size": { + "field": "head_size" + }, + "block_size": { + "field": "block_size" + }, + "num_query_heads": { + "field": "num_query_heads" + }, + "num_kv_heads": { + "field": "num_kv_heads" + }, + "num_warps": { + "field": "num_warps" + }, + "block_m_per_warp": { + "field": "block_m_per_warp" + }, + "use_sinks": { + "field": "use_sinks" + } + }, + "vocabulary": { + "dtype": { + "bf16": "BF16", + "fp16": "FP16" + } + } + } + ] + } + }, + "kernelDescriptors": [ + { + "version": "1.0", + "id": "ac3a259f-aa67-44ae-ad33-7739352f3438", + "name": "paged_unified.fp16_d64_bs16_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cae5f1d7-c651-436c-a93b-a1d63b9e377b", + "name": "paged_unified.fp16_d64_bs16_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "88b6cd85-ea9d-4e53-88db-31491311af36", + "name": "paged_unified.fp16_d64_bs16_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3e8eb1f2-0b9d-4db1-a962-4bc05cfd7f09", + "name": "paged_unified.fp16_d64_bs16_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a9466a6a-fbf0-40f2-a873-91e97c793b1f", + "name": "paged_unified.fp16_d64_bs16_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c7fd2902-61cd-467f-acd4-e7f1d3605af2", + "name": "paged_unified.fp16_d64_bs16_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "25e2b2bd-019d-4844-8e46-8308adf5dc4b", + "name": "paged_unified.fp16_d64_bs16_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fc1fa730-8bea-4db4-a146-e8b9d0d42570", + "name": "paged_unified.fp16_d64_bs16_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "32ca0794-8c05-42ac-b85e-4457c70d89c8", + "name": "paged_unified.fp16_d64_bs32_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3b8143dc-3fe8-4b83-9b15-734b14e7f881", + "name": "paged_unified.fp16_d64_bs32_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f90937ed-8368-4396-adec-35869a03e653", + "name": "paged_unified.fp16_d64_bs32_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9244a4e5-b98d-418c-b179-4895ace3e36b", + "name": "paged_unified.fp16_d64_bs32_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8dd76620-ebb9-4069-9dc5-05dfe1c7fcd9", + "name": "paged_unified.fp16_d64_bs32_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "93e4b1a0-b2dc-4f97-9d2a-415666fe09f5", + "name": "paged_unified.fp16_d64_bs32_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "60a2abaa-1b1a-43b8-b8e6-cfbbb73dd38e", + "name": "paged_unified.fp16_d64_bs32_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c4415aed-a925-44ec-b263-dd46068e4d2c", + "name": "paged_unified.fp16_d64_bs32_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "07fa4bb6-3538-461f-a852-f464c6dd291e", + "name": "paged_unified.fp16_d64_bs64_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0dc8f904-057b-4728-bc87-29f346d27614", + "name": "paged_unified.fp16_d64_bs64_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2783f100-44aa-4f9c-a167-819dfe59f0da", + "name": "paged_unified.fp16_d64_bs64_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "85e02c6e-2ebe-48b8-b19b-471219987ffa", + "name": "paged_unified.fp16_d64_bs64_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "dd0a65ef-c32e-4a50-8fda-6927dbfbd898", + "name": "paged_unified.fp16_d64_bs64_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "894c8fcb-df93-49fb-9ccf-62bfdb2909ec", + "name": "paged_unified.fp16_d64_bs64_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "78b92668-42c9-4f97-b5f3-e8988bf8dfe5", + "name": "paged_unified.fp16_d64_bs64_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ddf9579a-5419-4723-b0cd-d036a3ccc726", + "name": "paged_unified.fp16_d64_bs64_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e45fa13b-f3d5-4a2e-800a-6efefb5c06e3", + "name": "paged_unified.bf16_d64_bs16_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8807f353-49d4-4599-acb4-3d298dd00061", + "name": "paged_unified.bf16_d64_bs16_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "dc7719b1-cdc9-4b76-b6a1-137bee2ec07d", + "name": "paged_unified.bf16_d64_bs16_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "473f6036-9469-4a18-86c1-310216af799d", + "name": "paged_unified.bf16_d64_bs16_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ad0ed6a6-579d-4376-8014-286ae081b034", + "name": "paged_unified.bf16_d64_bs16_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0168ed44-b741-43c6-9842-baac7a9b0f37", + "name": "paged_unified.bf16_d64_bs16_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e1a4b62d-774e-4334-a2a1-7cb86657c03c", + "name": "paged_unified.bf16_d64_bs16_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d36cc8c3-48d4-4c67-a96f-06f498191f1b", + "name": "paged_unified.bf16_d64_bs16_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2aaa6841-a001-475f-bd60-c6bf2e2c7aff", + "name": "paged_unified.bf16_d64_bs32_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "218889ee-10b8-4b53-9d73-8adc47814c14", + "name": "paged_unified.bf16_d64_bs32_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2dbe1234-1127-4957-8a8c-5f7634684218", + "name": "paged_unified.bf16_d64_bs32_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8d136bda-0bef-4ffd-b2b3-ac82d7c23550", + "name": "paged_unified.bf16_d64_bs32_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "dc8a84f3-b5de-49ad-97b2-514c9c876b74", + "name": "paged_unified.bf16_d64_bs32_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d75370a0-d31b-4257-94a1-7e44027e5136", + "name": "paged_unified.bf16_d64_bs32_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6a655662-6be4-468f-9b59-64f369e3067c", + "name": "paged_unified.bf16_d64_bs32_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a7c0afba-8f25-46a4-97e5-74666ccb0358", + "name": "paged_unified.bf16_d64_bs32_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f5c758e5-d5f2-4642-bd91-b99cf4f8f060", + "name": "paged_unified.bf16_d64_bs64_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6d29b974-059b-4d0b-a395-013bb4251f41", + "name": "paged_unified.bf16_d64_bs64_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1b276dda-105f-4294-ada1-1798f1ff24c5", + "name": "paged_unified.bf16_d64_bs64_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e313f681-8989-4a98-880f-d86a69575ccd", + "name": "paged_unified.bf16_d64_bs64_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8723bedb-b052-44f7-bf69-f9645da03300", + "name": "paged_unified.bf16_d64_bs64_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "464e8970-163d-4c3e-bb16-fecae28b67c9", + "name": "paged_unified.bf16_d64_bs64_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5e9c3468-94f6-46e7-8c33-12a22e1419c1", + "name": "paged_unified.bf16_d64_bs64_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9cff9c09-3473-4e87-a102-535cd94ee448", + "name": "paged_unified.bf16_d64_bs64_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "edea0288-803a-4df7-a716-fc82de61f3e5", + "name": "paged_unified.fp16_d64_bs16_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "efd0c742-f53b-4d4f-9c0c-9789c02513f1", + "name": "paged_unified.fp16_d64_bs16_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fa893f71-fc0c-42da-8687-267bed9c0b27", + "name": "paged_unified.fp16_d64_bs16_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e507356f-6d1b-422f-b5af-9e3ba120e7d3", + "name": "paged_unified.fp16_d64_bs16_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ce6b284d-cd6c-40cf-b84b-5e49277cc8db", + "name": "paged_unified.fp16_d64_bs16_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0b396c1e-f4f8-49ce-a4ae-3c0acf1f0487", + "name": "paged_unified.fp16_d64_bs16_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8f9993eb-8728-4f27-bf8b-ff42c84dc3e3", + "name": "paged_unified.fp16_d64_bs16_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "68cbfa56-e167-4d71-bbe3-1f32e3e81fb3", + "name": "paged_unified.fp16_d64_bs16_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "98dbd3cf-8f48-4fb8-85ba-d1269cc62fd9", + "name": "paged_unified.fp16_d64_bs32_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2f131e74-5d36-43fe-87c8-596e3d235316", + "name": "paged_unified.fp16_d64_bs32_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2be8a4b5-ad22-45e0-bdcf-8012721e0b7c", + "name": "paged_unified.fp16_d64_bs32_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "06891651-7658-4fe3-9aac-2ccc8275f5cb", + "name": "paged_unified.fp16_d64_bs32_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "705add03-e92b-48ca-a7ee-a018aea49629", + "name": "paged_unified.fp16_d64_bs32_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "11a4a13b-c395-4331-8963-b5116a76e907", + "name": "paged_unified.fp16_d64_bs32_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "597ab83d-b9ec-409c-a5e9-17e9ddf99e23", + "name": "paged_unified.fp16_d64_bs32_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cae125c6-a501-4f05-b163-02e3dbec6316", + "name": "paged_unified.fp16_d64_bs32_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "56d06e87-fa3d-4cee-8277-03a17af619a3", + "name": "paged_unified.fp16_d64_bs64_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ce57492c-6860-4323-96a8-48d0b682c81a", + "name": "paged_unified.fp16_d64_bs64_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "bfe09b21-3f69-4bee-a7b8-8981e83e344b", + "name": "paged_unified.fp16_d64_bs64_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ed65bc94-03ec-4d6b-9d31-f0a7ec8e7c17", + "name": "paged_unified.fp16_d64_bs64_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "917d3b03-da13-4eb6-838e-2b326c467274", + "name": "paged_unified.fp16_d64_bs64_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fcd8c1ec-fc63-415e-be0b-4ae896d4aad2", + "name": "paged_unified.fp16_d64_bs64_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2814bb22-431b-450b-b920-f24d1542fb02", + "name": "paged_unified.fp16_d64_bs64_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b359048d-2224-4718-9374-053cf31b0f45", + "name": "paged_unified.fp16_d64_bs64_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "48c39822-7bf3-40dc-bbcb-b3dc7097b84d", + "name": "paged_unified.bf16_d64_bs16_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4ce28d1c-58e7-4930-b426-f5fa4cd96155", + "name": "paged_unified.bf16_d64_bs16_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6d25df23-7e6e-47b2-8cce-8ce35aa827bc", + "name": "paged_unified.bf16_d64_bs16_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5f2ed1f6-ede2-47a9-b4a2-d8feb1cc78be", + "name": "paged_unified.bf16_d64_bs16_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ecb3c36a-2c57-46b0-9da3-0f840bf07d75", + "name": "paged_unified.bf16_d64_bs16_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4d8c7fd7-e8e7-484d-9091-21e0290ccb31", + "name": "paged_unified.bf16_d64_bs16_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a6cb055b-f7fb-49d7-98d5-2465db2a1ec8", + "name": "paged_unified.bf16_d64_bs16_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c004bfa1-ff65-4ff3-b549-c5faa7ba6ad7", + "name": "paged_unified.bf16_d64_bs16_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2935d6be-76f2-430d-9cbb-1a9e7f614a7f", + "name": "paged_unified.bf16_d64_bs32_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fa828605-a4cc-47d6-94d6-04a1a34ccb5a", + "name": "paged_unified.bf16_d64_bs32_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "948abe50-9c07-4e81-9037-25c69300d1ba", + "name": "paged_unified.bf16_d64_bs32_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "980ce7b6-b49d-42cf-84ba-813fadc7b610", + "name": "paged_unified.bf16_d64_bs32_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "473ea40b-be27-4b10-bec3-7732a2a4cb82", + "name": "paged_unified.bf16_d64_bs32_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a9cb25f6-0425-4f89-80b3-30f91c9850d2", + "name": "paged_unified.bf16_d64_bs32_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fb1472e9-fdd2-4a4a-949f-d5d225ec6eae", + "name": "paged_unified.bf16_d64_bs32_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6aa4f2c7-aa20-476e-b8db-72a392bba49e", + "name": "paged_unified.bf16_d64_bs32_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "29b6f77f-01f7-4a52-987c-16c1be9eb3e1", + "name": "paged_unified.bf16_d64_bs64_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e55989c5-7a1c-4ff7-ab34-a8b59f91d66d", + "name": "paged_unified.bf16_d64_bs64_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ea40284c-94cf-4f2d-92cf-209410d4918b", + "name": "paged_unified.bf16_d64_bs64_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ca6be064-a1f3-4a94-abde-aec7d0d690d9", + "name": "paged_unified.bf16_d64_bs64_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "34ae8ffa-93f1-43e3-aa1d-cab33b54c08f", + "name": "paged_unified.bf16_d64_bs64_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "341c1a1d-3303-4fe1-b7dd-5b3208bd63a0", + "name": "paged_unified.bf16_d64_bs64_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4d5233e6-7332-48d5-a572-fdfac3a5c090", + "name": "paged_unified.bf16_d64_bs64_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9dd43587-9687-48c2-91b3-ba7e30e9ade8", + "name": "paged_unified.bf16_d64_bs64_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "701f27e2-1560-46bf-bf5c-0f4859384cfe", + "name": "paged_unified.fp16_d128_bs16_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d50f33f2-58d5-4081-8936-4865bb8634cf", + "name": "paged_unified.fp16_d128_bs16_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fd7b7e40-e45a-42bc-bae7-b88fc6cf68e1", + "name": "paged_unified.fp16_d128_bs16_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "80f7dd0d-aa5b-4f56-b4e5-5348fbe2938d", + "name": "paged_unified.fp16_d128_bs16_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6e936022-555f-4ba7-82ef-6aaef6e28aaa", + "name": "paged_unified.fp16_d128_bs16_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "44491d76-6096-47a4-94e2-ede91b0df490", + "name": "paged_unified.fp16_d128_bs16_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cfccbc6b-ee3b-49ae-9600-cc202f29a4a9", + "name": "paged_unified.fp16_d128_bs16_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "88a19b4b-4564-408c-8abb-9327a3974cdd", + "name": "paged_unified.fp16_d128_bs16_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a641185b-5f20-4091-8a82-6c296b90b609", + "name": "paged_unified.fp16_d128_bs32_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9f5a1fd7-3694-47cf-972c-2b2cb2a4f534", + "name": "paged_unified.fp16_d128_bs32_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "75312411-5fc9-42e4-a32a-e053d0b49c30", + "name": "paged_unified.fp16_d128_bs32_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "88678d21-5e9b-4ad1-aaa5-88ab75c79f36", + "name": "paged_unified.fp16_d128_bs32_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d8044804-2395-4d7f-aced-613dbb18a5e5", + "name": "paged_unified.fp16_d128_bs32_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6d889bb3-3530-421e-9bfb-99caed2a2129", + "name": "paged_unified.fp16_d128_bs32_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4641983e-55ea-430e-b3c2-1efc43b63c99", + "name": "paged_unified.fp16_d128_bs32_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4e2c8d14-471d-4073-bf96-fcfa50b41d15", + "name": "paged_unified.fp16_d128_bs32_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "09069d51-a53b-42e0-868d-5c988d6ad258", + "name": "paged_unified.bf16_d128_bs16_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "97a2206e-6618-4bcf-8fb8-f7f50d4f1647", + "name": "paged_unified.bf16_d128_bs16_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "514bc828-2d04-4a1f-abbf-275299038ffd", + "name": "paged_unified.bf16_d128_bs16_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0dd22a87-666c-4908-9043-1f336f4572be", + "name": "paged_unified.bf16_d128_bs16_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6807f611-dabe-43c2-90e4-9ad2d554d3f4", + "name": "paged_unified.bf16_d128_bs16_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c12fe6fe-7ff6-4dab-932a-0785c62eacf0", + "name": "paged_unified.bf16_d128_bs16_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b2c33dd4-1a94-4ff5-b608-d542c8ac86aa", + "name": "paged_unified.bf16_d128_bs16_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "175c08b0-a170-41d3-83c9-792e4a52b548", + "name": "paged_unified.bf16_d128_bs16_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b411a49c-412c-4e06-a800-f12dc574f857", + "name": "paged_unified.bf16_d128_bs32_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ed58e83c-f25f-4e65-b538-b0770e25a349", + "name": "paged_unified.bf16_d128_bs32_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c63de556-8f99-450c-b314-70a06e5ed83c", + "name": "paged_unified.bf16_d128_bs32_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2260732c-5eed-40b9-9ef7-efb5aba4fe69", + "name": "paged_unified.bf16_d128_bs32_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d67f5676-606a-4806-83ca-d38332f1ae7f", + "name": "paged_unified.bf16_d128_bs32_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a913addc-0225-4271-b72e-450296107b78", + "name": "paged_unified.bf16_d128_bs32_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5e7109ba-5996-4a22-b50f-76ac74bc4bdd", + "name": "paged_unified.bf16_d128_bs32_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6177c073-1d67-48e2-b1bf-2276ca576323", + "name": "paged_unified.bf16_d128_bs32_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "83dcfc4d-8e09-424d-b8a1-67c66f18d9e6", + "name": "paged_unified.fp16_d128_bs16_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "efdfd402-dab8-46ff-baa7-fc7323af17c2", + "name": "paged_unified.fp16_d128_bs16_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8798d5a9-c166-420b-9912-1cd029e68a18", + "name": "paged_unified.fp16_d128_bs16_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "48072aa3-cc2e-43d2-8d09-95bcba27ebbb", + "name": "paged_unified.fp16_d128_bs16_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b91951f0-1603-474d-b29a-5645e4777630", + "name": "paged_unified.fp16_d128_bs16_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7eb41725-63cc-4e52-8664-c80cb62cc81c", + "name": "paged_unified.fp16_d128_bs16_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "40994238-8d4f-4845-b5a4-632f95e149a1", + "name": "paged_unified.fp16_d128_bs16_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "15f4a6d8-1fa2-469a-a8a5-0f91df50806e", + "name": "paged_unified.fp16_d128_bs16_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "01927d50-aaa5-4434-85f6-f884ff321af6", + "name": "paged_unified.fp16_d128_bs32_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "369c4d85-25ca-4cc2-aa8c-1b730cf18a88", + "name": "paged_unified.fp16_d128_bs32_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1d136107-bb4c-4336-8716-4130ac94ddae", + "name": "paged_unified.fp16_d128_bs32_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f825b9ce-a1f5-4354-9476-fdbda9b3012a", + "name": "paged_unified.fp16_d128_bs32_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9464eeee-a045-41ed-9843-767a330aaed7", + "name": "paged_unified.fp16_d128_bs32_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "afb03fcc-1f07-4779-a24f-0d7c83ea2723", + "name": "paged_unified.fp16_d128_bs32_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0905886e-3652-45d8-9aab-3698abd7a195", + "name": "paged_unified.fp16_d128_bs32_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9e55cd05-209b-4ec6-8dcd-608c083e709a", + "name": "paged_unified.fp16_d128_bs32_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "09e8181e-e9b7-4cef-af3c-3b5dab814c66", + "name": "paged_unified.bf16_d128_bs16_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "463add6f-1c12-4aeb-821c-f26c0888ba07", + "name": "paged_unified.bf16_d128_bs16_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "54d4c8b3-3bce-49f2-8977-911747a734f4", + "name": "paged_unified.bf16_d128_bs16_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2243d4c4-92a6-4305-a53e-e1e6b8e835e0", + "name": "paged_unified.bf16_d128_bs16_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "95246058-6f92-47ee-83f1-343788cd48d0", + "name": "paged_unified.bf16_d128_bs16_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "44a9e913-e160-485c-b299-eb3c1007af7d", + "name": "paged_unified.bf16_d128_bs16_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "80b3c220-0fbe-420b-b973-12873de73007", + "name": "paged_unified.bf16_d128_bs16_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f40569e6-b774-4908-be41-b085f57241f5", + "name": "paged_unified.bf16_d128_bs16_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1b72b6ec-c94e-4cde-8b94-640b69f9e2c8", + "name": "paged_unified.bf16_d128_bs32_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "022ac29c-cf0f-4f36-bf6a-9eceb14337c9", + "name": "paged_unified.bf16_d128_bs32_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b7b5365b-3d1d-4dd3-bc1e-d4462a6449b4", + "name": "paged_unified.bf16_d128_bs32_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cdf7c7b8-368b-41f7-af3d-7c03b22ab4b3", + "name": "paged_unified.bf16_d128_bs32_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "22559312-ed9c-47e0-9379-566b909ccd2c", + "name": "paged_unified.bf16_d128_bs32_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "66530765-d0e0-4b51-9261-d395722353a6", + "name": "paged_unified.bf16_d128_bs32_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "993fdedb-9d58-43c1-89ca-8248081f48ad", + "name": "paged_unified.bf16_d128_bs32_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2752284a-7165-42a6-bb04-ac37d92654ac", + "name": "paged_unified.bf16_d128_bs32_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "86747b15-9cd1-4100-b342-b141cfb866c7", + "name": "paged_unified.fp16_d128_bs64_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4e370ce1-dd0a-4007-adce-f60fca42798a", + "name": "paged_unified.fp16_d128_bs64_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f0f1bcaa-d60a-4cce-aa9d-da0fce673723", + "name": "paged_unified.fp16_d128_bs64_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1b5aa6c7-c2e9-48bc-8a21-730cbff8931d", + "name": "paged_unified.fp16_d128_bs64_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "293e79fa-4d2e-4217-b958-85eac443ae20", + "name": "paged_unified.fp16_d128_bs64_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e65ad64f-8be5-4ed7-9581-6dc36ee21a37", + "name": "paged_unified.fp16_d128_bs64_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0f5fdc64-0bca-4f70-8eaf-34b354ab515f", + "name": "paged_unified.fp16_d128_bs64_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "66eb77a7-9294-4c39-942f-7450b1c6ce57", + "name": "paged_unified.fp16_d128_bs64_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7b25d583-ad68-46c3-879a-16bbc173e263", + "name": "paged_unified.bf16_d128_bs64_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1db67e22-b005-4897-a718-dcf582a9ff52", + "name": "paged_unified.bf16_d128_bs64_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c5dc14ec-03ed-4856-a5ec-712f5cf89c3b", + "name": "paged_unified.bf16_d128_bs64_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4e7b3dd7-efb8-48b4-86f5-3531a252ab39", + "name": "paged_unified.bf16_d128_bs64_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6c694e99-03a7-45e5-9784-aec50b7f3dca", + "name": "paged_unified.bf16_d128_bs64_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6a0be8fc-a18a-4394-8d6c-44fb1f635aba", + "name": "paged_unified.bf16_d128_bs64_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7d25615f-88ce-4c94-ac3e-700adc1203ca", + "name": "paged_unified.bf16_d128_bs64_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1988811f-6442-4704-bfed-87152b891790", + "name": "paged_unified.bf16_d128_bs64_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b868eee8-08ce-4b80-9c38-c3132f9a66ab", + "name": "paged_unified.fp16_d128_bs64_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6b41e98a-7939-47e7-a954-14541ff5f5f2", + "name": "paged_unified.fp16_d128_bs64_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0662ca6f-9198-4414-9aca-713f88d2aca6", + "name": "paged_unified.fp16_d128_bs64_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8288266c-185a-4825-a46a-400c98639ad6", + "name": "paged_unified.fp16_d128_bs64_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ecaa4f99-0cd8-4906-a3cd-0860373c17f5", + "name": "paged_unified.fp16_d128_bs64_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b7e52113-ec03-4963-a78a-38c5f56f275c", + "name": "paged_unified.fp16_d128_bs64_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0bd871cd-e78f-4b35-8c63-c4dcc7d8f59d", + "name": "paged_unified.fp16_d128_bs64_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1d28d80c-4033-4594-8fc8-6aedc37a7d0b", + "name": "paged_unified.fp16_d128_bs64_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fe6a9848-1731-4d8e-bdda-a313fe5b06e8", + "name": "paged_unified.bf16_d128_bs64_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "dd540b67-0b13-4bf2-9d5a-86a315117ecb", + "name": "paged_unified.bf16_d128_bs64_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a3a1e898-74c5-4649-8c3b-21c628834ecc", + "name": "paged_unified.bf16_d128_bs64_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "032af522-35f4-40ba-8868-fceb21a2f56f", + "name": "paged_unified.bf16_d128_bs64_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d742b875-a839-4967-9f4d-c2a5b3d8778a", + "name": "paged_unified.bf16_d128_bs64_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "db83fb90-d971-4227-8396-6ba7f4369ff3", + "name": "paged_unified.bf16_d128_bs64_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "578083f5-f71c-418c-a340-691f8b5a4efb", + "name": "paged_unified.bf16_d128_bs64_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f0748b99-db7a-48a2-984f-b7959e082f3c", + "name": "paged_unified.bf16_d128_bs64_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 32 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5c514c06-d72c-447a-b40b-d91c24f311ad", + "name": "paged_unified.fp16_d256_bs16_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cebbdb37-ba3d-4768-8603-922559efb84b", + "name": "paged_unified.fp16_d256_bs16_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5179bd59-7ad4-459d-8670-252529f6e40f", + "name": "paged_unified.fp16_d256_bs16_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "abb8d874-4c87-47dd-8b55-1a9123fc0b52", + "name": "paged_unified.fp16_d256_bs16_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e2fa0990-75a3-4348-9bc3-8a38348bb4dd", + "name": "paged_unified.fp16_d256_bs16_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b673c8ea-17e8-4582-9959-755b90c78c56", + "name": "paged_unified.fp16_d256_bs16_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8006a158-39f9-4c23-8d69-7dc7a9815665", + "name": "paged_unified.fp16_d256_bs16_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "18035187-7ead-4e13-8f04-d426787f774d", + "name": "paged_unified.fp16_d256_bs16_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "61554637-a037-4334-87bd-7590768fdd36", + "name": "paged_unified.bf16_d256_bs16_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "64b4aff1-dc26-4529-9858-6c332be5a7a6", + "name": "paged_unified.bf16_d256_bs16_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b0b6dde0-c33a-4412-9c48-ed3f53db151c", + "name": "paged_unified.bf16_d256_bs16_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a07594c6-c531-4de9-a665-ad71aaeea49a", + "name": "paged_unified.bf16_d256_bs16_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "20aedd92-dfac-42ec-be28-52d8c42eb69a", + "name": "paged_unified.bf16_d256_bs16_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1d85f359-75dd-4491-9ed1-0bc53aadcad9", + "name": "paged_unified.bf16_d256_bs16_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cdbf067b-17a1-45de-839d-a9354959a517", + "name": "paged_unified.bf16_d256_bs16_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8d2b1838-4a4c-44bb-896a-1ce30a4c5c5a", + "name": "paged_unified.bf16_d256_bs16_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3d079a25-6d13-41e5-8ae3-c6fd9d54b53b", + "name": "paged_unified.fp16_d256_bs16_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "57b6c52f-ae9f-4f5b-b361-b22014dbafe8", + "name": "paged_unified.fp16_d256_bs16_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "625ec71d-71a9-4890-94a7-82e8126a6d36", + "name": "paged_unified.fp16_d256_bs16_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9c567671-1352-4273-bb4b-475cef864c72", + "name": "paged_unified.fp16_d256_bs16_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "409765d8-8991-4516-adba-ae12fcf3c78c", + "name": "paged_unified.fp16_d256_bs16_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "168b66a0-b4c7-4e9a-a0d2-31a702cf66f1", + "name": "paged_unified.fp16_d256_bs16_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "31de36e4-191f-44eb-be4f-a79b278312e7", + "name": "paged_unified.fp16_d256_bs16_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "89501484-f75f-4119-9ec0-e86d90d1f49a", + "name": "paged_unified.fp16_d256_bs16_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8b65cc04-ab1a-469a-9e49-09c80d47a2ac", + "name": "paged_unified.bf16_d256_bs16_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ba76172b-9478-4618-8a32-4bbb85f70c9f", + "name": "paged_unified.bf16_d256_bs16_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2f2abd72-29cc-44f5-b881-e1c8fef4ec71", + "name": "paged_unified.bf16_d256_bs16_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "395c1213-e35d-4a9f-a219-b29e423dd85a", + "name": "paged_unified.bf16_d256_bs16_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "66bbad55-aee2-4373-8bd6-aa43e2bf2063", + "name": "paged_unified.bf16_d256_bs16_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "808485f9-732e-4c35-ae64-d9c0bbf3a32a", + "name": "paged_unified.bf16_d256_bs16_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4567a03b-496d-4ef6-8341-2c2b0529111e", + "name": "paged_unified.bf16_d256_bs16_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "739e5047-23cd-45a7-a897-fea7ea8bf04e", + "name": "paged_unified.bf16_d256_bs16_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6cc3a1e4-015e-4b86-a948-e319eaeb7ad8", + "name": "paged_unified.fp16_d256_bs32_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "78ad1dc2-4990-4d20-8a11-ad65c2cc6fa7", + "name": "paged_unified.fp16_d256_bs32_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ab7ccf3c-6f0a-4473-add0-841dfe04d594", + "name": "paged_unified.fp16_d256_bs32_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f12530ae-4c7e-4d4e-90e8-d846b8c9ea03", + "name": "paged_unified.fp16_d256_bs32_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "187fcb77-6d3e-45dc-8f7a-7ecabd9bf22f", + "name": "paged_unified.fp16_d256_bs32_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1539cfde-01d5-48f1-9e3e-51ccce665c7d", + "name": "paged_unified.fp16_d256_bs32_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a3962ed8-48c3-4040-b2d5-46ada767c728", + "name": "paged_unified.fp16_d256_bs32_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3e4d2855-4f32-4cd6-92f2-bbdc792ceadf", + "name": "paged_unified.fp16_d256_bs32_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6b178d54-2b96-4643-88f1-26780eeb1813", + "name": "paged_unified.fp16_d256_bs64_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "07f693c9-03f5-494f-83a0-b2481c44fad3", + "name": "paged_unified.fp16_d256_bs64_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "234d4c84-c735-4db1-9ddb-9c84da40b0c4", + "name": "paged_unified.fp16_d256_bs64_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "87d08061-89b3-4209-8ebb-ff0eaa9e0753", + "name": "paged_unified.fp16_d256_bs64_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "758eec60-0f53-4755-a860-ed7eea5b2b93", + "name": "paged_unified.fp16_d256_bs64_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b998310a-e62b-414f-8a93-1494caf207fb", + "name": "paged_unified.fp16_d256_bs64_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9e5eb0bd-5f29-4d73-b4d5-d28947f4b9ea", + "name": "paged_unified.fp16_d256_bs64_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b488e074-e8a6-472f-95f9-729f4a462ba8", + "name": "paged_unified.fp16_d256_bs64_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "da969a4d-689d-4180-8d48-406c9fc00ba7", + "name": "paged_unified.bf16_d256_bs32_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "adf8af59-6f60-4030-9463-4e16d8903f8a", + "name": "paged_unified.bf16_d256_bs32_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2a09f9a3-39fb-40ae-b1f9-204d94180745", + "name": "paged_unified.bf16_d256_bs32_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e64a72c8-3a9c-46ef-a26f-3a2bfd6df039", + "name": "paged_unified.bf16_d256_bs32_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9d505e57-3cec-45c1-8321-8f0161440b3f", + "name": "paged_unified.bf16_d256_bs32_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d6010192-7a8d-478d-887f-ebeb51098cf7", + "name": "paged_unified.bf16_d256_bs32_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "23ec2d33-8201-42a4-b218-5863ad63979e", + "name": "paged_unified.bf16_d256_bs32_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d7c30411-7e7d-42f0-95dd-3db195b79e67", + "name": "paged_unified.bf16_d256_bs32_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4cb9a5a8-f644-4a31-8bde-83745097f756", + "name": "paged_unified.bf16_d256_bs64_g1.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "481b8d6e-1b0e-4a1c-99cd-80242ce47f87", + "name": "paged_unified.bf16_d256_bs64_g2.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f8c079c8-4ffa-4712-acfe-48aa868670c4", + "name": "paged_unified.bf16_d256_bs64_g4.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cc5c8c01-c52f-4dae-a16e-4bca837e9632", + "name": "paged_unified.bf16_d256_bs64_g5.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "be5c397d-609a-4b96-92dd-b996bb385694", + "name": "paged_unified.bf16_d256_bs64_g6.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "636cfdbc-7fcd-4a0d-93d4-69ec63cd2eb1", + "name": "paged_unified.bf16_d256_bs64_g7.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2323658c-2c4a-4095-9d60-56d95d8cc4af", + "name": "paged_unified.bf16_d256_bs64_g8.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c9b1aa2c-b30c-4cc4-84c8-e4e63e62da99", + "name": "paged_unified.bf16_d256_bs64_g16.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "60f12e0c-d0be-4f84-8205-4e06370d342f", + "name": "paged_unified.fp16_d256_bs32_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "13831b06-cd98-4077-93c5-efe932189aa8", + "name": "paged_unified.fp16_d256_bs32_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d1fb61e6-062d-467e-bfea-2fc24740fde6", + "name": "paged_unified.fp16_d256_bs32_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4e2d1803-b424-4de4-b592-395abd0a9d61", + "name": "paged_unified.fp16_d256_bs32_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "68687aaf-bee0-4c2b-9d1f-32adcdea43ac", + "name": "paged_unified.fp16_d256_bs32_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f32b9835-26ed-48de-9c87-9e9ec8ab76f4", + "name": "paged_unified.fp16_d256_bs32_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "da4bddd4-b97a-4301-a54b-ec7d50ac8fdf", + "name": "paged_unified.fp16_d256_bs32_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cbe1f815-b0e1-4c24-9894-c24201cfb3f8", + "name": "paged_unified.fp16_d256_bs32_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a6e86f72-a23f-4abc-90c1-ccdfed220a30", + "name": "paged_unified.fp16_d256_bs64_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c1712291-e00f-4945-befb-a74401645980", + "name": "paged_unified.fp16_d256_bs64_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "14e3055b-da30-4dba-ae65-8b04ea4ccd54", + "name": "paged_unified.fp16_d256_bs64_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "bb62b9ba-dc14-4726-a6ee-38ed29a21832", + "name": "paged_unified.fp16_d256_bs64_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0f235e89-7caf-4273-adf2-54c089d42a16", + "name": "paged_unified.fp16_d256_bs64_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0ea29c1b-3fad-4760-b3ac-6ec294f3398a", + "name": "paged_unified.fp16_d256_bs64_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b71299ad-d1d5-4bf2-9a86-3fea42dc0f90", + "name": "paged_unified.fp16_d256_bs64_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "20482e0f-fda9-4bb4-8394-e545c00d1cd1", + "name": "paged_unified.fp16_d256_bs64_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "957c9bee-7547-4bab-b506-140abbc9468f", + "name": "paged_unified.bf16_d256_bs32_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3c9931f9-21d0-428d-8f76-e32dc037f437", + "name": "paged_unified.bf16_d256_bs32_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c6315d7c-ffeb-4044-bb2d-70f1750caaac", + "name": "paged_unified.bf16_d256_bs32_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "24066c6c-3d0d-4f2b-a0b6-dc1e4d5bfda7", + "name": "paged_unified.bf16_d256_bs32_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5ca2be3a-e5f8-4648-87d9-99d6ff67f1ed", + "name": "paged_unified.bf16_d256_bs32_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ab04096b-f010-48b3-b36e-8627c8886cca", + "name": "paged_unified.bf16_d256_bs32_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "af225ce0-ffb2-49f1-89a1-d7ba16860dde", + "name": "paged_unified.bf16_d256_bs32_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2dd351a5-423b-4df1-8336-4ecc03eda518", + "name": "paged_unified.bf16_d256_bs32_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9ec7fce1-7e8e-4620-9d39-58294f3ef76e", + "name": "paged_unified.bf16_d256_bs64_g1_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6fbd0ca5-d80c-4adc-813f-298f0ca90aa9", + "name": "paged_unified.bf16_d256_bs64_g2_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "bbdc3177-e6cf-4507-8117-3dd832e73e05", + "name": "paged_unified.bf16_d256_bs64_g4_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8e8abb1b-d313-4222-9573-aad474735301", + "name": "paged_unified.bf16_d256_bs64_g5_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "33c3dd51-9d4e-428c-ac4d-0781e2df8ee7", + "name": "paged_unified.bf16_d256_bs64_g6_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f210241a-ec69-405c-b20e-646faf09133b", + "name": "paged_unified.bf16_d256_bs64_g7_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "435a5457-0d89-4fef-926b-cdb0cc4640a7", + "name": "paged_unified.bf16_d256_bs64_g8_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ec227a8a-458e-4e01-b910-e09326ff5aa1", + "name": "paged_unified.bf16_d256_bs64_g16_sinks.gfx942", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx942/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true, + "tile_size": 16 + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + } + ], + "arch": [ + "gfx942" + ] +} diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified_gfx950.kdp.json b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified_gfx950.kdp.json new file mode 100644 index 000000000000..ca27d765af80 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/attention_paged_unified_gfx950.kdp.json @@ -0,0 +1,9862 @@ +{ + "version": "1.0", + "id": "1f1678e0-cce5-4d0f-9f98-3b7b9e5a95e6", + "name": "hipkernel:attention_paged_unified_gfx950", + "matchers": [ + "f5baea64-2961-4555-9a77-6576fc1ec21b", + "2af4cb01-70e7-485f-9f09-da2d3aa55fd2" + ], + "engine": "c9af5aa1-86fc-4186-aa3c-307b929710af", + "dispatch": "b4085b75-ea3b-4d38-878d-9998a03e15c7", + "provenance": { + "specialization_contract": { + "schema_version": 1, + "consumers": [ + { + "engine_id": "c9af5aa1-86fc-4186-aa3c-307b929710af", + "kmd_id": "29593010-20c8-41e6-9197-d4d617e1d25b", + "metadata_fields": [ + "dtype", + "head_size", + "block_size", + "num_query_heads", + "num_kv_heads", + "num_warps", + "block_m_per_warp", + "use_sinks" + ], + "matcher_only_fields": [], + "bindings": { + "dtype": { + "field": "dtype" + }, + "head_size": { + "field": "head_size" + }, + "block_size": { + "field": "block_size" + }, + "num_query_heads": { + "field": "num_query_heads" + }, + "num_kv_heads": { + "field": "num_kv_heads" + }, + "num_warps": { + "field": "num_warps" + }, + "block_m_per_warp": { + "field": "block_m_per_warp" + }, + "use_sinks": { + "field": "use_sinks" + } + }, + "vocabulary": { + "dtype": { + "bf16": "BF16", + "fp16": "FP16" + } + } + } + ] + } + }, + "kernelDescriptors": [ + { + "version": "1.0", + "id": "e0e1aa28-a902-47e9-a32a-256b4e0f6e19", + "name": "paged_unified.fp16_d64_bs16_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d603a5f4-b38d-4c94-956f-d1e266f93f00", + "name": "paged_unified.fp16_d64_bs16_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "075e1fd7-75f1-4926-a899-d9b86770f963", + "name": "paged_unified.fp16_d64_bs16_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2486bd1b-be6c-48ab-bac7-13e324f45d47", + "name": "paged_unified.fp16_d64_bs16_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "04df86ad-ba56-49b9-8aed-91f535bc7928", + "name": "paged_unified.fp16_d64_bs16_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "95ce7f9f-c3e7-43f6-b4a4-8a95e2b14b1f", + "name": "paged_unified.fp16_d64_bs16_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d5a4cd73-2493-401f-a084-bb91e65f9612", + "name": "paged_unified.fp16_d64_bs16_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f22afe8d-bf17-4482-86f6-dd96e70f443f", + "name": "paged_unified.fp16_d64_bs16_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e7c89c4a-000a-4a88-9936-237b1a2ae509", + "name": "paged_unified.bf16_d64_bs16_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "63aef063-cba9-41f7-8192-d60563e21d03", + "name": "paged_unified.bf16_d64_bs16_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a447f5eb-3deb-401d-8c1e-f896f95cfa26", + "name": "paged_unified.bf16_d64_bs16_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "54fe06a7-598e-4e41-8734-e49fe1081fcc", + "name": "paged_unified.bf16_d64_bs16_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1ec90bc4-6a59-48a0-a916-f3842f999fd6", + "name": "paged_unified.bf16_d64_bs16_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "03b5b732-ac75-421f-b12d-d94b23507f4b", + "name": "paged_unified.bf16_d64_bs16_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3468bdcd-aaed-4be3-b882-dfc8e9fd5a3d", + "name": "paged_unified.bf16_d64_bs16_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f7011f88-1704-4148-989e-79ae67e35c97", + "name": "paged_unified.bf16_d64_bs16_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0dc1d99a-8b5b-4396-bc60-4dd900b5cabc", + "name": "paged_unified.fp16_d64_bs16_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6721915b-23ff-4d3d-8bc4-78d898b1bbb8", + "name": "paged_unified.fp16_d64_bs16_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "60435a64-58df-4444-be9e-4956666465e8", + "name": "paged_unified.fp16_d64_bs16_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "50043cfa-6593-4dc0-a67d-39b6ea771e88", + "name": "paged_unified.fp16_d64_bs16_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e3c36f8e-b1ef-4a6f-bcb0-4ec6dc588edd", + "name": "paged_unified.fp16_d64_bs16_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b6ec1435-4eef-43c5-b599-50e4044baf39", + "name": "paged_unified.fp16_d64_bs16_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "528241bd-ae98-41c8-9011-3b28ec72cd14", + "name": "paged_unified.fp16_d64_bs16_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "692a90ba-fbac-4c64-b803-98f244797fa4", + "name": "paged_unified.fp16_d64_bs16_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f20f88c7-5c44-449d-a624-5499255bdcbd", + "name": "paged_unified.bf16_d64_bs16_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5e8f2219-c1d7-4949-8d05-9c988cfdfd53", + "name": "paged_unified.bf16_d64_bs16_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f27f04ea-f95d-45b3-b158-e812b10ec53e", + "name": "paged_unified.bf16_d64_bs16_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4e9c0516-1cf8-40f1-8c79-f74fe6d7d099", + "name": "paged_unified.bf16_d64_bs16_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6afe0a80-9307-4d72-bf0d-a14d57c13fef", + "name": "paged_unified.bf16_d64_bs16_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1370a25c-e31d-47df-b0f6-d1e7fbb01495", + "name": "paged_unified.bf16_d64_bs16_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ee476170-632d-46f0-aaef-f8021427eb16", + "name": "paged_unified.bf16_d64_bs16_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c765aaec-68ed-4d2f-b0ba-7fed96c2c7ae", + "name": "paged_unified.bf16_d64_bs16_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 2, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 2, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3c57294e-aa86-4d8e-a977-63836834b3fb", + "name": "paged_unified.fp16_d64_bs32_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6d50865e-ec9f-47af-b1d9-e3cea05e075b", + "name": "paged_unified.fp16_d64_bs32_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "96ce9b03-3d22-4075-82c4-8c6f470308dd", + "name": "paged_unified.fp16_d64_bs32_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "32dc0320-1390-4058-a5aa-7b41a4feb34c", + "name": "paged_unified.fp16_d64_bs32_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7b80b955-5731-42b9-a50f-b0b818068b6c", + "name": "paged_unified.fp16_d64_bs32_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "388eb1ae-26dc-445d-b7c4-beb93c5d24ce", + "name": "paged_unified.fp16_d64_bs32_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a5b94936-29d4-4677-88df-ee64c61c9e33", + "name": "paged_unified.fp16_d64_bs32_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a8c9b734-110c-4002-b81d-abdcd80a726c", + "name": "paged_unified.fp16_d64_bs32_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8b8b5d9f-a4a6-4419-b898-e1a989bfebaa", + "name": "paged_unified.fp16_d64_bs64_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5876e267-e08f-43f1-b288-86674bc939f1", + "name": "paged_unified.fp16_d64_bs64_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2705c668-49f4-436e-8ef4-1bf57fba9cbf", + "name": "paged_unified.fp16_d64_bs64_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "141b573a-62cd-4771-a286-3df9c4632638", + "name": "paged_unified.fp16_d64_bs64_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c65accd0-999f-4a35-a81b-771ca9be1828", + "name": "paged_unified.fp16_d64_bs64_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7f6021f2-0ff2-4688-8ecd-5c483823108a", + "name": "paged_unified.fp16_d64_bs64_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e46d369e-a7d1-40c2-9cce-d54036c0aeda", + "name": "paged_unified.fp16_d64_bs64_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "720796fa-4f4a-4f8e-bdbc-c09578cf37b1", + "name": "paged_unified.fp16_d64_bs64_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d3673551-1e87-4273-a6bc-7f3a03d7075a", + "name": "paged_unified.bf16_d64_bs32_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "41e45ba3-2cf2-464c-b0fe-0fc90cb08c1a", + "name": "paged_unified.bf16_d64_bs32_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "12aba46e-ebf1-4731-8bef-bf89e65e1d18", + "name": "paged_unified.bf16_d64_bs32_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b9217fa4-ff5e-4047-a4c3-dda52c8b0396", + "name": "paged_unified.bf16_d64_bs32_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6b4bfb42-5697-4ade-85d9-27f0d9ff6afd", + "name": "paged_unified.bf16_d64_bs32_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d1529ffe-c165-4d07-8a38-9fcdd1192965", + "name": "paged_unified.bf16_d64_bs32_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b463eb65-5f6d-4e68-bcbb-2ac01cb2fcca", + "name": "paged_unified.bf16_d64_bs32_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f707aade-0291-4874-9333-40f9057b901d", + "name": "paged_unified.bf16_d64_bs32_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "63085891-7778-4a61-94c3-e0a9fa74c121", + "name": "paged_unified.bf16_d64_bs64_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3b13cc9c-d7d0-4c09-b93d-1626e8afac0e", + "name": "paged_unified.bf16_d64_bs64_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f0caa26e-b447-4500-8178-5cc1e2198662", + "name": "paged_unified.bf16_d64_bs64_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0800e3b4-a7a8-480c-aed3-637c9678fbd1", + "name": "paged_unified.bf16_d64_bs64_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e73b9c43-0b14-42b8-941f-bbd12be9c1c7", + "name": "paged_unified.bf16_d64_bs64_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0552bb5f-565d-4691-beee-8bb13599a25c", + "name": "paged_unified.bf16_d64_bs64_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "20a29bf6-de20-4f06-8738-dffd43a0e8dc", + "name": "paged_unified.bf16_d64_bs64_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d53a6276-2868-496f-a389-9b4859449ac2", + "name": "paged_unified.bf16_d64_bs64_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "12440317-17f1-44cc-a36d-8b8cd4f0c589", + "name": "paged_unified.fp16_d64_bs32_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c32349f5-7e93-42fb-8fd4-917b8de4f7ee", + "name": "paged_unified.fp16_d64_bs32_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "dae6804e-3cbe-4e1a-8384-c9e0e1650d46", + "name": "paged_unified.fp16_d64_bs32_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "82c95ba0-cf52-4926-8eb1-ee91b075b9de", + "name": "paged_unified.fp16_d64_bs32_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8a30ef36-9daf-4f40-b49d-56c227211a65", + "name": "paged_unified.fp16_d64_bs32_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0d5b980a-58c9-458f-b760-a5ae9b821f15", + "name": "paged_unified.fp16_d64_bs32_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "03b5ed00-5aa4-48c8-be5e-fcf8b677fe59", + "name": "paged_unified.fp16_d64_bs32_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1d453e07-4586-4470-b253-b1bde75cd50b", + "name": "paged_unified.fp16_d64_bs32_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6b34a6c1-7855-431f-a68c-791bc81365ad", + "name": "paged_unified.fp16_d64_bs64_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "da88c112-cc64-4b05-9710-11e0a66adcba", + "name": "paged_unified.fp16_d64_bs64_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "52d11c06-3bc7-4821-93c9-80d8d08ded00", + "name": "paged_unified.fp16_d64_bs64_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "64613671-244b-45d7-9a7b-05907369f51a", + "name": "paged_unified.fp16_d64_bs64_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ea1565f5-86b2-4507-a9d3-ee8185a20b57", + "name": "paged_unified.fp16_d64_bs64_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b7b9bd84-74d7-4b74-8e1f-114e6d59b741", + "name": "paged_unified.fp16_d64_bs64_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1315548b-e4f5-4f34-b17c-f5afe22f3179", + "name": "paged_unified.fp16_d64_bs64_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f1be7408-f2d4-4681-87c2-cabeaee2d3c2", + "name": "paged_unified.fp16_d64_bs64_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d0d8ab86-561d-4b4d-b359-1613b63b349e", + "name": "paged_unified.bf16_d64_bs32_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4c643ea9-c4fa-43f2-81ae-fb780a8c0f1d", + "name": "paged_unified.bf16_d64_bs32_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a6b9c014-208d-4263-b610-eb4f972e78f6", + "name": "paged_unified.bf16_d64_bs32_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4e9d9f7d-247b-4d55-b384-4674e6ad7135", + "name": "paged_unified.bf16_d64_bs32_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e028f825-139a-4940-bb87-06ad23ca9c0b", + "name": "paged_unified.bf16_d64_bs32_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ada2a3ba-43e7-4917-9428-8899fa9e4e9c", + "name": "paged_unified.bf16_d64_bs32_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2719d454-ce48-4c71-863b-a318584d121f", + "name": "paged_unified.bf16_d64_bs32_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6aee8414-a24e-483f-82a9-de969e66723b", + "name": "paged_unified.bf16_d64_bs32_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "706d75d8-3574-4ffd-8dfb-15a55c43df43", + "name": "paged_unified.bf16_d64_bs64_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "809ceef2-bba9-4d43-970f-444d9d09254d", + "name": "paged_unified.bf16_d64_bs64_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1d5591bc-f11a-4211-98fc-40f1e2f60172", + "name": "paged_unified.bf16_d64_bs64_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ba7d5232-990a-4f40-8e1d-14523f65deaa", + "name": "paged_unified.bf16_d64_bs64_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a47d6581-b8f6-405b-9611-c5aa3c5ce052", + "name": "paged_unified.bf16_d64_bs64_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "84955a53-4042-4a65-bfc2-dca1f57c3290", + "name": "paged_unified.bf16_d64_bs64_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4105ca31-7086-45b2-8223-3213976ebd20", + "name": "paged_unified.bf16_d64_bs64_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0c40b142-92e7-4e46-baa8-4f334b7a284b", + "name": "paged_unified.bf16_d64_bs64_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 64, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5cdd41ab-3aef-45bb-8703-9dcb85cab0ca", + "name": "paged_unified.fp16_d128_bs16_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6cc64843-166e-4bd8-8fbd-51f0d4151236", + "name": "paged_unified.fp16_d128_bs16_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "91d01894-8216-428d-8530-839baaba14a7", + "name": "paged_unified.fp16_d128_bs16_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0a4f89b0-b385-4fe7-93b3-3795d358b0aa", + "name": "paged_unified.fp16_d128_bs16_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ab8c2b08-e5e9-4808-b440-34c73fb76857", + "name": "paged_unified.fp16_d128_bs16_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1d446be9-dce1-44f7-a4a1-f1f763e5a473", + "name": "paged_unified.fp16_d128_bs16_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "58e82185-fdd9-4cd8-b5e5-bef8a18c6184", + "name": "paged_unified.fp16_d128_bs16_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fe2be135-c4e3-4c31-a7a1-1ce826615e97", + "name": "paged_unified.fp16_d128_bs16_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ae667f2a-398f-4756-8c1c-dab9ec357ae5", + "name": "paged_unified.fp16_d128_bs32_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2acc9f68-9c32-46b3-8a24-7fe02eece8b3", + "name": "paged_unified.fp16_d128_bs32_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "50eb5d30-b66a-4c8d-b81d-514109d4ede7", + "name": "paged_unified.fp16_d128_bs32_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c6c5da58-a5a3-4701-bc0d-45893fcf857f", + "name": "paged_unified.fp16_d128_bs32_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "615b49c5-95fc-465d-bf1f-adcbb6897c23", + "name": "paged_unified.fp16_d128_bs32_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6a72e374-f7f0-4271-8d77-4c824a839da9", + "name": "paged_unified.fp16_d128_bs32_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d9c89124-2bd0-4bef-b164-4820bc78dcf5", + "name": "paged_unified.fp16_d128_bs32_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6fe2e2b2-9ba0-47a9-a771-312e8c42443d", + "name": "paged_unified.fp16_d128_bs32_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a8658448-58d9-4a21-af14-c772630b7af5", + "name": "paged_unified.fp16_d128_bs64_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ce4906d8-b10e-4883-9703-d033c650dfcd", + "name": "paged_unified.fp16_d128_bs64_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "65e687fa-7307-47aa-8450-91c648ff04a3", + "name": "paged_unified.fp16_d128_bs64_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "32ef65bd-0c74-406b-8579-4443d1b9ecf5", + "name": "paged_unified.fp16_d128_bs64_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "81ad98d6-542d-4954-aaf2-c4778b6c1a18", + "name": "paged_unified.fp16_d128_bs64_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "87d0050b-4319-4163-9c72-a277e38ec71a", + "name": "paged_unified.fp16_d128_bs64_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "345d5868-b3ec-43e8-bea0-7d21920607da", + "name": "paged_unified.fp16_d128_bs64_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2bdc88d4-6288-4ce6-be67-c264a7c7f416", + "name": "paged_unified.fp16_d128_bs64_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "212e2c5b-a4fa-49be-8591-01bad9ce2e51", + "name": "paged_unified.fp16_d256_bs16_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0e0716c8-916e-4662-8740-8b8f12c7156e", + "name": "paged_unified.fp16_d256_bs16_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c8776003-b78a-49ce-9984-72bf5539347d", + "name": "paged_unified.fp16_d256_bs16_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "12d560a0-3087-4e3e-b463-a534c1144c20", + "name": "paged_unified.fp16_d256_bs16_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3a950075-7baa-4a59-b8b2-2e040fe7726a", + "name": "paged_unified.fp16_d256_bs16_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "57a3c2ca-aefc-4c8c-a82a-805d9d045179", + "name": "paged_unified.fp16_d256_bs16_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cd5fe387-1c55-4259-81f8-96b92fc6dfcf", + "name": "paged_unified.fp16_d256_bs16_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "74c22353-32ce-4987-91d3-f5f93c483290", + "name": "paged_unified.fp16_d256_bs16_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e71e3205-6ddd-4c48-acdc-abdee8ef25a6", + "name": "paged_unified.fp16_d256_bs32_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "83f435ff-c4e1-41eb-b181-653964b5e0a7", + "name": "paged_unified.fp16_d256_bs32_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1211fee3-7b28-4b3f-8281-59a2e8b2e72f", + "name": "paged_unified.fp16_d256_bs32_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "35d744c2-bb64-4b18-a676-ced7fed9c37b", + "name": "paged_unified.fp16_d256_bs32_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "80787923-e0e5-4c81-83dd-9bf0e6bd5245", + "name": "paged_unified.fp16_d256_bs32_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e0250241-14e3-4afe-9b93-a177b9463e72", + "name": "paged_unified.fp16_d256_bs32_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6ea257a0-cb99-4a9a-aeff-25c711d35c1f", + "name": "paged_unified.fp16_d256_bs32_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2abafb51-1dc8-477b-8590-3d3da623682c", + "name": "paged_unified.fp16_d256_bs32_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "367682ef-d49d-402a-8fc5-5c2a8c62ccf3", + "name": "paged_unified.fp16_d256_bs64_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "02811807-31c2-4dde-bd76-a115cad59a14", + "name": "paged_unified.fp16_d256_bs64_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8feb86cd-9438-4df6-b54f-9cf25fa3f61d", + "name": "paged_unified.fp16_d256_bs64_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5fa6ab9c-3b33-4f72-8c20-8f6f71e5cc7b", + "name": "paged_unified.fp16_d256_bs64_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "bc333d48-114b-4562-bbe1-300e2c7546a7", + "name": "paged_unified.fp16_d256_bs64_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e17f0c38-26ee-4ef8-8696-a39b1358ece8", + "name": "paged_unified.fp16_d256_bs64_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "93e6c2ec-1223-44a2-b0f1-a376dda4f3f4", + "name": "paged_unified.fp16_d256_bs64_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5e25702f-6c55-42f8-bdf6-2762c9751a29", + "name": "paged_unified.fp16_d256_bs64_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "258b21d7-84f6-4763-8456-a9f5eef1f0f9", + "name": "paged_unified.bf16_d128_bs16_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7da0b28b-d3e1-42b2-b639-4e6d68a9edfd", + "name": "paged_unified.bf16_d128_bs16_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ed30ea7f-e65a-4cfd-ab85-59f6f434bc4c", + "name": "paged_unified.bf16_d128_bs16_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7edd94cf-1bc0-4ebe-9119-690a7c220a69", + "name": "paged_unified.bf16_d128_bs16_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "cba0a8fa-bedf-4fab-b897-e6ec325982a1", + "name": "paged_unified.bf16_d128_bs16_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0ec0503d-7072-4601-a1f3-4f3d9f034adc", + "name": "paged_unified.bf16_d128_bs16_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9bf7d181-7aad-4890-be52-98717c69a02c", + "name": "paged_unified.bf16_d128_bs16_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "82f69d9c-31ef-48d2-bd8c-0a3222e0f44a", + "name": "paged_unified.bf16_d128_bs16_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "699fd5c5-2c5f-4bdc-aa76-a358ef187fea", + "name": "paged_unified.bf16_d128_bs32_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a7662c5f-4864-4eae-a627-96016eeae194", + "name": "paged_unified.bf16_d128_bs32_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2ee0cd45-4b51-4727-98b0-b9dbefe6ee38", + "name": "paged_unified.bf16_d128_bs32_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4b724bcf-57ef-43e2-9033-106094af8a8c", + "name": "paged_unified.bf16_d128_bs32_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "24b9c183-75d9-48bd-8ffe-c30558a6e6a7", + "name": "paged_unified.bf16_d128_bs32_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5fccd6f1-e517-40f9-bdcd-68d19f1413f1", + "name": "paged_unified.bf16_d128_bs32_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8d227a60-c5c8-461a-9199-06b114559418", + "name": "paged_unified.bf16_d128_bs32_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "69e2888d-bf79-4b0f-9ced-9b1b5bcde74b", + "name": "paged_unified.bf16_d128_bs32_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "075fcfd4-a09d-4e07-8ada-d25091b84ec0", + "name": "paged_unified.bf16_d128_bs64_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2247b974-9cc4-4acb-9541-b891a71001fb", + "name": "paged_unified.bf16_d128_bs64_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3d9e1e93-287c-43b8-8ae0-0288c521457d", + "name": "paged_unified.bf16_d128_bs64_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6ff9caa4-a548-4a28-8c36-20b79334724e", + "name": "paged_unified.bf16_d128_bs64_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2ff04cdc-827b-4bdb-80bf-1b1f00381986", + "name": "paged_unified.bf16_d128_bs64_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "02f9702a-a0df-4acf-93f6-cea88ee1d62e", + "name": "paged_unified.bf16_d128_bs64_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a97cf320-07f7-45f4-8ec7-b5e43dfb5494", + "name": "paged_unified.bf16_d128_bs64_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4aa3f44b-7d26-4570-b0d0-56af35a46aa0", + "name": "paged_unified.bf16_d128_bs64_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5dcbc493-fd56-4e70-8d1b-8be3578d0a64", + "name": "paged_unified.bf16_d256_bs16_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1b167790-ad72-43e9-b69d-39d2d03e2982", + "name": "paged_unified.bf16_d256_bs16_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "43259880-c763-4787-8c99-e7c97cab2ed1", + "name": "paged_unified.bf16_d256_bs16_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "eb8c6681-9561-454c-a31c-aac0af6afea3", + "name": "paged_unified.bf16_d256_bs16_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d19948cb-313c-4c5a-b955-456dd822405b", + "name": "paged_unified.bf16_d256_bs16_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a08db64c-9962-4abc-87b6-00f8fc3073a0", + "name": "paged_unified.bf16_d256_bs16_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f635af58-729f-4c9f-b8ed-70c4857378e8", + "name": "paged_unified.bf16_d256_bs16_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7e358fe4-43f0-46d7-8be0-4660c77247b0", + "name": "paged_unified.bf16_d256_bs16_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8352754f-ece1-4ba6-9c35-398768cf41b7", + "name": "paged_unified.bf16_d256_bs32_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5885853c-e7c6-4834-b065-25d49a139056", + "name": "paged_unified.bf16_d256_bs32_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6729cecc-1077-4605-9695-b8dfb3843526", + "name": "paged_unified.bf16_d256_bs32_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "45eae18e-aac5-460b-a1dd-615b433ca8eb", + "name": "paged_unified.bf16_d256_bs32_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "723d1174-3d03-4a21-98aa-4d4c3cc5fabc", + "name": "paged_unified.bf16_d256_bs32_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5c4e2d08-0659-4131-8125-b217367e338a", + "name": "paged_unified.bf16_d256_bs32_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2aab1fe6-4b4a-4e67-972f-cad674985bc4", + "name": "paged_unified.bf16_d256_bs32_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "de53e03a-fbcc-405a-84f8-a42f071fe89c", + "name": "paged_unified.bf16_d256_bs32_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b553b247-2f2b-4b24-8d18-2e038d353462", + "name": "paged_unified.bf16_d256_bs64_g1.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e666ef18-dfd2-4112-8859-b78f0c2a47e0", + "name": "paged_unified.bf16_d256_bs64_g2.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3ccdbb49-02c7-4f0d-a20d-d50f31a01528", + "name": "paged_unified.bf16_d256_bs64_g4.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9564ff74-d7b3-452d-bfa1-1098adbdf84c", + "name": "paged_unified.bf16_d256_bs64_g5.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4718b8a9-1eaa-46f9-a7ef-906f07358d1b", + "name": "paged_unified.bf16_d256_bs64_g6.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "914620ee-0cbe-48c2-8b89-946a28cdfe47", + "name": "paged_unified.bf16_d256_bs64_g7.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d7d550e4-1012-4034-9dda-0cd4f82a4f60", + "name": "paged_unified.bf16_d256_bs64_g8.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5fe3a4a9-7cdc-4855-bf39-7c0b3a1aff30", + "name": "paged_unified.bf16_d256_bs64_g16.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": false, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 0 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e844e222-fda1-4e63-9167-3df83a93b6dc", + "name": "paged_unified.fp16_d128_bs16_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9a9a95dc-5691-4491-b4d5-85b16f639ec8", + "name": "paged_unified.fp16_d128_bs16_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "af215415-ea10-48b1-b328-2cb6b2f711fd", + "name": "paged_unified.fp16_d128_bs16_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "56629518-d001-462b-b4cb-0c285e6d591b", + "name": "paged_unified.fp16_d128_bs16_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ae440598-438f-4e6e-b6a8-74ab902eb334", + "name": "paged_unified.fp16_d128_bs16_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "116b9d24-bac6-4c20-ab81-eefa0ea7d4c5", + "name": "paged_unified.fp16_d128_bs16_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ff96e248-2cfc-4f38-99db-cd428ba4657e", + "name": "paged_unified.fp16_d128_bs16_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e1342693-4a88-46be-8653-b2a55a936173", + "name": "paged_unified.fp16_d128_bs16_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "eb0eb5ff-b6b9-4fa5-9995-e5ac7627af0c", + "name": "paged_unified.fp16_d128_bs32_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "91ab8558-57cb-4a4d-866e-b362d35463d3", + "name": "paged_unified.fp16_d128_bs32_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "83e1a4af-8251-4b50-a65c-f2f2fd73aea2", + "name": "paged_unified.fp16_d128_bs32_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4e4c8aa2-a935-4588-9490-9d505090aa25", + "name": "paged_unified.fp16_d128_bs32_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ad864973-ec16-442f-b4f4-f9c983e05f02", + "name": "paged_unified.fp16_d128_bs32_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "efe6bd36-41ba-4956-944d-101d1a45cba9", + "name": "paged_unified.fp16_d128_bs32_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "40a66932-a4a5-4ca5-871f-7f8c62606555", + "name": "paged_unified.fp16_d128_bs32_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "11f74e11-5f00-46ab-97af-5ef67f6c3f00", + "name": "paged_unified.fp16_d128_bs32_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "a2fbc98a-99f3-4060-a752-c01bd931e0db", + "name": "paged_unified.fp16_d128_bs64_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0f775342-3bcb-4ec5-b685-4a26de6bb2bf", + "name": "paged_unified.fp16_d128_bs64_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e934153b-b5ce-41c6-985d-c2313557d519", + "name": "paged_unified.fp16_d128_bs64_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6c6261b6-e36e-42ca-8543-69f42d74ee3f", + "name": "paged_unified.fp16_d128_bs64_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "938c45a1-54da-4ad5-abbe-abd43ab819ab", + "name": "paged_unified.fp16_d128_bs64_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b4707cf4-f401-4ea3-8e0a-17222e3030a3", + "name": "paged_unified.fp16_d128_bs64_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0c00339e-79d0-47d4-9fa3-b1763f27c77f", + "name": "paged_unified.fp16_d128_bs64_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "baa29877-ec6e-4735-ba2f-f54a97b5702e", + "name": "paged_unified.fp16_d128_bs64_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c7608c8e-a07b-481a-bd07-ba030694903c", + "name": "paged_unified.fp16_d256_bs16_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e100047c-b226-450d-a5d6-a167c9eefaa4", + "name": "paged_unified.fp16_d256_bs16_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "035a6305-9244-427a-85fb-dee1510ff99a", + "name": "paged_unified.fp16_d256_bs16_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "db233623-3387-4578-a817-2640f2bdc45d", + "name": "paged_unified.fp16_d256_bs16_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1c0bce3e-305c-4734-866f-0b289a6d3fea", + "name": "paged_unified.fp16_d256_bs16_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "64a69a8b-861b-407e-b04d-eb18d27a2d53", + "name": "paged_unified.fp16_d256_bs16_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ec18c330-c4a4-4d1a-8850-0ad1af4b8cdd", + "name": "paged_unified.fp16_d256_bs16_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9c3ce9d0-761d-402a-a26b-49381c0ea255", + "name": "paged_unified.fp16_d256_bs16_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "38079942-e482-4e7d-b533-a27995b2919c", + "name": "paged_unified.fp16_d256_bs32_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "72d24053-faa4-4161-8632-110da1f8fab3", + "name": "paged_unified.fp16_d256_bs32_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6750c8f4-3551-4f28-a728-ee4fad0f5eb1", + "name": "paged_unified.fp16_d256_bs32_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3d9b40ff-9d64-4b19-9635-6dfc8e0c9969", + "name": "paged_unified.fp16_d256_bs32_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1e601534-84ab-4fd2-a572-1fca16c855c0", + "name": "paged_unified.fp16_d256_bs32_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "bc9ae7fc-59a6-40bb-b53b-24221cec3694", + "name": "paged_unified.fp16_d256_bs32_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f66b49ea-06ed-484b-8879-6756d6ce50ba", + "name": "paged_unified.fp16_d256_bs32_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b94c3cf2-fe26-41ec-8269-ce61965f4529", + "name": "paged_unified.fp16_d256_bs32_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "18211d4f-d439-4218-afbb-fddfb986df70", + "name": "paged_unified.fp16_d256_bs64_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8ca864ed-4047-484d-aed7-de8cb63e1381", + "name": "paged_unified.fp16_d256_bs64_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e99d93ec-eae0-4399-8492-0f167cc16c04", + "name": "paged_unified.fp16_d256_bs64_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "3c1f8de5-bc59-4e3b-860f-7aaea7a20491", + "name": "paged_unified.fp16_d256_bs64_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "442764ad-1c9e-431e-9a77-efeba4ca5c19", + "name": "paged_unified.fp16_d256_bs64_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9b5b7968-735f-44f4-9b0b-32b500c64791", + "name": "paged_unified.fp16_d256_bs64_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b4f828e0-bee7-47ca-ac3f-d07cf14800f6", + "name": "paged_unified.fp16_d256_bs64_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c082ece0-0195-4fa8-8475-f4f06c289c17", + "name": "paged_unified.fp16_d256_bs64_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "fp16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "FP16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "05c0b2eb-1dc1-49e0-86b8-30f14ac50e70", + "name": "paged_unified.bf16_d128_bs16_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f041932d-1319-46ee-b849-ac998b968549", + "name": "paged_unified.bf16_d128_bs16_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "c0f349ee-2312-4f91-b1c9-2aa87b91c9b6", + "name": "paged_unified.bf16_d128_bs16_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1b81da4f-a2b3-499f-9cb7-314e66a8f4e9", + "name": "paged_unified.bf16_d128_bs16_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b98c4db3-d791-4ca0-b36f-e5e552bad295", + "name": "paged_unified.bf16_d128_bs16_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "8888ed47-a2f5-43e0-83c9-93d0cde5abc9", + "name": "paged_unified.bf16_d128_bs16_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "23b957b9-0932-4cd8-9170-20eb7c27990b", + "name": "paged_unified.bf16_d128_bs16_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "51a39f22-fc1c-4104-a40b-8500de70e7f9", + "name": "paged_unified.bf16_d128_bs16_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "f12100e9-808a-4b74-8101-b57d755f3a4e", + "name": "paged_unified.bf16_d128_bs32_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "b1996edd-e76f-4fc8-8f6a-ae121dc1eee8", + "name": "paged_unified.bf16_d128_bs32_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "9328c68e-1736-4f89-bf6f-d280475c4dac", + "name": "paged_unified.bf16_d128_bs32_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "87bdccca-234d-4870-8b6d-ba51b425fbf6", + "name": "paged_unified.bf16_d128_bs32_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d8940312-3258-4fac-9b66-a37f1f51b082", + "name": "paged_unified.bf16_d128_bs32_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "ccc90587-5fc9-416f-9619-9a9d766833b4", + "name": "paged_unified.bf16_d128_bs32_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1d92b44a-3e12-4961-939e-9773abfca8c8", + "name": "paged_unified.bf16_d128_bs32_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "20251b39-b963-407b-98f7-3ec2158a2bdf", + "name": "paged_unified.bf16_d128_bs32_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "449fa76d-deca-41b2-8526-f24aee541ece", + "name": "paged_unified.bf16_d128_bs64_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7ec7bb17-b972-4c19-abe6-206d7bc80ec7", + "name": "paged_unified.bf16_d128_bs64_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "6e96ab15-b837-4ee3-a346-2f4c58fde7f1", + "name": "paged_unified.bf16_d128_bs64_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5c5a7183-8fe6-4dc7-b15a-02ba113761ba", + "name": "paged_unified.bf16_d128_bs64_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0d659623-8134-424e-bbdd-5ac14cfd3e07", + "name": "paged_unified.bf16_d128_bs64_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d6d448f1-2cd5-477b-9170-14c7d3924297", + "name": "paged_unified.bf16_d128_bs64_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "52c3f980-f84f-4d74-b97c-fe937c96e945", + "name": "paged_unified.bf16_d128_bs64_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "1a4eea2d-de9e-40e9-ba93-23fb844b4786", + "name": "paged_unified.bf16_d128_bs64_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 128, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4983b6c1-6cfc-4420-99b8-8c4a05aa3c55", + "name": "paged_unified.bf16_d256_bs16_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "44d7e2ff-cbb5-4de5-b7b6-f593b19e269d", + "name": "paged_unified.bf16_d256_bs16_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "86dc3722-d408-48ee-ba54-d4fb42ceb8af", + "name": "paged_unified.bf16_d256_bs16_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "2c17aca7-9c7a-4c44-96c8-f1d16c295f98", + "name": "paged_unified.bf16_d256_bs16_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fd400ebf-7d25-4d57-b55d-9564765d2160", + "name": "paged_unified.bf16_d256_bs16_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4f5c6fac-da5c-409c-942b-1aa1d8d40284", + "name": "paged_unified.bf16_d256_bs16_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "d3b041b7-a683-402e-87b4-536cfbd76251", + "name": "paged_unified.bf16_d256_bs16_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "04efc7d1-010e-45d3-9e88-52d7c308d32e", + "name": "paged_unified.bf16_d256_bs16_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 16, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "90b6f347-cd9d-4d91-90a3-dc7592012943", + "name": "paged_unified.bf16_d256_bs32_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "faeb0789-8146-431c-880f-1aaa920f69d0", + "name": "paged_unified.bf16_d256_bs32_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "64eabbc8-a1c6-42ec-8dcb-746357fff8de", + "name": "paged_unified.bf16_d256_bs32_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "38271b5f-95df-4fab-b408-b57da2dad248", + "name": "paged_unified.bf16_d256_bs32_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "84cb5767-354a-4469-92ba-433d377fc427", + "name": "paged_unified.bf16_d256_bs32_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "e1a5e31e-63dd-473d-9426-75f08c9ddafd", + "name": "paged_unified.bf16_d256_bs32_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "5c8c48bd-25cd-42b7-96a5-adb3eb23b218", + "name": "paged_unified.bf16_d256_bs32_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "0aca895c-33a5-49c9-b89c-ab279aa89f14", + "name": "paged_unified.bf16_d256_bs32_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 32, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fb665e60-5533-4fee-8740-807de889385e", + "name": "paged_unified.bf16_d256_bs64_g1_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 1, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "4aab3b6f-6a75-4672-8cca-894a31e8fe00", + "name": "paged_unified.bf16_d256_bs64_g2_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 2, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "45b49374-8789-4eaa-b8a6-bdc54886e62b", + "name": "paged_unified.bf16_d256_bs64_g4_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 4, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "90e10f52-50b3-482e-bcda-a3c66d039186", + "name": "paged_unified.bf16_d256_bs64_g5_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 5, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "fa7370b2-51e0-4be3-b225-98e9c5bd0969", + "name": "paged_unified.bf16_d256_bs64_g6_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 6, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "7b822301-b1b5-4a2a-b86d-f0aabcd8d63f", + "name": "paged_unified.bf16_d256_bs64_g7_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 7, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "66d52692-5429-41ad-bb0e-56eb2f5d2511", + "name": "paged_unified.bf16_d256_bs64_g8_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 8, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + }, + { + "version": "1.0", + "id": "212cd820-c660-4500-a8ac-bcf127682126", + "name": "paged_unified.bf16_d256_bs64_g16_sinks.gfx950", + "kernel_source": { + "kind": "rocke", + "source": "kernels/gfx950/attention_tiled_2d.py", + "builder": "build_unified_attention_2d_tiled", + "spec": { + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "dtype": "bf16", + "use_sinks": true, + "sliding_window": 0, + "has_softcap": false, + "num_warps": 4, + "block_m_per_warp": 16, + "runtime_layout": true + } + }, + "metadata": { + "dtype": "BF16", + "head_size": 256, + "block_size": 64, + "num_query_heads": 16, + "num_kv_heads": 1, + "num_warps": 4, + "block_m_per_warp": 16, + "use_sinks": 1 + }, + "priority": 0 + } + ], + "arch": [ + "gfx950" + ] +} diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/kernel_dtype_matches_graph.umd.json b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/kernel_dtype_matches_graph.umd.json new file mode 100644 index 000000000000..0d79bf340adc --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/kernel_dtype_matches_graph.umd.json @@ -0,0 +1,7 @@ +{ + "version": "1.0", + "id": "2af4cb01-70e7-485f-9f09-da2d3aa55fd2", + "name": "kernel dtype matches the graph's dtype", + "scope": "kernel", + "match_symbol": "hipkernel.attention_paged_unified.kernel_match" +} diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/operation_is_gfx942.umd.json b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/operation_is_gfx942.umd.json new file mode 100644 index 000000000000..50ec32498c50 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/operation_is_gfx942.umd.json @@ -0,0 +1,7 @@ +{ + "version": "1.0", + "id": "cb28d2d1-dbfc-43cf-92bf-b2c1b6fc0f90", + "name": "graph operation is gfx942", + "scope": "graph", + "match_symbol": "hipkernel.attention_paged_unified.gfx942_match" +} diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/operation_is_gfx950.umd.json b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/operation_is_gfx950.umd.json new file mode 100644 index 000000000000..b993726b3b99 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/descriptors/rocKE/attention_paged_unified/operation_is_gfx950.umd.json @@ -0,0 +1,7 @@ +{ + "version": "1.0", + "id": "f5baea64-2961-4555-9a77-6576fc1ec21b", + "name": "graph operation is gfx950", + "scope": "graph", + "match_symbol": "hipkernel.attention_paged_unified.gfx950_match" +} diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedLaunchValues.hpp b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedLaunchValues.hpp new file mode 100644 index 000000000000..064b50f2c992 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedLaunchValues.hpp @@ -0,0 +1,157 @@ +// Copyright © Advanced Micro Devices, Inc., or its affiliates. +// SPDX-License-Identifier: MIT + +#pragma once + +#ifdef HIPDNN_ENABLE_KERNEL_INGESTOR + +#include +#include + +#include +#include + +/** + * @file AttentionPagedUnifiedLaunchValues.hpp + * @brief The launch state of the hipkernel:AttentionPagedUnified pack, and its saved form: + * a versioned dispatch name and the named, typed values the launch is computed from. + * The pack also reads its saved form back into its launch inputs. + * + * The launch is one kernel with no workspace. Lengths, page tables, offsets and sinks are + * device buffers bound by uid at execute, so the uids, the by-value kernel arguments and + * the CTA size are the whole launch state. + * + * The version in the dispatch name identifies the contract between the saved values and + * the launch. Use a new version for a change to any of these: + * - the names, types or meanings of the values. + * - the kernel arguments the launch passes: their order, count, kinds, sizes or meanings. + * - how the launch derives grid or block from the values. + * Keep the handler of the old version registered while plans saved under it must load. + */ +namespace hip_kernel_provider::kernel_ingestor_engine +{ + +/// Contract v1: the runtime_layout tiled 2D kernel signature. New plans are saved under it. +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_DISPATCH_SYMBOL_V1 + = "hipkernel.attention_paged_unified.dispatch.v1"; + +/// The uid an absent optional operand (ragged offset, sink) saves as. +inline constexpr int64_t ATTENTION_PAGED_UNIFIED_NO_UID = -1; + +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_Q_UID_VALUE = "q.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_K_UID_VALUE = "k.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_V_UID_VALUE = "v.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_O_UID_VALUE = "o.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_PAGE_TABLE_K_UID_VALUE + = "page_table_k.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_PAGE_TABLE_V_UID_VALUE + = "page_table_v.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_SEQ_LEN_KV_UID_VALUE = "seq_len_kv.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_SEQ_LEN_Q_UID_VALUE = "seq_len_q.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_RAGGED_OFFSET_UID_VALUE + = "ragged_offset.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_SINK_UID_VALUE = "sink.uid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_SCALE_VALUE = "scale"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_NUM_SEQS_VALUE = "num_seqs"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_BLOCK_TABLE_STRIDE_VALUE + = "block_table_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_NUM_QUERY_HEADS_VALUE = "num_query_heads"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_NUM_KV_HEADS_VALUE = "num_kv_heads"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_SLIDING_WINDOW_VALUE = "sliding_window"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_Q_UNIFORM_LEN_VALUE = "q_uniform_len"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_Q_SEQ_STRIDE_VALUE = "q_seq_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_Q_TOK_STRIDE_VALUE = "q_tok_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_Q_HEAD_STRIDE_VALUE = "q_head_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_O_SEQ_STRIDE_VALUE = "o_seq_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_O_TOK_STRIDE_VALUE = "o_tok_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_O_HEAD_STRIDE_VALUE = "o_head_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_KV_BLOCK_STRIDE_VALUE = "kv_block_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_KV_TOK_STRIDE_VALUE = "kv_tok_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_KV_HEAD_STRIDE_VALUE = "kv_head_stride"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_KV_BLOCK_SPAN_BYTES_VALUE + = "kv_block_span_bytes"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_Q_BLOCK_GRID_VALUE = "q_block_grid"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_SINK_IS_F32_VALUE = "sink_is_f32"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_NUM_KV_BLOCKS_VALUE = "num_kv_blocks"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_BLOCK_TABLE_WIDTH_VALUE + = "block_table_width"; +inline constexpr std::string_view ATTENTION_PAGED_UNIFIED_BLOCK_THREADS_VALUE = "block_threads"; + +/// The tensor uids a launch binds to device buffers. raggedOffset is NO_UID for a dense Q; +/// sink is NO_UID without attention sinks. pageTableK == pageTableV when one table pages +/// both K and V. +struct AttentionPagedUnifiedUids +{ + int64_t q = 0; + int64_t k = 0; + int64_t v = 0; + int64_t o = 0; + int64_t pageTableK = 0; + int64_t pageTableV = 0; + int64_t seqLenKv = 0; + int64_t seqLenQ = 0; + int64_t raggedOffset = ATTENTION_PAGED_UNIFIED_NO_UID; + int64_t sink = ATTENTION_PAGED_UNIFIED_NO_UID; +}; + +/// Q's or O's strides, in elements. seqStride is the batch stride of a dense operand and +/// the ragged-offset multiplier of a ragged one. +struct AttentionPagedUnifiedQueryStrides +{ + int32_t seqStride = 0; + int32_t tokenStride = 0; + int32_t headStride = 0; +}; + +/// Every by-value kernel argument the launch varies. +struct AttentionPagedUnifiedScalars +{ + float scale = 0.0F; + int32_t numSeqs = 0; + int32_t blockTableStride = 0; + int32_t numQueryHeads = 0; + int32_t numKvHeads = 0; + int32_t slidingWindow = 0; + int32_t qUniformLen = 0; ///< query rows per sequence of a dense Q; 0 for a ragged Q + AttentionPagedUnifiedQueryStrides q; + AttentionPagedUnifiedQueryStrides o; + int32_t kvBlockStride = 0; + int32_t kvTokStride = 0; + int32_t kvHeadStride = 0; + int32_t kvBlockSpanBytes = 0; + int32_t qBlockGrid = 0; + int32_t sinkIsF32 = 0; ///< 1: the sink is FLOAT; 0: in the Q data type, or no sink + int32_t numKvBlocks + = 0; ///< the K/V container's block count; a page id at or past it reads as masked + int32_t blockTableWidth = 0; ///< the page tables' row width M; a length is capped at M * block +}; + +/// Everything a launch is computed from: block = (blockThreads, 1, 1) and +/// grid = (numKvHeads, qBlockGrid, 1). +struct AttentionPagedUnifiedLaunchInputs +{ + AttentionPagedUnifiedUids uids; + AttentionPagedUnifiedScalars scalars; + int32_t blockThreads = 0; +}; + +/// The values of the `hipkernel.attention_paged_unified.dispatch.v1` contract. `scale` is +/// stored as a double, which holds every float exactly; every other value is an int. +hipdnn_plugin_sdk::ingestor::MetadataValues + attentionPagedUnifiedLaunchValues(const AttentionPagedUnifiedLaunchInputs& launch); + +/// Reads the values of the `hipkernel.attention_paged_unified.dispatch.v1` contract. Each +/// value must be in the range the kernel takes (int32, positive where the kernel divides +/// by it or indexes with it), `scale` must be a finite float stored exactly, the head +/// counts must divide, a dense Q needs `q_uniform_len` >= 1 and a ragged one 0, +/// `sink_is_f32` must be 0 or 1, `num_kv_blocks` and `block_table_width` must be positive, +/// and `block_threads` must be a whole number of waves. +/// +/// @throws HipdnnPluginException with a load refusal when the dispatch name is not the +/// contract, or when a value is missing, extra, of another type or out of range. +AttentionPagedUnifiedLaunchInputs readAttentionPagedUnifiedLaunchInputs( + const hipdnn_plugin_sdk::ingestor::SavedLaunchInputs& inputs); + +} // namespace hip_kernel_provider::kernel_ingestor_engine + +#endif // HIPDNN_ENABLE_KERNEL_INGESTOR diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedNative.cpp b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedNative.cpp new file mode 100644 index 000000000000..255b1187506e --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedNative.cpp @@ -0,0 +1,1403 @@ +// Copyright © Advanced Micro Devices, Inc., or its affiliates. +// SPDX-License-Identifier: MIT + +#ifdef HIPDNN_ENABLE_KERNEL_INGESTOR + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "compilation/KpackKernelLoader.hpp" +#include "compilation/KpackModuleCache.hpp" +#include "core/Handle.hpp" +#include "engines/asm_sdpa_engine/plans/SdpaPlanUtils.hpp" +#include "engines/kernel_ingestor_engine/IngestorKernelCode.hpp" +#include "engines/kernel_ingestor_engine/IngestorLaunchRestore.hpp" +#include "engines/kernel_ingestor_engine/IngestorPacks.hpp" +#include "engines/kernel_ingestor_engine/IngestorPreparedDispatch.hpp" +#include "engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedLaunchValues.hpp" +#include "engines/kernel_ingestor_engine/packs/AttentionTiled2DSignature.hpp" +#include "engines/kernel_ingestor_engine/packs/SdpaGraphMatch.hpp" + +/** + * @file AttentionPagedUnifiedNative.cpp + * @brief The hipkernel:AttentionPagedUnified engine's native half: matching and dispatch. + * + * The kernels are rocKE's tiled 2D unified-attention builders + * (`rocke/library/kernels/{gfx942,gfx950}/attention_tiled_2d.py`, + * `build_unified_attention_2d_tiled`) built with `runtime_layout=True`, packaged + * (kind: rocke -> kpack) per architecture. Every tiled 2D body takes the head counts + * and the sliding window as launch arguments; in that mode the kernel also takes every + * Q/O/K/V stride and the batch's query layout (dense or ragged), and reads the graph's + * real page table and sequence lengths from device memory. One object therefore serves + * every shape with the same (dtype, head_size, block_size, queries_per_kv), and one + * plan serves every step of a serving loop: actual lengths and block ids are only ever read on the + * device, so execute performs no host synchronization and no allocation. + * + * Graphs served (cuDNN paged-attention semantics, SdpaSemanticsRegister SEM-008/009/010): + * - Q `[B, Hq, Sq, D]`, either dense with arbitrary strides (uniform decode, Sq rows per + * sequence) or ragged at the sequence axis through an INT32 `[B+1,1,1,1]` + * `ragged_offset` shared with O, in vLLM's query_start_loc layout (non-decreasing + * origins, off[b+1] - off[b] >= seq_len_q[b], off[B] the end of the last block): the + * kernel binary-searches the offsets. RFC 0014 also allows other orders, which no graph + * attribute shows; + * - paged K and V containers `[num_blocks, Hkv, block_size, D]` with arbitrary (equal) + * strides, including the interleaved K|V view of one cache allocation; + * - INT32 page tables `[B, 1, M, 1]`, not packed: one tensor for K and V, or separate + * `page_table_k` and `page_table_v` tensors with the same M and batch stride (the + * kernel reads K through block_tables_ptr and V through block_tables_v_ptr); + * - INT32 `seq_len_q` and `seq_len_kv` `[B,1,1,1]` (a paged graph carries both); a dense + * Q's rows past seq_len_q[b] get O = 0, and a ragged Q writes only its live rows; + * - `max_seq_len_kv` set or unset: the kernel reads only seq_len_kv, and the extent cuDNN + * infers for an unset one (M * block_size) bounds it the same way; + * - bottom-right causal masking with an optional left bound (sliding window); + * - an optional attention sink `sink_token` `[1, Hq, 1, 1]` with a unit head stride, + * served by the use_sinks objects: FLOAT (cuDNN's form) or in the Q/K/V/O data type + * (vLLM keeps sinks in the model dtype). The launch tells the kernel which. + * + * One-sided paging, K and V page tables of different widths or batch strides, differing + * K and V block sizes, packed page tables and a declared alignment below what the kernels + * load (16 bytes for Q/K/V/O and the sink, 4 for the INT32 operands) are valid graphs that + * this engine declines with a logged cause. + * + * The device-read inputs (page ids, lengths, ragged offsets) cannot be checked on the host + * at execute without a device-to-host copy, which would break HIP graph capture, so the + * kernels contain them: a page id outside `[0, num_kv_blocks)` reads as a masked page (a + * zero-size buffer resource at block 0), and `seq_len_kv[b]` is bounded by the page-table + * row's extent `M * block_size`. Such a graph computes a wrong answer for that sequence; + * it never reads or writes outside the cache or the table (README, "Device-read inputs"). + */ +namespace hip_kernel_provider::kernel_ingestor_engine +{ + +using namespace hipdnn_plugin_sdk::ingestor; +namespace data_objects = hipdnn_flatbuffers_sdk::data_objects; + +namespace +{ + +// The contract with the installed descriptor files, which restate these same strings. +constexpr std::string_view GRAPH_MATCHER_SYMBOL = "hipkernel.attention_paged_unified.graph_match"; +constexpr std::string_view KERNEL_MATCHER_SYMBOL = "hipkernel.attention_paged_unified.kernel_match"; +constexpr std::string_view DISPATCH_SYMBOL = "hipkernel.attention_paged_unified.dispatch"; +constexpr std::string_view GFX942_MATCHER_SYMBOL = "hipkernel.attention_paged_unified.gfx942_match"; +constexpr std::string_view GFX950_MATCHER_SYMBOL = "hipkernel.attention_paged_unified.gfx950_match"; + +// KMD fields. The catalog builds every kernel with num_kv_heads = 1 (head counts are +// launch arguments), so its num_query_heads field IS the queries-per-KV-head ratio. +constexpr std::string_view DTYPE_FIELD = "dtype"; +constexpr std::string_view HEAD_SIZE_FIELD = "head_size"; +constexpr std::string_view BLOCK_SIZE_FIELD = "block_size"; +constexpr std::string_view NUM_QUERY_HEADS_FIELD = "num_query_heads"; +constexpr std::string_view NUM_KV_HEADS_FIELD = "num_kv_heads"; +constexpr std::string_view NUM_WARPS_FIELD = "num_warps"; +constexpr std::string_view BLOCK_M_PER_WARP_FIELD = "block_m_per_warp"; +/// 1 for an object built with use_sinks (it reads sink_ptr), 0 (the KMD default) otherwise. +constexpr std::string_view USE_SINKS_FIELD = "use_sinks"; + +// Bound tokens. +constexpr std::string_view Q_TOKEN = "attention_paged_unified.q.uid"; +constexpr std::string_view K_TOKEN = "attention_paged_unified.k.uid"; +constexpr std::string_view V_TOKEN = "attention_paged_unified.v.uid"; +constexpr std::string_view O_TOKEN = "attention_paged_unified.o.uid"; +/// UIDs of page_table_k and page_table_v (equal when one tensor pages both). +constexpr std::string_view PAGE_TABLE_K_TOKEN = "attention_paged_unified.page_table_k.uid"; +constexpr std::string_view PAGE_TABLE_V_TOKEN = "attention_paged_unified.page_table_v.uid"; +constexpr std::string_view SEQ_LEN_KV_TOKEN = "attention_paged_unified.seq_len_kv.uid"; +/// UID of seq_len_q. +constexpr std::string_view SEQ_LEN_Q_TOKEN = "attention_paged_unified.seq_len_q.uid"; +/// UID of the ragged offset table Q and O share, or ATTENTION_PAGED_UNIFIED_NO_UID for a +/// dense Q. +constexpr std::string_view RAGGED_OFFSET_TOKEN = "attention_paged_unified.ragged_offset.uid"; +/// UID of the sink_token tensor, or ATTENTION_PAGED_UNIFIED_NO_UID. +constexpr std::string_view SINK_TOKEN = "attention_paged_unified.sink.uid"; +/// 1 for a FLOAT sink_token, 0 for one in the Q data type (or no sink). +constexpr std::string_view SINK_IS_F32_TOKEN = "attention_paged_unified.sink_is_f32"; +constexpr std::string_view SCALE_BITS_TOKEN = "attention_paged_unified.scale_bits"; +/// The kernel's sliding_window argument: `d - k < window` keeps key k for diagonal d. +constexpr std::string_view WINDOW_TOKEN = "attention_paged_unified.window"; +constexpr std::string_view DTYPE_TOKEN = "attention_paged_unified.dtype"; +constexpr std::string_view HEAD_SIZE_TOKEN = "attention_paged_unified.head_size"; +constexpr std::string_view BLOCK_SIZE_TOKEN = "attention_paged_unified.block_size"; +constexpr std::string_view QUERIES_PER_KV_TOKEN = "attention_paged_unified.queries_per_kv"; + +/// Integer codes for the bound dtype. +constexpr int64_t DTYPE_FP16 = 1; +constexpr int64_t DTYPE_BF16 = 2; + +/// The window the kernel receives when the graph has no left bound: wider than any +/// sequence the int32 positions can describe, so it never masks. +constexpr int64_t NO_WINDOW = 0x3FFFFFFF; + +// hipDNN tensor axes (sdpa_graph): the LOGICAL order is always (B, H, S, D) regardless of +// layout; a paged container's B axis is the block index and its S axis the token within a +// block. +using sdpa_graph::BATCH_AXIS; +using sdpa_graph::HEAD_AXIS; +using sdpa_graph::HEAD_SIZE_AXIS; +using sdpa_graph::SDPA_RANK; +using sdpa_graph::SEQ_AXIS; + +/// The kernel's vector loads and stores move 8 elements (16 bytes) at a time, so every +/// stride of a non-unit axis and every base pointer must keep that alignment. +constexpr int64_t VECTOR_ELEMENTS = 8; +constexpr uintptr_t VECTOR_BYTES = 16; +constexpr int64_t ELEMENT_BYTES = 2; + +/// Buffer-resource record limit the kernels use for one K/V block. +constexpr int64_t MAX_BLOCK_SPAN_BYTES = 0x7FFF0000; +/// The gfx942 kernel reads page-table entries through a buffer of MAX_BLOCK_SPAN_BYTES with +/// an int32 byte offset, so a table reaches at most this many entries. +constexpr int64_t MAX_PAGE_TABLE_ENTRIES = MAX_BLOCK_SPAN_BYTES / 4; +constexpr int64_t INT32_LIMIT = std::numeric_limits::max(); +/// Grid-y cap. The kernel walks query blocks with a grid-stride loop, so a smaller grid +/// is always correct; this keeps the launch inside every device's grid limits. +constexpr int64_t MAX_GRID_Y = 65535; +constexpr int64_t WAVE_LANES = 64; + +/// Catalog coverage. The descriptors ship exactly these, and graph_match declines a graph +/// outside them with a named cause, so they must match the axes of +/// IngestorGenerator/configs/attention_paged_unified.yaml. kernel_match compares the +/// candidate's own metadata. +constexpr std::array HEAD_SIZES = {64, 128, 256}; +constexpr std::array BLOCK_SIZES = {16, 32, 64}; +constexpr std::array QUERIES_PER_KV = {1, 2, 4, 5, 6, 7, 8, 16}; + +template +bool contains(const std::array& values, int64_t value) +{ + for(const auto v : values) + { + if(v == value) + { + return true; + } + } + return false; +} + +// --------------------------------------------------------------------------- +// Matching helpers +// --------------------------------------------------------------------------- + +using sdpa_graph::checkedProduct; +using sdpa_graph::DeclinedBy; +using sdpa_graph::describeOperand; +using sdpa_graph::findTensor; +using sdpa_graph::hasSdpaForwardNode; + +std::optional checkedSum(std::initializer_list terms) +{ + int64_t sum = 0; + for(const int64_t term : terms) + { + if(__builtin_add_overflow(sum, term, &sum)) + { + return std::nullopt; + } + } + return sum; +} + +/// The attn_scale values this engine serves: every finite float. graph_match and the +/// saved-plan reader share it, so every plan the engine builds also loads. +bool isServedAttentionScale(float scale) +{ + return std::isfinite(scale); +} + +constexpr DeclinedBy declined(std::string_view cause) +{ + return DeclinedBy{ATTENTION_PAGED_UNIFIED_ENGINE_NAME, cause}; +} + +/// A rank-4 device operand with positive extents and non-negative strides, read +/// directly from the variant pack (not virtual, not pass-by-value). +bool isWellFormedRank4(const data_objects::TensorAttributes& tensor) +{ + return sdpa_graph::isWellFormedOperand(tensor) && sdpa_graph::hasNonNegativeStrides(tensor); +} + +/// Strides with every unit-extent axis set to zero: an index that is always zero makes +/// its stride irrelevant, so it must neither decline a graph nor reach the kernel. +std::array effectiveStrides(const data_objects::TensorAttributes& tensor) +{ + std::array strides{}; + for(uint32_t i = 0; i < SDPA_RANK; ++i) + { + strides[i] = tensor.dims()->Get(i) == 1 ? 0 : tensor.strides()->Get(i); + } + return strides; +} + +int64_t dim(const data_objects::TensorAttributes& tensor, uint32_t axis) +{ + return tensor.dims()->Get(axis); +} + +/// Every stride a vector load or store walks: a multiple of 8 elements and within int32. +bool vectorStridesOk(const std::array& strides, bool includeBatch) +{ + for(uint32_t axis = includeBatch ? BATCH_AXIS : HEAD_AXIS; axis < HEAD_SIZE_AXIS; ++axis) + { + if(strides[axis] % VECTOR_ELEMENTS != 0 || strides[axis] > INT32_LIMIT) + { + return false; + } + } + return true; +} + +/// The extent of the elements an operand addresses within one sequence (or one block), +/// in elements, without its batch axis: the largest within-sequence offset plus one. +std::optional innerExtent(const data_objects::TensorAttributes& tensor) +{ + const auto strides = effectiveStrides(tensor); + const auto head = checkedProduct({dim(tensor, HEAD_AXIS) - 1, strides[HEAD_AXIS]}); + const auto seq = checkedProduct({dim(tensor, SEQ_AXIS) - 1, strides[SEQ_AXIS]}); + if(!head.has_value() || !seq.has_value()) + { + return std::nullopt; + } + return checkedSum({*head, *seq, dim(tensor, HEAD_SIZE_AXIS)}); +} + +std::optional dataTypeCode(data_objects::DataType dataType) +{ + if(dataType == data_objects::DataType::HALF) + { + return DTYPE_FP16; + } + if(dataType == data_objects::DataType::BFLOAT16) + { + return DTYPE_BF16; + } + return std::nullopt; +} + +std::string_view dataTypeName(int64_t code) +{ + return code == DTYPE_FP16 ? "FP16" : "BF16"; +} + +/// Q's or O's layout, the part of the problem prepare() turns into kernel arguments. +struct QueryLayout +{ + int64_t seqStride = 0; ///< dense: batch stride; ragged: the offset multiplier + int64_t tokenStride = 0; + int64_t headStride = 0; +}; + +QueryLayout queryLayout(const data_objects::TensorAttributes& tensor, bool ragged) +{ + const auto strides = effectiveStrides(tensor); + QueryLayout layout; + layout.seqStride = ragged ? tensor.ragged_offset_multiplier() : strides[BATCH_AXIS]; + layout.tokenStride = strides[SEQ_AXIS]; + layout.headStride = strides[HEAD_AXIS]; + return layout; +} + +/// Checks Q or O (identical dims already established). Logs its own declines. +bool queryOperandOk(std::string_view role, + const data_objects::TensorAttributes& tensor, + bool ragged) +{ + const auto strides = effectiveStrides(tensor); + if(tensor.strides()->Get(HEAD_SIZE_AXIS) != 1) + { + HIPDNN_PLUGIN_LOG_INFO(declined("layout") << describeOperand(role, tensor) + << " has a non-unit head-size stride"); + return false; + } + const int64_t seqStride = ragged ? tensor.ragged_offset_multiplier() : strides[BATCH_AXIS]; + // A ragged sequence starts at offset * multiplier: a zero multiplier would put every + // sequence at the buffer base. + if(!vectorStridesOk(strides, false) || seqStride % VECTOR_ELEMENTS != 0 || seqStride < 0 + || (ragged && seqStride == 0) || seqStride > INT32_LIMIT) + { + HIPDNN_PLUGIN_LOG_INFO(declined("layout") + << describeOperand(role, tensor) + << (ragged ? " with ragged_offset_multiplier " + : " with batch stride ") + << seqStride + << ": strides must be multiples of 8 elements and fit int32, " + "and a ragged multiplier must be positive"); + return false; + } + // The ASM SDPA engine declines offsets in other units the same way. + if(ragged + && !sdpa_graph::countsOffsetsInTokens(ATTENTION_PAGED_UNIFIED_ENGINE_NAME, role, tensor)) + { + return false; + } + const auto extent = innerExtent(tensor); + if(!extent.has_value() || *extent > INT32_LIMIT) + { + HIPDNN_PLUGIN_LOG_INFO(declined("size_limit") + << describeOperand(role, tensor) + << ": one sequence spans more than 2^31-1 elements"); + return false; + } + return true; +} + +/// Logs and declines. +std::nullopt_t decline(std::string_view cause, const std::string& reason) +{ + HIPDNN_PLUGIN_LOG_INFO(declined(cause) << reason); + return std::nullopt; +} + +/** + * @brief Graph-scoped applicability for the whole engine. + * + * Each decline of a graph with an SDPA-forward node logs its cause at INFO; any other + * graph declines silently. Messages are built only when INFO logging is enabled. + * + * @warning Returning std::nullopt empties this engine's WHOLE catalog. + */ +std::optional graphMatches(const MatchContext& context) +{ + // --- 1. Node shape. Override-shape graphs (admitted by the 1.4.0 schema floor) are + // not served: launch arguments come from the built shapes. + const auto* attributesPtr = sdpa_graph::sdpaNode(context); + if(attributesPtr == nullptr || sdpa_graph::usesOverrideShapes(context)) + { + if(HIPDNN_PLUGIN_LOG_IS_INFO_ENABLED() && hasSdpaForwardNode(context)) + { + HIPDNN_PLUGIN_LOG_INFO( + declined("node") + << "the graph is not a single SDPA-forward node without override shapes (" + << context.graph.nodeCount() << " node(s))"); + } + return std::nullopt; + } + const auto& attributes = *attributesPtr; + const bool info = HIPDNN_PLUGIN_LOG_IS_INFO_ENABLED(); + const auto reason = [info](const auto&... parts) { + if(!info) + { + return std::string(); + } + std::ostringstream out; + (out << ... << parts); + return out.str(); + }; + + if(context.graph.getNodeWrapper(0).computeDataType() != data_objects::DataType::FLOAT) + { + return decline("compute_data_type", reason("compute data type must be FLOAT")); + } + + // --- 2. Paging. This engine serves paged K and V only, each through its own block + // table (which may be the same tensor). + if(!attributes.page_table_k_tensor_uid().has_value() + && !attributes.page_table_v_tensor_uid().has_value()) + { + return decline("not_paged", + reason("K/V without page tables (page_table_k/page_table_v) are not " + "served; this engine reads paged K/V containers")); + } + if(!sdpa_graph::pagesKAndV(ATTENTION_PAGED_UNIFIED_ENGINE_NAME, attributes)) + { + return std::nullopt; + } + + // --- 3. Operands. + const auto* q = findTensor(context, attributes.q_tensor_uid()); + const auto* k = findTensor(context, attributes.k_tensor_uid()); + const auto* v = findTensor(context, attributes.v_tensor_uid()); + const auto* o = findTensor(context, attributes.o_tensor_uid()); + const std::array, 4> operands + = {{{"Q", q}, {"K", k}, {"V", v}, {"O", o}}}; + for(const auto& [role, tensor] : operands) + { + if(tensor == nullptr || !isWellFormedRank4(*tensor)) + { + return decline("operand", + reason(role, + " is missing, virtual, pass-by-value, not rank 4, or has a " + "non-positive extent or negative stride")); + } + } + + // --- 4. Data types. + const auto dtype = dataTypeCode(q->data_type()); + if(!dtype.has_value() || k->data_type() != q->data_type() || v->data_type() != q->data_type() + || o->data_type() != q->data_type()) + { + return decline( + "data_type", + reason("Q/K/V/O must all be FP16 or all BFLOAT16 (Q is ", q->data_type(), ")")); + } + + // --- 5. Shapes. + const int64_t batch = dim(*q, BATCH_AXIS); + const int64_t numQueryHeads = dim(*q, HEAD_AXIS); + const int64_t seqLenQ = dim(*q, SEQ_AXIS); + const int64_t headSize = dim(*q, HEAD_SIZE_AXIS); + const int64_t numKvHeads = dim(*k, HEAD_AXIS); + const int64_t blockSize = dim(*k, SEQ_AXIS); + if(!sdpa_graph::pagedContainersAgree(ATTENTION_PAGED_UNIFIED_ENGINE_NAME, *k, *v)) + { + return std::nullopt; + } + // The kernels read K and V with one head count and one head size. + if(dim(*v, HEAD_AXIS) != numKvHeads || dim(*v, HEAD_SIZE_AXIS) != dim(*k, HEAD_SIZE_AXIS)) + { + return decline("shape", + reason(describeOperand("V", *v), " must match ", describeOperand("K", *k))); + } + for(uint32_t axis = 0; axis < SDPA_RANK; ++axis) + { + if(dim(*o, axis) != dim(*q, axis)) + { + return decline( + "shape", + reason(describeOperand("O", *o), " must match ", describeOperand("Q", *q))); + } + } + if(dim(*k, HEAD_SIZE_AXIS) != headSize) + { + return decline("head_size", reason("Q and K/V head sizes differ")); + } + if(!contains(HEAD_SIZES, headSize)) + { + return decline("head_size", reason("head size ", headSize, " is not one of 64, 128, 256")); + } + if(!contains(BLOCK_SIZES, blockSize)) + { + return decline("block_size", + reason("K/V block size ", blockSize, " is not one of 16, 32, 64")); + } + if(numQueryHeads % numKvHeads != 0 || !contains(QUERIES_PER_KV, numQueryHeads / numKvHeads)) + { + return decline("gqa", + reason("query heads ", + numQueryHeads, + " over K/V heads ", + numKvHeads, + " is not a shipped ratio (1, 2, 4, 5, 6, 7, 8, 16)")); + } + const int64_t queriesPerKv = numQueryHeads / numKvHeads; + + // --- 6. Q/O layout: dense, or ragged through one shared offset table. + const auto raggedQuery = sdpa_graph::raggedQueryFor( + ATTENTION_PAGED_UNIFIED_ENGINE_NAME, context, *q, *o, *k, *v, batch); + if(!raggedQuery.has_value()) + { + return std::nullopt; + } + const bool qRagged = raggedQuery->ragged; + const int64_t raggedOffsetUid + = qRagged ? raggedQuery->offsetsUid : ATTENTION_PAGED_UNIFIED_NO_UID; + if(!queryOperandOk("Q", *q, qRagged) || !queryOperandOk("O", *o, qRagged)) + { + return std::nullopt; + } + + // --- 7. K/V containers: equal strides (the kernel shares one descriptor), D-contiguous. + const auto kStrides = effectiveStrides(*k); + if(effectiveStrides(*v) != kStrides) + { + return decline("kv_layout", + reason(describeOperand("K", *k), + " and ", + describeOperand("V", *v), + " must have equal strides")); + } + if(k->strides()->Get(HEAD_SIZE_AXIS) != 1 || v->strides()->Get(HEAD_SIZE_AXIS) != 1 + || !vectorStridesOk(kStrides, true)) + { + return decline("kv_layout", + reason(describeOperand("K", *k), + ": K/V need a unit head-size stride and other strides that are " + "multiples of 8 elements within int32")); + } + const auto kvExtent = innerExtent(*k); + const auto kvSpanBytes + = kvExtent.has_value() ? checkedProduct({*kvExtent, ELEMENT_BYTES}) : std::nullopt; + if(!kvSpanBytes.has_value() || *kvSpanBytes > MAX_BLOCK_SPAN_BYTES) + { + return decline("size_limit", reason("one K/V block spans more than 0x7FFF0000 bytes")); + } + + // --- 8. Page tables INT32 [B, 1, M, 1] with a unit entry stride. Separate K and V + // tables share one width M and one batch stride: the kernel takes one + // block_table_stride for both. + const auto pageTables = sdpa_graph::pageTablesFor( + ATTENTION_PAGED_UNIFIED_ENGINE_NAME, context, attributes, batch); + if(!pageTables.has_value()) + { + return std::nullopt; + } + const auto pageTableStrides = effectiveStrides(*pageTables->k); + const auto rowSpan = checkedProduct({batch - 1, pageTableStrides[BATCH_AXIS]}); + const auto pageTableExtent = checkedSum( + {rowSpan.value_or(std::numeric_limits::max()), dim(*pageTables->k, SEQ_AXIS)}); + if(!pageTableExtent.has_value() || *pageTableExtent > MAX_PAGE_TABLE_ENTRIES) + { + return decline("size_limit", + reason("the page table spans more than ", + MAX_PAGE_TABLE_ENTRIES, + " entries (0x7FFF0000 bytes)")); + } + + const auto rowTokens = checkedProduct({dim(*pageTables->k, SEQ_AXIS), dim(*k, SEQ_AXIS)}); + if(!rowTokens.has_value() || *rowTokens > INT32_LIMIT) + { + return decline("size_limit", reason("a page-table row covers more than int32 tokens")); + } + + // --- 9. Sequence lengths, both required for a paged graph (SEM-009). The kernels read + // the first ceil(seq_len_kv[b] / block_size) entries of row b of each table and bound + // seq_len_kv[b] by M * block_size (a longer length is a caller bug, and reads as masked + // rather than walking off the table row); that bound is an int32, so a row of more + // tokens declines. An unset max_seq_len_kv is inferred as M * block_size (both tables + // have the same M), which bounds seq_len_kv the same way, so it is served either way. A dense Q's rows past seq_len_q[b] (padding) are written as zeros; a + // ragged Q writes only its first seq_len_q[b] rows. + const auto lengths = sdpa_graph::sequenceLengthsFor( + ATTENTION_PAGED_UNIFIED_ENGINE_NAME, context, attributes, batch); + if(!lengths.has_value()) + { + return std::nullopt; + } + + // --- 10. Declared alignment. A graph declares each operand's device-pointer alignment + // (16 bytes unless set; setting it needs engine API 1.3.0, which this engine's 1.4.0 + // admits). The kernels load Q/K/V/O as 16-byte vectors and the INT32 operands as 4-byte + // words, and launch() rejects a pointer short of either. A dense Q has no offset table; + // its entry is null and skipped. + if(!sdpa_graph::declaresServedAlignment(ATTENTION_PAGED_UNIFIED_ENGINE_NAME, + {{"Q", q}, {"K", k}, {"V", v}, {"O", o}}, + static_cast(VECTOR_BYTES), + {{"page_table_k", pageTables->k}, + {"page_table_v", pageTables->v}, + {"seq_len_kv", lengths->kv}, + {"seq_len_q", lengths->q}, + {"ragged_offset", raggedQuery->offsets}})) + { + return std::nullopt; + } + + // --- 11. Mask: bottom-right causal, optionally with a left bound (sliding window). + asm_sdpa_engine::plan_utils::DiagonalBand band{}; + try + { + band = asm_sdpa_engine::plan_utils::resolveDiagonalBand(attributes); + } + catch(const hipdnn_plugin_sdk::HipdnnPluginException& e) + { + return decline("mask", reason(e.what())); + } + if(band.rightBound != 0 || band.alignment != data_objects::DiagonalAlignment::BOTTOM_RIGHT) + { + return decline("mask", + reason("only bottom-right causal masking (right_bound 0, BOTTOM_RIGHT " + "alignment) is served; got right_bound ", + band.rightBound, + (band.alignment == data_objects::DiagonalAlignment::BOTTOM_RIGHT + ? ", BOTTOM_RIGHT" + : ", TOP_LEFT"))); + } + int64_t window = NO_WINDOW; + if(band.leftBound >= 0) + { + if(band.leftBound >= NO_WINDOW - 1) + { + window = NO_WINDOW; + } + else + { + // The graph's left_bound L keeps the L keys ending at the diagonal (cuDNN); + // resolveDiagonalBand holds it as the FlashAttention window L - 1. The kernel + // keeps key k for diagonal d iff d - k < window, so window = L. + window = band.leftBound + 1; + } + } + + // --- 12. Every optional attribute the kernel cannot honour. + if(!sdpa_graph::takesNoAttentionMask(ATTENTION_PAGED_UNIFIED_ENGINE_NAME, attributes)) + { + return std::nullopt; + } + if(attributes.scale_tensor_uid().has_value()) + { + return decline("scale_tensor", + reason("a scale tensor is not supported; set attn_scale_value")); + } + if(attributes.seed_tensor_uid().has_value() || attributes.offset_tensor_uid().has_value() + || attributes.dropout_mask_tensor_uid().has_value() + || attributes.dropout_scale_tensor_uid().has_value() + || attributes.dropout_probability().has_value()) + { + return decline("dropout", reason("dropout is not supported")); + } + if(attributes.block_mask_tensor_uid().has_value()) + { + return decline("block_mask", reason("a block mask is not supported")); + } + // A sink is one logit per query head, which the use_sinks kernels load from sink_ptr + // at index `query head`, as FLOAT or in the I/O dtype (sink_is_f32 says which). They + // declare sink_ptr 16-byte aligned, as they do Q/K/V/O, and launch() checks it the + // same way. + const auto sink = sdpa_graph::sinkFor(ATTENTION_PAGED_UNIFIED_ENGINE_NAME, + context, + attributes, + numQueryHeads, + q->data_type(), + static_cast(VECTOR_BYTES)); + if(!sink.has_value()) + { + return std::nullopt; + } + const int64_t sinkUid = sink->present ? sink->uid : ATTENTION_PAGED_UNIFIED_NO_UID; + if(attributes.descale_q_tensor_uid().has_value() + || attributes.descale_k_tensor_uid().has_value() + || attributes.descale_v_tensor_uid().has_value() + || attributes.descale_s_tensor_uid().has_value() + || attributes.scale_s_tensor_uid().has_value() || attributes.scale_o_tensor_uid().has_value() + || attributes.amax_s_tensor_uid().has_value() || attributes.amax_o_tensor_uid().has_value()) + { + return decline("fp8", reason("FP8 descale/scale/amax tensors are not supported")); + } + if(attributes.stats_tensor_uid().has_value() || attributes.max_tensor_uid().has_value() + || attributes.sum_exp_tensor_uid().has_value() + || attributes.rng_dump_tensor_uid().has_value() + || (attributes.generate_stats().has_value() && attributes.generate_stats().value())) + { + return decline("stats", reason("softmax statistics outputs are not supported")); + } + if(attributes.alibi_mask()) + { + return decline("alibi_mask", reason("ALiBi is not supported")); + } + const auto mmaCoreMode = attributes.mma_core_mode(); + if(mmaCoreMode != data_objects::DataType::UNSET && mmaCoreMode != data_objects::DataType::HALF + && mmaCoreMode != data_objects::DataType::BFLOAT16) + { + return decline("mma_core_mode", reason("mma_core_mode ", mmaCoreMode, " is not supported")); + } + if(attributes.implementation() != data_objects::AttentionImplementation::AUTO) + { + return decline("implementation", + reason("implementation hint ", + attributes.implementation(), + " is not supported; only AUTO is")); + } + // Absent attn_scale_value means 1.0 (cuDNN's default). + const float scale = attributes.attn_scale_value().value_or(1.0F); + if(!isServedAttentionScale(scale)) + { + return decline("scale", reason("attn_scale ", scale, " is not finite")); + } + + // --- 13. Launch-size limits that do not depend on the candidate. + if(batch > INT32_LIMIT || seqLenQ > INT32_LIMIT || numQueryHeads > INT32_LIMIT) + { + return decline("size_limit", reason("batch, query length or head count exceeds int32")); + } + + BoundTokens bound; + bound[std::string(Q_TOKEN)] = attributes.q_tensor_uid(); + bound[std::string(K_TOKEN)] = attributes.k_tensor_uid(); + bound[std::string(V_TOKEN)] = attributes.v_tensor_uid(); + bound[std::string(O_TOKEN)] = attributes.o_tensor_uid(); + bound[std::string(PAGE_TABLE_K_TOKEN)] = pageTables->kUid; + bound[std::string(PAGE_TABLE_V_TOKEN)] = pageTables->vUid; + bound[std::string(SEQ_LEN_KV_TOKEN)] = lengths->kvUid; + bound[std::string(SEQ_LEN_Q_TOKEN)] = lengths->qUid; + bound[std::string(RAGGED_OFFSET_TOKEN)] = raggedOffsetUid; + bound[std::string(SINK_TOKEN)] = sinkUid; + bound[std::string(SINK_IS_F32_TOKEN)] = int64_t{sink->f32 ? 1 : 0}; + int32_t scaleBits = 0; + static_assert(sizeof(scaleBits) == sizeof(scale), "float must be 32-bit to round-trip"); + std::memcpy(&scaleBits, &scale, sizeof(scale)); + bound[std::string(SCALE_BITS_TOKEN)] = static_cast(scaleBits); + bound[std::string(WINDOW_TOKEN)] = window; + bound[std::string(DTYPE_TOKEN)] = *dtype; + bound[std::string(HEAD_SIZE_TOKEN)] = headSize; + bound[std::string(BLOCK_SIZE_TOKEN)] = blockSize; + bound[std::string(QUERIES_PER_KV_TOKEN)] = queriesPerKv; + return bound; +} + +/// The device's processor without target features ("gfx942:sramecc+:xnack-" -> "gfx942"). +std::string_view processorOf(const MatchContext& context) +{ + const std::string_view arch = context.deviceProperties.gcnArchName; + return arch.substr(0, arch.find(':')); +} + +/// Pack criteria: each pack holds one architecture's builder output (the gfx942 and +/// gfx950 tiled kernels are different modules), so a pack serves only its own device. +bool gfx942PackMatches(const MatchContext& context, const BoundTokens& /*bound*/) +{ + return processorOf(context) == "gfx942"; +} + +bool gfx950PackMatches(const MatchContext& context, const BoundTokens& /*bound*/) +{ + return processorOf(context) == "gfx950"; +} + +int64_t readBound(const BoundTokens& bound, std::string_view token) +{ + const auto value = tryGetBoundInt(bound, token); + if(!value.has_value()) + { + throw hipdnn_plugin_sdk::HipdnnPluginException( + HIPDNN_PLUGIN_STATUS_INTERNAL_ERROR, + std::string(ATTENTION_PAGED_UNIFIED_ENGINE_NAME) + " dispatch is missing bound token '" + + std::string(token) + "', or it does not hold an integer"); + } + return *value; +} + +/// The candidate's CTA geometry: threads per CTA and query rows (tokens) per q-block. +struct CandidateGeometry +{ + int64_t threads = 0; + int64_t blockQ = 0; +}; + +/// A candidate's integer metadata field, or nullopt when it is absent or holds another +/// type. Total: a malformed record declines instead of throwing out of a match. +std::optional integerMetadata(const KernelDefinition& kernel, std::string_view field) +{ + const auto it = kernel.metadata.find(std::string(field)); + if(it == kernel.metadata.end()) + { + return std::nullopt; + } + const auto* value = std::get_if(&it->second); + return value == nullptr ? std::nullopt : std::optional(*value); +} + +std::optional stringMetadata(const KernelDefinition& kernel, std::string_view field) +{ + const auto it = kernel.metadata.find(std::string(field)); + if(it == kernel.metadata.end()) + { + return std::nullopt; + } + const auto* value = std::get_if(&it->second); + return value == nullptr ? std::nullopt : std::optional(*value); +} + +/// The geometry the candidate's baked metadata implies, mirroring the rocKE spec: +/// `block_m = block_m_per_warp * num_warps`, `block_q = block_m // queries_per_kv`, +/// `threads = num_warps * 64`. nullopt for a record that lacks a field, was not built +/// with one KV head, or yields no query rows per block. +std::optional candidateGeometry(const KernelDefinition& kernel) +{ + const auto numWarps = integerMetadata(kernel, NUM_WARPS_FIELD); + const auto blockMPerWarp = integerMetadata(kernel, BLOCK_M_PER_WARP_FIELD); + const auto queries = integerMetadata(kernel, NUM_QUERY_HEADS_FIELD); + const auto kvHeads = integerMetadata(kernel, NUM_KV_HEADS_FIELD); + if(!numWarps.has_value() || !blockMPerWarp.has_value() || !queries.has_value() + || !kvHeads.has_value() || *numWarps <= 0 || *numWarps > 16 || *blockMPerWarp <= 0 + || *kvHeads != 1 || *queries <= 0) + { + return std::nullopt; + } + CandidateGeometry geometry; + geometry.threads = *numWarps * WAVE_LANES; + geometry.blockQ = (*blockMPerWarp * *numWarps) / *queries; + if(geometry.blockQ <= 0) + { + return std::nullopt; + } + return geometry; +} + +/** + * @brief Kernel-scoped applicability: the candidate was built for this graph's dtype, + * head size, block size and GQA ratio, with one KV head (runtime head counts), and + * with use_sinks exactly when the graph has a sink_token. + */ +bool kernelMatches(const MatchContext& /*context*/, + const BoundTokens& bound, + const KernelDefinition& kernel) +{ + const auto dtype = tryGetBoundInt(bound, DTYPE_TOKEN); + const auto headSize = tryGetBoundInt(bound, HEAD_SIZE_TOKEN); + const auto blockSize = tryGetBoundInt(bound, BLOCK_SIZE_TOKEN); + const auto queriesPerKv = tryGetBoundInt(bound, QUERIES_PER_KV_TOKEN); + const auto sinkUid = tryGetBoundInt(bound, SINK_TOKEN); + if(!dtype.has_value() || !headSize.has_value() || !blockSize.has_value() + || !queriesPerKv.has_value() || !sinkUid.has_value() + || !candidateGeometry(kernel).has_value()) + { + return false; + } + // An absent use_sinks is the KMD default 0. A sink object without a sink would read + // a null sink_ptr; a plain object with a sink would drop it. + const int64_t wantSinks = *sinkUid != ATTENTION_PAGED_UNIFIED_NO_UID ? 1 : 0; + return stringMetadata(kernel, DTYPE_FIELD) == std::string(dataTypeName(*dtype)) + && integerMetadata(kernel, HEAD_SIZE_FIELD) == *headSize + && integerMetadata(kernel, BLOCK_SIZE_FIELD) == *blockSize + && integerMetadata(kernel, NUM_QUERY_HEADS_FIELD) == *queriesPerKv + && integerMetadata(kernel, USE_SINKS_FIELD).value_or(0) == wantSinks; +} + +// --------------------------------------------------------------------------- +// Dispatch +// --------------------------------------------------------------------------- + +/// The kernel signature (runtime_layout=True): the arguments every tiled 2D body takes, +/// then the runtime_layout ones. NAMES ARE LOAD-BEARING (see AttentionTiled2DSignature.hpp): +/// keep them identical to kernels/{gfx942,gfx950}/attention_tiled_2d.py. +std::vector kernelSignature() +{ + constexpr auto PTR = static_cast(sizeof(void*)); + constexpr auto I32 = static_cast(sizeof(int32_t)); + auto signature = tiled2DKernelSignature(); + appendKernelArgument(signature, "global_buffer", PTR, "block_tables_v_ptr"); + appendKernelArgument(signature, "global_buffer", PTR, "seq_lens_q_ptr"); + for(const auto* name : {"has_seq_lens_q", + "q_uniform_len", + "q_seq_stride", + "q_tok_stride", + "q_head_stride", + "o_seq_stride", + "o_tok_stride", + "o_head_stride", + "kv_block_stride", + "kv_tok_stride", + "kv_head_stride", + "kv_block_span_bytes", + "q_block_grid", + "sink_is_f32", + "num_kv_blocks", + "block_table_width"}) + { + appendKernelArgument(signature, "by_value", I32, name); + } + return signature; +} + +/// Every by-value launch argument, resolved once at prepare() or read from a saved plan. +using LaunchScalars = AttentionPagedUnifiedScalars; +using BoundUids = AttentionPagedUnifiedUids; + +class PreparedAttentionPagedUnified : public IngestorPreparedDispatch +{ +public: + PreparedAttentionPagedUnified(IngestorKernelCode code, AttentionPagedUnifiedLaunchInputs launch) + : _code(std::move(code)) + , _launch(launch) + { + } + + const IngestorKernelCode& kernelCode() const override + { + return _code; + } + + compilation::IRunnableKernel& kernelForStream(hipStream_t stream) const + { + return _code.kernelForStream(stream); + } + + const AttentionPagedUnifiedLaunchInputs& launchInputs() const + { + return _launch; + } + + const BoundUids& uids() const + { + return _launch.uids; + } + + const LaunchScalars& scalars() const + { + return _launch.scalars; + } + +private: + IngestorKernelCode _code; + AttentionPagedUnifiedLaunchInputs _launch; +}; + +/// Applies the launch geometry to @p code and builds the prepared dispatch. A plan built +/// from a graph and a plan restored from a saved payload both come through here. +std::unique_ptr + makePreparedAttentionPagedUnified(IngestorKernelCode code, + const AttentionPagedUnifiedLaunchInputs& launch) +{ + code.setBlockSize(static_cast(launch.blockThreads), 1, 1); + code.setGridSize(static_cast(launch.scalars.numKvHeads), + static_cast(launch.scalars.qBlockGrid), + 1); + return std::make_unique(std::move(code), launch); +} + +int32_t narrow(int64_t value, std::string_view what) +{ + if(value < std::numeric_limits::min() || value > INT32_LIMIT) + { + throw hipdnn_plugin_sdk::HipdnnPluginException( + HIPDNN_PLUGIN_STATUS_BAD_PARAM, + std::string(ATTENTION_PAGED_UNIFIED_ENGINE_NAME) + ": " + std::string(what) + + " does not fit int32"); + } + return static_cast(value); +} + +const data_objects::TensorAttributes& requireTensor(const MatchContext& context, int64_t uid) +{ + const auto* tensor = findTensor(context, uid); + if(tensor == nullptr || !isWellFormedRank4(*tensor)) + { + throw hipdnn_plugin_sdk::HipdnnPluginException( + HIPDNN_PLUGIN_STATUS_BAD_PARAM, + std::string(ATTENTION_PAGED_UNIFIED_ENGINE_NAME) + ": tensor uid " + std::to_string(uid) + + " is missing or malformed"); + } + return *tensor; +} + +class AttentionPagedUnifiedDispatchHandler : public IKernelDispatchHandler +{ +public: + explicit AttentionPagedUnifiedDispatchHandler(const compilation::KpackKernelLoader& loader) + : _loader(loader) + { + } + + /// Zero: the kernel keeps all scratch in LDS and registers. + size_t workspaceBytes(const MatchContext& /*context*/, + const BoundTokens& /*bound*/, + const KernelDefinition& /*kernel*/) const override + { + return 0; + } + + std::unique_ptr prepare(const MatchContext& context, + const BoundTokens& bound, + const KernelDefinition& kernel) const override + { + // graph_match and kernel_match are the gates; this is defence in depth for a + // caller that reaches the handler without having matched. + if(!graphMatches(context).has_value() || !kernelMatches(context, bound, kernel)) + { + throw hipdnn_plugin_sdk::HipdnnPluginException( + HIPDNN_PLUGIN_STATUS_BAD_PARAM, + std::string(ATTENTION_PAGED_UNIFIED_ENGINE_NAME) + + ": the graph or the kernel candidate is not supported"); + } + const auto geometry = candidateGeometry(kernel); + + BoundUids uids; + uids.q = readBound(bound, Q_TOKEN); + uids.k = readBound(bound, K_TOKEN); + uids.v = readBound(bound, V_TOKEN); + uids.o = readBound(bound, O_TOKEN); + uids.pageTableK = readBound(bound, PAGE_TABLE_K_TOKEN); + uids.pageTableV = readBound(bound, PAGE_TABLE_V_TOKEN); + uids.seqLenKv = readBound(bound, SEQ_LEN_KV_TOKEN); + uids.seqLenQ = readBound(bound, SEQ_LEN_Q_TOKEN); + uids.raggedOffset = readBound(bound, RAGGED_OFFSET_TOKEN); + uids.sink = readBound(bound, SINK_TOKEN); + const bool ragged = uids.raggedOffset != ATTENTION_PAGED_UNIFIED_NO_UID; + + const auto& q = requireTensor(context, uids.q); + const auto& o = requireTensor(context, uids.o); + const auto& k = requireTensor(context, uids.k); + // graph_match checked that a separate V table has K's batch stride. + const auto& pageTableK = requireTensor(context, uids.pageTableK); + + LaunchScalars s; + const auto scaleBits = static_cast(readBound(bound, SCALE_BITS_TOKEN)); + std::memcpy(&s.scale, &scaleBits, sizeof(s.scale)); + const int64_t batch = dim(q, BATCH_AXIS); + const int64_t seqLenQ = dim(q, SEQ_AXIS); + const int64_t numQueryHeads = dim(q, HEAD_AXIS); + const int64_t numKvHeads = dim(k, HEAD_AXIS); + s.numSeqs = narrow(batch, "batch"); + s.blockTableStride = narrow(effectiveStrides(pageTableK)[BATCH_AXIS], "page-table stride"); + s.numQueryHeads = narrow(numQueryHeads, "query heads"); + s.numKvHeads = narrow(numKvHeads, "KV heads"); + s.slidingWindow = narrow(readBound(bound, WINDOW_TOKEN), "window"); + s.qUniformLen = ragged ? 0 : narrow(seqLenQ, "query length"); + s.sinkIsF32 = static_cast(readBound(bound, SINK_IS_F32_TOKEN)); + const auto narrowStrides = [](const QueryLayout& layout) { + return AttentionPagedUnifiedQueryStrides{narrow(layout.seqStride, "Q/O stride"), + narrow(layout.tokenStride, "Q/O stride"), + narrow(layout.headStride, "Q/O stride")}; + }; + s.q = narrowStrides(queryLayout(q, ragged)); + s.o = narrowStrides(queryLayout(o, ragged)); + const auto kStrides = effectiveStrides(k); + s.kvBlockStride = narrow(kStrides[BATCH_AXIS], "K/V block stride"); + s.kvTokStride = narrow(kStrides[SEQ_AXIS], "K/V token stride"); + s.kvHeadStride = narrow(kStrides[HEAD_AXIS], "K/V head stride"); + const auto kvExtent = innerExtent(k); + // graph_match declines a K without a block extent; refuse rather than build a + // span that disables the kernel's per-page bound. + if(!kvExtent.has_value()) + { + throw hipdnn_plugin_sdk::HipdnnPluginException( + HIPDNN_PLUGIN_STATUS_BAD_PARAM, + std::string(ATTENTION_PAGED_UNIFIED_ENGINE_NAME) + + ": K has no block extent, so the K/V block span is undefined"); + } + s.kvBlockSpanBytes = narrow(*kvExtent * ELEMENT_BYTES, "K/V block span"); + s.numKvBlocks = narrow(dim(k, BATCH_AXIS), "K/V block count"); + // The table's row width, not its row stride: a batch of one has a unit batch + // extent, whose stride effectiveStrides sets to zero. + s.blockTableWidth = narrow(dim(pageTableK, SEQ_AXIS), "page-table width"); + + // q-block grid: exact for a dense Q; for a ragged Q, enough blocks for every + // sequence when the batch's tokens fit in Sq (the serving convention) -- the kernel's + // grid-stride loop covers any larger batch. Capped by MAX_GRID_Y either way. + const int64_t blocksPerSequence = (seqLenQ + geometry->blockQ - 1) / geometry->blockQ; + const int64_t gridY = ragged ? blocksPerSequence + batch : batch * blocksPerSequence; + s.qBlockGrid = static_cast(std::min(std::max(gridY, 1), MAX_GRID_Y)); + + auto code = buildIngestorKernelCode(_loader, context, kernel, kernelSignature()); + return makePreparedAttentionPagedUnified( + std::move(code), + AttentionPagedUnifiedLaunchInputs{ + uids, s, narrow(geometry->threads, "threads per block")}); + } + + std::unique_ptr restoreLaunch(const SavedLaunchInputs& inputs, + SavedKernelCode code, + int deviceOrdinal) const override + { + auto restored = restoreIngestorLaunch( + inputs, + std::move(code), + kernelSignature(), + &readAttentionPagedUnifiedLaunchInputs, + deviceOrdinal); + return makePreparedAttentionPagedUnified(std::move(restored.code), restored.launch); + } + + std::optional + saveLaunchInputs(const PreparedDispatch& prepared) const override + { + const auto& p = dynamic_cast(prepared); + return SavedLaunchInputs{std::string(ATTENTION_PAGED_UNIFIED_DISPATCH_SYMBOL_V1), + attentionPagedUnifiedLaunchValues(p.launchInputs())}; + } + + bool supportsSaving() const override + { + return true; + } + + void launch(const Handle& handle, + const PreparedDispatch& prepared, + const hipdnnPluginDeviceBuffer_t* buffers, + uint32_t count, + void* /*workspace*/) const override + { + const auto& p = dynamic_cast(prepared); + const auto& u = p.uids(); + const auto& s = p.scalars(); + const auto ptr = [&](int64_t uid, bool vectorAligned) { + void* result = hipdnn_plugin_sdk::findDeviceBuffer(uid, buffers, count).ptr; + if(result == nullptr + || (vectorAligned && reinterpret_cast(result) % VECTOR_BYTES != 0) + || reinterpret_cast(result) % sizeof(int32_t) != 0) + { + throw hipdnn_plugin_sdk::HipdnnPluginException( + HIPDNN_PLUGIN_STATUS_BAD_PARAM, + std::string(ATTENTION_PAGED_UNIFIED_ENGINE_NAME) + ": buffer for uid " + + std::to_string(uid) + + (vectorAligned ? " is null or not 16-byte aligned" + : " is null or not 4-byte aligned")); + } + return result; + }; + void* q = ptr(u.q, true); + void* k = ptr(u.k, true); + void* v = ptr(u.v, true); + void* o = ptr(u.o, true); + void* pageTableK = ptr(u.pageTableK, false); + void* pageTableV = ptr(u.pageTableV, false); + void* seqLenKv = ptr(u.seqLenKv, false); + void* seqLenQ = ptr(u.seqLenQ, false); + // A dense Q has no offset table: seq_len_kv, a valid INT32 buffer, stands in, and + // the kernel reads it only through index-0 masked loads. + void* raggedOffset = u.raggedOffset != ATTENTION_PAGED_UNIFIED_NO_UID + ? ptr(u.raggedOffset, false) + : seqLenKv; + const void* unused = nullptr; + // sink_ptr is declared 16-byte aligned (attention_tiled_2d), like the Q/K/V/O + // pointers; only the use_sinks objects read it. + const void* sink = u.sink != ATTENTION_PAGED_UNIFIED_NO_UID ? ptr(u.sink, true) : unused; + + p.kernelForStream(handle.getStream()) + .launch(handle.getStream(), + o, + q, + k, + v, + sink, + pageTableK, + seqLenKv, + unused, // alibi_slopes_ptr + unused, // qq_bias_ptr + raggedOffset, + s.scale, + 1.0F, // k_scale + 1.0F, // v_scale + 1.0F, // out_scale + 0.0F, // softcap + s.numSeqs, + s.blockTableStride, + int32_t{0}, // qq_bias_stride_0 + s.numQueryHeads, + s.numKvHeads, + s.slidingWindow, + pageTableV, + seqLenQ, + int32_t{1}, // has_seq_lens_q: a paged graph always carries seq_len_q + s.qUniformLen, + s.q.seqStride, + s.q.tokenStride, + s.q.headStride, + s.o.seqStride, + s.o.tokenStride, + s.o.headStride, + s.kvBlockStride, + s.kvTokStride, + s.kvHeadStride, + s.kvBlockSpanBytes, + s.qBlockGrid, + s.sinkIsF32, + s.numKvBlocks, + s.blockTableWidth); + } + +private: + const compilation::KpackKernelLoader& _loader; +}; + +compilation::KpackModuleCache& moduleCache() +{ + static compilation::KpackModuleCache s_cache; + return s_cache; +} + +} // namespace + +MetadataValues attentionPagedUnifiedLaunchValues(const AttentionPagedUnifiedLaunchInputs& launch) +{ + const auto& u = launch.uids; + const auto& s = launch.scalars; + const auto value = [](std::string_view name, int64_t number) { + return std::pair{std::string(name), number}; + }; + return {value(ATTENTION_PAGED_UNIFIED_Q_UID_VALUE, u.q), + value(ATTENTION_PAGED_UNIFIED_K_UID_VALUE, u.k), + value(ATTENTION_PAGED_UNIFIED_V_UID_VALUE, u.v), + value(ATTENTION_PAGED_UNIFIED_O_UID_VALUE, u.o), + value(ATTENTION_PAGED_UNIFIED_PAGE_TABLE_K_UID_VALUE, u.pageTableK), + value(ATTENTION_PAGED_UNIFIED_PAGE_TABLE_V_UID_VALUE, u.pageTableV), + value(ATTENTION_PAGED_UNIFIED_SEQ_LEN_KV_UID_VALUE, u.seqLenKv), + value(ATTENTION_PAGED_UNIFIED_SEQ_LEN_Q_UID_VALUE, u.seqLenQ), + value(ATTENTION_PAGED_UNIFIED_RAGGED_OFFSET_UID_VALUE, u.raggedOffset), + value(ATTENTION_PAGED_UNIFIED_SINK_UID_VALUE, u.sink), + {std::string(ATTENTION_PAGED_UNIFIED_SCALE_VALUE), static_cast(s.scale)}, + value(ATTENTION_PAGED_UNIFIED_NUM_SEQS_VALUE, s.numSeqs), + value(ATTENTION_PAGED_UNIFIED_BLOCK_TABLE_STRIDE_VALUE, s.blockTableStride), + value(ATTENTION_PAGED_UNIFIED_NUM_QUERY_HEADS_VALUE, s.numQueryHeads), + value(ATTENTION_PAGED_UNIFIED_NUM_KV_HEADS_VALUE, s.numKvHeads), + value(ATTENTION_PAGED_UNIFIED_SLIDING_WINDOW_VALUE, s.slidingWindow), + value(ATTENTION_PAGED_UNIFIED_Q_UNIFORM_LEN_VALUE, s.qUniformLen), + value(ATTENTION_PAGED_UNIFIED_Q_SEQ_STRIDE_VALUE, s.q.seqStride), + value(ATTENTION_PAGED_UNIFIED_Q_TOK_STRIDE_VALUE, s.q.tokenStride), + value(ATTENTION_PAGED_UNIFIED_Q_HEAD_STRIDE_VALUE, s.q.headStride), + value(ATTENTION_PAGED_UNIFIED_O_SEQ_STRIDE_VALUE, s.o.seqStride), + value(ATTENTION_PAGED_UNIFIED_O_TOK_STRIDE_VALUE, s.o.tokenStride), + value(ATTENTION_PAGED_UNIFIED_O_HEAD_STRIDE_VALUE, s.o.headStride), + value(ATTENTION_PAGED_UNIFIED_KV_BLOCK_STRIDE_VALUE, s.kvBlockStride), + value(ATTENTION_PAGED_UNIFIED_KV_TOK_STRIDE_VALUE, s.kvTokStride), + value(ATTENTION_PAGED_UNIFIED_KV_HEAD_STRIDE_VALUE, s.kvHeadStride), + value(ATTENTION_PAGED_UNIFIED_KV_BLOCK_SPAN_BYTES_VALUE, s.kvBlockSpanBytes), + value(ATTENTION_PAGED_UNIFIED_Q_BLOCK_GRID_VALUE, s.qBlockGrid), + value(ATTENTION_PAGED_UNIFIED_SINK_IS_F32_VALUE, s.sinkIsF32), + value(ATTENTION_PAGED_UNIFIED_NUM_KV_BLOCKS_VALUE, s.numKvBlocks), + value(ATTENTION_PAGED_UNIFIED_BLOCK_TABLE_WIDTH_VALUE, s.blockTableWidth), + value(ATTENTION_PAGED_UNIFIED_BLOCK_THREADS_VALUE, launch.blockThreads)}; +} + +AttentionPagedUnifiedLaunchInputs + readAttentionPagedUnifiedLaunchInputs(const SavedLaunchInputs& inputs) +{ + requireLaunchContract(inputs, ATTENTION_PAGED_UNIFIED_DISPATCH_SYMBOL_V1); + requireOnlyLaunchValues(inputs, + {ATTENTION_PAGED_UNIFIED_Q_UID_VALUE, + ATTENTION_PAGED_UNIFIED_K_UID_VALUE, + ATTENTION_PAGED_UNIFIED_V_UID_VALUE, + ATTENTION_PAGED_UNIFIED_O_UID_VALUE, + ATTENTION_PAGED_UNIFIED_PAGE_TABLE_K_UID_VALUE, + ATTENTION_PAGED_UNIFIED_PAGE_TABLE_V_UID_VALUE, + ATTENTION_PAGED_UNIFIED_SEQ_LEN_KV_UID_VALUE, + ATTENTION_PAGED_UNIFIED_SEQ_LEN_Q_UID_VALUE, + ATTENTION_PAGED_UNIFIED_RAGGED_OFFSET_UID_VALUE, + ATTENTION_PAGED_UNIFIED_SINK_UID_VALUE, + ATTENTION_PAGED_UNIFIED_SCALE_VALUE, + ATTENTION_PAGED_UNIFIED_NUM_SEQS_VALUE, + ATTENTION_PAGED_UNIFIED_BLOCK_TABLE_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_NUM_QUERY_HEADS_VALUE, + ATTENTION_PAGED_UNIFIED_NUM_KV_HEADS_VALUE, + ATTENTION_PAGED_UNIFIED_SLIDING_WINDOW_VALUE, + ATTENTION_PAGED_UNIFIED_Q_UNIFORM_LEN_VALUE, + ATTENTION_PAGED_UNIFIED_Q_SEQ_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_Q_TOK_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_Q_HEAD_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_O_SEQ_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_O_TOK_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_O_HEAD_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_KV_BLOCK_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_KV_TOK_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_KV_HEAD_STRIDE_VALUE, + ATTENTION_PAGED_UNIFIED_KV_BLOCK_SPAN_BYTES_VALUE, + ATTENTION_PAGED_UNIFIED_Q_BLOCK_GRID_VALUE, + ATTENTION_PAGED_UNIFIED_SINK_IS_F32_VALUE, + ATTENTION_PAGED_UNIFIED_NUM_KV_BLOCKS_VALUE, + ATTENTION_PAGED_UNIFIED_BLOCK_TABLE_WIDTH_VALUE, + ATTENTION_PAGED_UNIFIED_BLOCK_THREADS_VALUE}); + + const auto refuse = [&inputs](std::string_view name, const std::string& rule) { + serialization::refuseIngestorPlan(serialization::IngestorPlanRefusal::INCOMPATIBLE, + "launch value '" + std::string(name) + "' of dispatch '" + + inputs.dispatchSymbol + "' must be " + rule); + }; + // Every by-value argument is a kernel int32. + const auto int32 = [&inputs](std::string_view name, int64_t lowest, int64_t highest) { + return static_cast(requireLaunchInt(inputs, name, lowest, highest)); + }; + const auto stride = [&int32](std::string_view name) { return int32(name, 0, INT32_LIMIT); }; + + AttentionPagedUnifiedLaunchInputs launch; + auto& u = launch.uids; + u.q = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_Q_UID_VALUE); + u.k = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_K_UID_VALUE); + u.v = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_V_UID_VALUE); + u.o = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_O_UID_VALUE); + u.pageTableK = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_PAGE_TABLE_K_UID_VALUE); + u.pageTableV = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_PAGE_TABLE_V_UID_VALUE); + u.seqLenKv = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_SEQ_LEN_KV_UID_VALUE); + u.seqLenQ = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_SEQ_LEN_Q_UID_VALUE); + u.raggedOffset = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_RAGGED_OFFSET_UID_VALUE); + u.sink = requireLaunchInt(inputs, ATTENTION_PAGED_UNIFIED_SINK_UID_VALUE); + const bool ragged = u.raggedOffset != ATTENTION_PAGED_UNIFIED_NO_UID; + + auto& s = launch.scalars; + // A double that is not a float value was not written from the float the kernel takes. + const double scale = requireLaunchDouble(inputs, ATTENTION_PAGED_UNIFIED_SCALE_VALUE); + constexpr auto FLOAT_MAX = static_cast(std::numeric_limits::max()); + const bool isFloat = std::isfinite(scale) && std::abs(scale) <= FLOAT_MAX + && static_cast(static_cast(scale)) == scale; + if(!isFloat || !isServedAttentionScale(static_cast(scale))) + { + refuse(ATTENTION_PAGED_UNIFIED_SCALE_VALUE, + "a finite float value, and the plan holds " + std::to_string(scale)); + } + s.scale = static_cast(scale); + + // The ragged sequence search takes its trip count from num_seqs at run time. + s.numSeqs = int32(ATTENTION_PAGED_UNIFIED_NUM_SEQS_VALUE, 1, INT32_LIMIT); + s.blockTableStride = stride(ATTENTION_PAGED_UNIFIED_BLOCK_TABLE_STRIDE_VALUE); + s.numQueryHeads = int32(ATTENTION_PAGED_UNIFIED_NUM_QUERY_HEADS_VALUE, 1, INT32_LIMIT); + s.numKvHeads = int32(ATTENTION_PAGED_UNIFIED_NUM_KV_HEADS_VALUE, 1, INT32_LIMIT); + if(s.numQueryHeads % s.numKvHeads != 0) + { + refuse(ATTENTION_PAGED_UNIFIED_NUM_QUERY_HEADS_VALUE, + "a multiple of '" + std::string(ATTENTION_PAGED_UNIFIED_NUM_KV_HEADS_VALUE) + + "', and the plan holds " + std::to_string(s.numQueryHeads) + " and " + + std::to_string(s.numKvHeads)); + } + s.slidingWindow = int32(ATTENTION_PAGED_UNIFIED_SLIDING_WINDOW_VALUE, 1, NO_WINDOW); + // A dense Q has Sq rows per sequence; a ragged Q reads its rows from the offsets. + s.qUniformLen = ragged ? int32(ATTENTION_PAGED_UNIFIED_Q_UNIFORM_LEN_VALUE, 0, 0) + : int32(ATTENTION_PAGED_UNIFIED_Q_UNIFORM_LEN_VALUE, 1, INT32_LIMIT); + s.q = {stride(ATTENTION_PAGED_UNIFIED_Q_SEQ_STRIDE_VALUE), + stride(ATTENTION_PAGED_UNIFIED_Q_TOK_STRIDE_VALUE), + stride(ATTENTION_PAGED_UNIFIED_Q_HEAD_STRIDE_VALUE)}; + s.o = {stride(ATTENTION_PAGED_UNIFIED_O_SEQ_STRIDE_VALUE), + stride(ATTENTION_PAGED_UNIFIED_O_TOK_STRIDE_VALUE), + stride(ATTENTION_PAGED_UNIFIED_O_HEAD_STRIDE_VALUE)}; + s.kvBlockStride = stride(ATTENTION_PAGED_UNIFIED_KV_BLOCK_STRIDE_VALUE); + s.kvTokStride = stride(ATTENTION_PAGED_UNIFIED_KV_TOK_STRIDE_VALUE); + s.kvHeadStride = stride(ATTENTION_PAGED_UNIFIED_KV_HEAD_STRIDE_VALUE); + s.kvBlockSpanBytes + = int32(ATTENTION_PAGED_UNIFIED_KV_BLOCK_SPAN_BYTES_VALUE, 1, MAX_BLOCK_SPAN_BYTES); + s.qBlockGrid = int32(ATTENTION_PAGED_UNIFIED_Q_BLOCK_GRID_VALUE, 1, MAX_GRID_Y); + // 1: sink_ptr holds FLOAT logits; 0: logits in the Q data type (or no sink). + s.sinkIsF32 = int32(ATTENTION_PAGED_UNIFIED_SINK_IS_F32_VALUE, 0, 1); + s.numKvBlocks = int32(ATTENTION_PAGED_UNIFIED_NUM_KV_BLOCKS_VALUE, 1, INT32_LIMIT); + s.blockTableWidth = int32(ATTENTION_PAGED_UNIFIED_BLOCK_TABLE_WIDTH_VALUE, 1, INT32_LIMIT); + + // The CTA is whole waves, at most the 1024 threads a HIP block holds. + launch.blockThreads = int32(ATTENTION_PAGED_UNIFIED_BLOCK_THREADS_VALUE, WAVE_LANES, 1024); + if(launch.blockThreads % WAVE_LANES != 0) + { + refuse(ATTENTION_PAGED_UNIFIED_BLOCK_THREADS_VALUE, + "a multiple of " + std::to_string(WAVE_LANES) + ", and the plan holds " + + std::to_string(launch.blockThreads)); + } + return launch; +} + +void resetAttentionPagedUnifiedModuleCache() +{ + moduleCache().clear(); +} + +void registerAttentionPagedUnifiedSymbols(SymbolScope& scope) +{ + static const compilation::KpackKernelLoader s_loader(moduleCache()); + static const AttentionPagedUnifiedDispatchHandler s_handler(s_loader); + scope.add(std::string(GRAPH_MATCHER_SYMBOL), &graphMatches); + scope.add(std::string(GFX942_MATCHER_SYMBOL), &gfx942PackMatches); + scope.add(std::string(GFX950_MATCHER_SYMBOL), &gfx950PackMatches); + scope.add(std::string(KERNEL_MATCHER_SYMBOL), &kernelMatches); + // The UDD's unversioned name dispatches the catalog; saved plans carry the versioned + // name of their launch-value contract. One handler serves both. + scope.add(std::string(DISPATCH_SYMBOL), &s_handler); + scope.add(std::string(ATTENTION_PAGED_UNIFIED_DISPATCH_SYMBOL_V1), &s_handler); +} + +} // namespace hip_kernel_provider::kernel_ingestor_engine + +#endif // HIPDNN_ENABLE_KERNEL_INGESTOR diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/AttentionTiled2DSignature.hpp b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/AttentionTiled2DSignature.hpp new file mode 100644 index 000000000000..8cb96a6489f6 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/AttentionTiled2DSignature.hpp @@ -0,0 +1,96 @@ +// Copyright © Advanced Micro Devices, Inc., or its affiliates. +// SPDX-License-Identifier: MIT + +#pragma once + +#include +#include +#include +#include + +#include + +/** + * @file AttentionTiled2DSignature.hpp + * @brief The kernel signature of rocKE's tiled 2D unified attention + * (`kernels/{gfx942,gfx950}/attention_tiled_2d.py`, `build_unified_attention_2d_tiled`), + * shared by every engine that launches it. + * + * NAMES ARE LOAD-BEARING. requireSignatureMatch compares kind and size always, but names + * only when BOTH sides carry one. Kind and size alone cannot tell the ten pointers apart, nor + * the f32 scalars from the i32 ones, so without names an operand permutation passes the check + * and the kernel reads the wrong buffers with no error and no status code. hkp_pack lowers + * the recorded names out of the rocKE builder's own parameter list, so keep these spellings + * identical to the Python (build_unified_attention_2d_tiled's `b.param` calls); a divergence + * here fails every dispatch rather than silently weakening the check. + * + * Offsets mirror the packed kernarg layout. They are not compared -- they exist so the + * mismatch diagnostic prints the real layout beside the recorded one. + */ +namespace hip_kernel_provider::kernel_ingestor_engine +{ + +/// Appends one argument at the next offset its size aligns to. +inline void + appendKernelArgument(std::vector& signature, + std::string_view kind, + uint32_t size, + std::string_view name) +{ + uint32_t offset = 0; + if(!signature.empty()) + { + offset = signature.back().offset + signature.back().size; + } + offset = (offset + size - 1) / size * size; + signature.push_back(hipdnn_plugin_sdk::ingestor::KernelArgument{ + std::string(kind), size, offset, std::string(name)}); +} + +/// The arguments every tiled 2D body takes: 10 pointers, 6 scalars, the two strides +/// (`_attn_signature(include_bt_stride=True, include_qq_bias_stride=True)`) and the runtime +/// shape kernargs (`RUNTIME_KERNARG_FIELDS`: head counts and window). An LSE-on kernel +/// (@p emitLse) appends lse_ptr, 8-byte aligned after the runtime kernargs (read off the +/// compiled LSE kernel). A runtime_layout kernel appends its own arguments after these. +inline std::vector tiled2DKernelSignature(bool emitLse + = false) +{ + constexpr auto PTR = static_cast(sizeof(void*)); + constexpr auto I32 = static_cast(sizeof(int32_t)); + constexpr auto F32 = static_cast(sizeof(float)); + + std::vector signature; + for(const auto* name : {"output_ptr", + "query_ptr", + "key_cache_ptr", + "value_cache_ptr", + "sink_ptr", + "block_tables_ptr", + "seq_lens_ptr", + "alibi_slopes_ptr", + "qq_bias_ptr", + "query_start_len_ptr"}) + { + appendKernelArgument(signature, "global_buffer", PTR, name); + } + for(const auto* name : {"scale", "k_scale", "v_scale", "out_scale", "softcap"}) + { + appendKernelArgument(signature, "by_value", F32, name); + } + for(const auto* name : {"num_seqs", + "block_table_stride", + "qq_bias_stride_0", + "num_query_heads", + "num_kv_heads", + "sliding_window"}) + { + appendKernelArgument(signature, "by_value", I32, name); + } + if(emitLse) + { + appendKernelArgument(signature, "global_buffer", PTR, "lse_ptr"); + } + return signature; +} + +} // namespace hip_kernel_provider::kernel_ingestor_engine diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/Gfx1151WmmaAttentionNative.cpp b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/Gfx1151WmmaAttentionNative.cpp index 235039fcd7b5..c58c6be748db 100644 --- a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/Gfx1151WmmaAttentionNative.cpp +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/Gfx1151WmmaAttentionNative.cpp @@ -492,31 +492,6 @@ bool isWellFormedRaggedOperand(const data_objects::TensorAttributes& tensor) && !__builtin_mul_overflow(sliceEnd, int64_t{2}, &bytes) && fitsI32(bytes); } -/// A non-virtual device INT32 tensor read by the kernel at element `index * stride`, so -/// with no ragged offsets, pass-by-value storage or I32-overflowing addresses. -bool isDeviceI32Tensor(const data_objects::TensorAttributes* tensor) -{ - return tensor != nullptr && !tensor->virtual_() - && !tensor->ragged_offset_tensor_uid().has_value() - && !hipdnn_flatbuffers_sdk::utilities::isPassByValueTensor(tensor) - && tensor->data_type() == data_objects::DataType::INT32 && tensor->dims() != nullptr - && tensor->strides() != nullptr && tensor->dims()->size() == SDPA_RANK - && tensor->strides()->size() == SDPA_RANK; -} - -/// seq_len_q / seq_len_kv [B,1,1,1] or ragged offsets [B+1,1,1,1]: @p length INT32 -/// values the kernel reads as v[b], so the batch axis has unit stride. -bool isDeviceI32Vector(const data_objects::TensorAttributes* tensor, int64_t length) -{ - if(!isDeviceI32Tensor(tensor)) - { - return false; - } - const auto* dims = tensor->dims(); - return dims->Get(0) == length && dims->Get(1) == 1 && dims->Get(2) == 1 && dims->Get(3) == 1 - && (length == 1 || tensor->strides()->Get(0) == 1); -} - std::optional supportedDataTypeName(data_objects::DataType dataType) { if(dataType == data_objects::DataType::BFLOAT16) @@ -890,49 +865,6 @@ std::optional> return std::nullopt; } -/// Whether @p tensor declares a device-pointer alignment that is a multiple of @p bytes. -bool declaresAlignment(const data_objects::TensorAttributes& tensor, int64_t bytes) -{ - return tensor.alignment() >= bytes && tensor.alignment() % bytes == 0; -} - -/// A graph declares each operand's device-pointer alignment (16 bytes unless set; a graph -/// that sets it needs engine API 1.3.0, which this engine's 1.4.0 admits). The kernels -/// load Q / K / V / O rows as 16-byte vectors and INT32 operands as 4-byte words, so a -/// graph declaring less for any of them is declined here, with its cause logged, where -/// hipDNN can still pick another engine, rather than failing at execute. Each operand is -/// named by its role; null entries (absent operands) are skipped. -using NamedOperand = std::pair; -bool hasServedAlignment(std::string_view engine, - std::initializer_list rows, - std::initializer_list words) -{ - for(const auto& [role, tensor] : rows) - { - if(tensor != nullptr && !declaresAlignment(*tensor, static_cast(ROW_ALIGN_BYTES))) - { - HIPDNN_PLUGIN_LOG_INFO((sdpa_graph::DeclinedBy{engine, "alignment"}) - << role << " declares a " << tensor->alignment() - << "-byte alignment; the kernels load Q, K, V and O rows as " - "16-byte vectors, so each must declare a multiple of 16 " - "bytes"); - return false; - } - } - for(const auto& [role, tensor] : words) - { - if(tensor != nullptr && !declaresAlignment(*tensor, int64_t{alignof(int32_t)})) - { - HIPDNN_PLUGIN_LOG_INFO((sdpa_graph::DeclinedBy{engine, "alignment"}) - << role << " declares a " << tensor->alignment() - << "-byte alignment; the kernels read the INT32 page tables, " - "sequence lengths and ragged offsets as 4-byte words"); - return false; - } - } - return true; -} - /// Whether @p tensor (null when absent) declares at least the @p bytes its element loads /// and stores need; a graph declaring less is declined with the cause logged. bool hasElementAlignment(std::string_view engine, @@ -940,7 +872,7 @@ bool hasElementAlignment(std::string_view engine, const data_objects::TensorAttributes* tensor, int64_t bytes) { - if(tensor == nullptr || declaresAlignment(*tensor, bytes)) + if(tensor == nullptr || sdpa_graph::declaresAlignment(*tensor, bytes)) { return true; } @@ -1091,7 +1023,7 @@ std::optional sinkFor(std::string_view engine, return std::nullopt; } const int64_t bytes = isF32 ? int64_t{sizeof(float)} : int64_t{sizeof(uint16_t)}; - if(!declaresAlignment(*sink, bytes)) + if(!sdpa_graph::declaresAlignment(*sink, bytes)) { HIPDNN_PLUGIN_LOG_INFO((sdpa_graph::DeclinedBy{engine, "alignment"}) << "sink_token declares a " << sink->alignment() @@ -1103,42 +1035,24 @@ std::optional sinkFor(std::string_view engine, return SinkOperand{true, *uid, isF32}; } -/// The cuDNN paged-K/V graph. K / V are page containers [num_blocks, H, page, D] of any -/// (row-aligned) strides and any size (one page of one head must be I32-addressable), -/// including both halves of one interleaved cache, with one block size and one -/// num_blocks (the kernel bounds K and V page ids by one page count); unpacked INT32 -/// page tables [B,1,M,1] (unit entry stride), one for K and one for V (they may be one -/// tensor) of one width M and one row stride; seq_len_q and seq_len_kv [B,1,1,1] bound -/// the rows and keys, max_seq_len_kv (M * page when unset) bounds the keys at build -/// time. Q is dense [B, Hq, Sq, D] or ragged through offsets O shares. Additive bias -/// and stats with a ragged Q are declined; attention sinks select the sinks objects -/// (sinkFor). Declines log under @p engine's name. +/// The cuDNN paged-K/V graph, checked through the paged-graph contract checks every +/// paged pack shares (sdpa_graph::, SEM-009) plus this engine's kernel limits. K / V are +/// page containers [num_blocks, H, page, D] of any (row-aligned) strides and any size (one +/// page of one head must be I32-addressable), including both halves of one interleaved +/// cache, with one block size and one num_blocks; the page sizes are the shipped powers of +/// two; the page tables' entries are I32-addressable; max_seq_len_kv (M * page when unset) +/// bounds the keys at build time. Q is dense [B, Hq, Sq, D] or ragged through offsets O +/// shares, in tokens. Stats with a ragged Q are declined; attention sinks select the sinks +/// objects (sinkFor). Declines log under @p engine's name. std::optional gfx1151WmmaAttentionPagedGraphMatches(std::string_view engine, const MatchContext& context, const data_objects::SdpaAttributes& attributes) { - const auto tableUid = attributes.page_table_k_tensor_uid(); - const auto tableVUid = attributes.page_table_v_tensor_uid(); - if(!tableUid.has_value() || !tableVUid.has_value()) + if(!sdpa_graph::pagesKAndV(engine, attributes)) { - HIPDNN_PLUGIN_LOG_INFO((sdpa_graph::DeclinedBy{engine, "one_sided_paging"}) - << "only " << (tableUid.has_value() ? "K" : "V") - << " is paged; the kernels page both K and V or neither"); return std::nullopt; } - const auto* table = findTensor(context, *tableUid); - const auto* tableV = findTensor(context, *tableVUid); - for(const auto* pageTable : {table, tableV}) - { - if(pageTable != nullptr && pageTable->ragged_offset_tensor_uid().has_value()) - { - logDecline(engine, - "page_table", - "a packed (ragged) page table; the kernels read [B, 1, M, 1]"); - return std::nullopt; - } - } const auto* q = findTensor(context, attributes.q_tensor_uid()); const auto* k = findTensor(context, attributes.k_tensor_uid()); @@ -1149,21 +1063,8 @@ std::optional { return std::nullopt; } - if(v->dims()->Get(SEQ_AXIS) != k->dims()->Get(SEQ_AXIS)) - { - HIPDNN_PLUGIN_LOG_INFO((sdpa_graph::DeclinedBy{engine, "block_size"}) - << "the K and V containers differ in block size (" - << k->dims()->Get(SEQ_AXIS) << " and " << v->dims()->Get(SEQ_AXIS) - << "); the kernels address both with one"); - return std::nullopt; - } - if(v->dims()->Get(BATCH_AXIS) != k->dims()->Get(BATCH_AXIS)) + if(!sdpa_graph::pagedContainersAgree(engine, *k, *v)) { - HIPDNN_PLUGIN_LOG_INFO((sdpa_graph::DeclinedBy{engine, "shape"}) - << "the K and V containers differ in page count (" - << k->dims()->Get(BATCH_AXIS) << " and " - << v->dims()->Get(BATCH_AXIS) - << "); the kernels bound both page ids by one"); return std::nullopt; } const bool raggedQ = q->ragged_offset_tensor_uid().has_value(); @@ -1246,47 +1147,26 @@ std::optional } } - const auto isPageTable = [&](const data_objects::TensorAttributes* pageTable) { - return isDeviceI32Tensor(pageTable) && pageTable->dims()->Get(0) == p.batch - && pageTable->dims()->Get(1) == 1 && pageTable->dims()->Get(2) > 0 - && pageTable->dims()->Get(3) == 1 - && (pageTable->dims()->Get(2) == 1 || pageTable->strides()->Get(2) == 1) - && pageTable->strides()->Get(0) >= 0 && fitsI32(pageTable->strides()->Get(0)) - && addressFitsI32(*pageTable, 4); - }; - for(const auto& [role, pageTable] : - {NamedOperand{"page_table_k", table}, NamedOperand{"page_table_v", tableV}}) + const auto tables = sdpa_graph::pageTablesFor(engine, context, attributes, p.batch); + if(!tables.has_value()) { - if(!isPageTable(pageTable)) + return std::nullopt; + } + for(const auto& [role, table] : {sdpa_graph::NamedOperand{"page_table_k", tables->k}, + sdpa_graph::NamedOperand{"page_table_v", tables->v}}) + { + if(!fitsI32(table->strides()->Get(BATCH_AXIS)) || !addressFitsI32(*table, 4)) { HIPDNN_PLUGIN_LOG_INFO((sdpa_graph::DeclinedBy{engine, "page_table"}) << role - << " must be a device INT32 [B, 1, M, 1] tensor with a unit " - "entry stride whose entries are I32-addressable"); + << "'s entries must be I32-addressable: the kernels index " + "the page tables in 32 bits"); return std::nullopt; } } - // The kernel reads both tables at one row offset. With one sequence the row stride is - // never used. - if(tableV->dims()->Get(2) != table->dims()->Get(2)) - { - HIPDNN_PLUGIN_LOG_INFO((sdpa_graph::DeclinedBy{engine, "page_table"}) - << "the K and V page tables differ in width (" - << table->dims()->Get(2) << " and " << tableV->dims()->Get(2) - << "); the kernels read both at one row offset"); - return std::nullopt; - } - if(p.batch > 1 && tableV->strides()->Get(0) != table->strides()->Get(0)) - { - HIPDNN_PLUGIN_LOG_INFO((sdpa_graph::DeclinedBy{engine, "page_table"}) - << "the K and V page tables differ in row stride (" - << table->strides()->Get(0) << " and " << tableV->strides()->Get(0) - << "); the kernels read both at one row offset"); - return std::nullopt; - } // The keys one table row maps. An unset max_seq_len_kv is inferred from it as cuDNN does // (SEM-009); the kernels use it only as the bound on seq_len_kv. - const int64_t tableKeys = table->dims()->Get(2) * page; + const int64_t tableKeys = tables->k->dims()->Get(SEQ_AXIS) * page; const int64_t maxSeqLenKv = attributes.max_seq_len_kv().has_value() ? int64_t{attributes.max_seq_len_kv().value()} : tableKeys; @@ -1294,50 +1174,24 @@ std::optional { return std::nullopt; } - const auto seqLenKv = attributes.seq_len_kv_tensor_uid(); - const auto seqLenQ = attributes.seq_len_q_tensor_uid(); - if(!seqLenKv.has_value()) - { - logDecline(engine, "seq_len_kv", "a paged graph needs seq_len_kv"); - return std::nullopt; - } - if(!seqLenQ.has_value()) - { - logDecline(engine, "seq_len_q", "a paged graph needs seq_len_q"); - return std::nullopt; - } - const auto* seqLenKvTensor = findTensor(context, *seqLenKv); - const auto* seqLenQTensor = findTensor(context, *seqLenQ); - const auto* qOffsets = raggedQ ? findTensor(context, *q->ragged_offset_tensor_uid()) : nullptr; - if(!isDeviceI32Vector(seqLenKvTensor, p.batch)) + const auto lengths = sdpa_graph::sequenceLengthsFor(engine, context, attributes, p.batch); + if(!lengths.has_value()) { - logDecline(engine, - "seq_len_kv", - "seq_len_kv must be a device INT32 [B, 1, 1, 1] vector with a unit stride"); return std::nullopt; } - if(!isDeviceI32Vector(seqLenQTensor, p.batch)) + const auto query = sdpa_graph::raggedQueryFor(engine, context, *q, *o, *k, *v, p.batch); + if(!query.has_value()) { - logDecline(engine, - "seq_len_q", - "seq_len_q must be a device INT32 [B, 1, 1, 1] vector with a unit stride"); - return std::nullopt; - } - if(raggedQ && !isDeviceI32Vector(qOffsets, p.batch + 1)) - { - logDecline(engine, - "ragged", - "the ragged offsets must be a device INT32 [B+1, 1, 1, 1] vector with a unit " - "stride"); return std::nullopt; } - if(!hasServedAlignment(engine, - {{"Q", q}, {"K", k}, {"V", v}, {"O", o}}, - {{"page_table_k", table}, - {"page_table_v", tableV}, - {"seq_len_kv", seqLenKvTensor}, - {"seq_len_q", seqLenQTensor}, - {"ragged_offset", qOffsets}})) + if(!sdpa_graph::declaresServedAlignment(engine, + {{"Q", q}, {"K", k}, {"V", v}, {"O", o}}, + static_cast(ROW_ALIGN_BYTES), + {{"page_table_k", tables->k}, + {"page_table_v", tables->v}, + {"seq_len_kv", lengths->kv}, + {"seq_len_q", lengths->q}, + {"ragged_offset", query->offsets}})) { return std::nullopt; } @@ -1358,9 +1212,8 @@ std::optional { return std::nullopt; } - if(attributes.attn_mask_tensor_uid().has_value()) + if(!sdpa_graph::takesNoAttentionMask(engine, attributes)) { - logDecline(engine, "attn_mask", "the paged kernels take no additive attention mask"); return std::nullopt; } if(!bindCommon(engine, context, attributes, *lse, bound)) @@ -1371,15 +1224,15 @@ std::optional bound[std::string(BIAS_TOKEN)] = static_cast(BiasKind::NONE); bound[std::string(LAYOUT_TOKEN)] = static_cast(layout); bound[std::string(PAGE_SIZE_TOKEN)] = page; - bound[std::string(PAGE_TABLE_UID_TOKEN)] = *tableUid; - bound[std::string(PAGE_TABLE_V_UID_TOKEN)] = *tableVUid; - bound[std::string(PAGE_TABLE_STRIDE_TOKEN)] = table->strides()->Get(0); - bound[std::string(SEQ_LEN_KV_UID_TOKEN)] = *seqLenKv; + bound[std::string(PAGE_TABLE_UID_TOKEN)] = tables->kUid; + bound[std::string(PAGE_TABLE_V_UID_TOKEN)] = tables->vUid; + bound[std::string(PAGE_TABLE_STRIDE_TOKEN)] = tables->k->strides()->Get(BATCH_AXIS); + bound[std::string(SEQ_LEN_KV_UID_TOKEN)] = lengths->kvUid; bound[std::string(MAX_SEQ_LEN_KV_TOKEN)] = maxSeqLenKv; - bound[std::string(SEQ_LEN_Q_UID_TOKEN)] = *seqLenQ; + bound[std::string(SEQ_LEN_Q_UID_TOKEN)] = lengths->qUid; if(raggedQ) { - bound[std::string(Q_OFFSET_UID_TOKEN)] = *q->ragged_offset_tensor_uid(); + bound[std::string(Q_OFFSET_UID_TOKEN)] = query->offsetsUid; } if(sink->present) { @@ -1466,7 +1319,10 @@ std::optional graphMatchesFor(std::string_view engine, const MatchC "the dense layout has no padded-batch form"); return std::nullopt; } - if(!hasServedAlignment(engine, {{"Q", q}, {"K", k}, {"V", v}, {"O", o}}, {})) + if(!sdpa_graph::declaresServedAlignment(engine, + {{"Q", q}, {"K", k}, {"V", v}, {"O", o}}, + static_cast(ROW_ALIGN_BYTES), + {})) { return std::nullopt; } diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/Gfx942AttentionUnified3dNative.cpp b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/Gfx942AttentionUnified3dNative.cpp index b4500b90acd9..7f988ea7f3e1 100644 --- a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/Gfx942AttentionUnified3dNative.cpp +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/Gfx942AttentionUnified3dNative.cpp @@ -114,6 +114,7 @@ constexpr std::string_view O_TOKEN = "gfx942_attention_unified3d.o.uid"; constexpr std::string_view SCALE_BITS_TOKEN = "gfx942_attention_unified3d.scale_bits"; using sdpa_graph::BATCH_AXIS; +using sdpa_graph::checkedProduct; using sdpa_graph::describeOperand; using sdpa_graph::findTensor; using sdpa_graph::hasSdpaForwardNode; @@ -145,20 +146,6 @@ constexpr int64_t PREFERRED_BLOCK_SIZE = 16; // Matching helpers // --------------------------------------------------------------------------- -/// The product of @p factors, or nullopt when it does not fit in int64_t. -std::optional checkedProduct(std::initializer_list factors) -{ - int64_t product = 1; - for(const int64_t factor : factors) - { - if(__builtin_mul_overflow(product, factor, &product)) - { - return std::nullopt; - } - } - return product; -} - /** * @brief Is this Q or O tensor the contiguous `[B, Hq, D]` rocKE requires? * diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/SdpaGraphMatch.hpp b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/SdpaGraphMatch.hpp index a0f41ffa7bce..19c20b626e0c 100644 --- a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/SdpaGraphMatch.hpp +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/SdpaGraphMatch.hpp @@ -19,7 +19,9 @@ #include #include #include +#include #include +#include #include #include "engines/kernel_ingestor_engine/packs/PackFeatures.hpp" @@ -33,8 +35,8 @@ * overlap checks and the limits the FlyDSL SDPA families bound by, and the * decline-line head. * - * Pack-family rules (mask kinds, dtypes, the decode rule) stay with the family, e.g. - * UnifiedAttentionGraphMatch.hpp. + * Pack-family rules (mask kinds, dtypes, the decode rule, kernel limits) stay with the + * family, e.g. UnifiedAttentionGraphMatch.hpp. */ namespace hip_kernel_provider::kernel_ingestor_engine::sdpa_graph { @@ -296,4 +298,430 @@ inline std::string describeOperand(std::string_view role, return out.str(); } +// --------------------------------------------------------------------------- +// Operand checks stricter than isWellFormedOperand +// --------------------------------------------------------------------------- + +/// Whether the graph asks for override shapes (admitted from engine API 1.4.0). A pack +/// that derives its launch arguments from the built shapes declines such a graph. +inline bool usesOverrideShapes(const MatchContext& context) +{ + return context.graph.getGraph().is_override_shape_enabled(); +} + +/// Whether every stride is non-negative. Callers must have checked isWellFormedOperand(). +inline bool hasNonNegativeStrides(const data_objects::TensorAttributes& tensor) +{ + for(const auto stride : *tensor.strides()) + { + if(stride < 0) + { + return false; + } + } + return true; +} + +/// An INT32 device vector `[length, 1, 1, 1]` read as v[i]: well formed, non-negative +/// strides, not ragged, and a unit stride along its one non-unit axis. +inline bool isInt32Vector(const data_objects::TensorAttributes& tensor, int64_t length) +{ + if(!isWellFormedOperand(tensor) || !hasNonNegativeStrides(tensor) + || tensor.data_type() != data_objects::DataType::INT32 + || tensor.ragged_offset_tensor_uid().has_value() || tensor.dims()->Get(BATCH_AXIS) != length + || tensor.dims()->Get(HEAD_AXIS) != 1 || tensor.dims()->Get(SEQ_AXIS) != 1 + || tensor.dims()->Get(HEAD_SIZE_AXIS) != 1) + { + return false; + } + return length == 1 || tensor.strides()->Get(BATCH_AXIS) == 1; +} + +// --------------------------------------------------------------------------- +// cuDNN paged-K/V graphs (SdpaSemanticsRegister SEM-009) +// +// The contract checks every pack serving a paged SDPA-forward graph applies, with one +// cause vocabulary. Each logs its decline through DeclinedBy with the calling engine's +// name and returns false (or nullopt); the engine keeps its own kernel limits (block +// sizes, head sizes, address ranges) and calls these in place of its own copies. +// +// Cause keys: one_sided_paging, block_size, shape, page_table, seq_len_kv, seq_len_q, +// ragged, alignment, sinks, attn_mask. +// --------------------------------------------------------------------------- + +/// The paged graph pages both K and V, through page_table_k and page_table_v (which may +/// be one tensor). cuDNN also allows K or V paged alone, which no paged kernel here reads. +inline bool pagesKAndV(std::string_view engine, const data_objects::SdpaAttributes& attributes) +{ + const bool pagedK = attributes.page_table_k_tensor_uid().has_value(); + const bool pagedV = attributes.page_table_v_tensor_uid().has_value(); + if(pagedK && pagedV) + { + return true; + } + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "one_sided_paging"}) + << (pagedK || pagedV ? (pagedK ? "only K is paged" : "only V is paged") + : "neither K nor V is paged") + << "; the kernels page both K and V"); + return false; +} + +/// The paged K and V containers `[num_blocks, H, block_size, D]` share one block size and +/// one block count: the kernels address both with one block size and bound both page ids +/// by one block count. Both must be well formed. Their head counts and head sizes are the +/// engine's to check. +inline bool pagedContainersAgree(std::string_view engine, + const data_objects::TensorAttributes& k, + const data_objects::TensorAttributes& v) +{ + if(v.dims()->Get(SEQ_AXIS) != k.dims()->Get(SEQ_AXIS)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "block_size"}) + << "the K and V containers differ in block size (" + << k.dims()->Get(SEQ_AXIS) << " and " << v.dims()->Get(SEQ_AXIS) + << "); the kernels address both with one"); + return false; + } + if(v.dims()->Get(BATCH_AXIS) != k.dims()->Get(BATCH_AXIS)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "shape"}) + << "the K and V containers differ in page count (" + << k.dims()->Get(BATCH_AXIS) << " and " << v.dims()->Get(BATCH_AXIS) + << "); the kernels bound both page ids by one"); + return false; + } + return true; +} + +/// The two page tables of a paged graph, K's and V's (the same tensor when one pages both). +struct PageTables +{ + int64_t kUid = 0; + int64_t vUid = 0; + const data_objects::TensorAttributes* k = nullptr; + const data_objects::TensorAttributes* v = nullptr; +}; + +/// The page tables: INT32 `[B, 1, M, 1]` with a unit entry stride, not packed (no +/// ragged_offset). Separate K and V tables share one width M and one batch stride: the +/// kernels read both at one row offset. A graph that does not page both K and V is +/// declined through pagesKAndV(). +inline std::optional pageTablesFor(std::string_view engine, + const MatchContext& context, + const data_objects::SdpaAttributes& attributes, + int64_t batch) +{ + if(!pagesKAndV(engine, attributes)) + { + return std::nullopt; + } + PageTables tables; + tables.kUid = *attributes.page_table_k_tensor_uid(); + tables.vUid = *attributes.page_table_v_tensor_uid(); + tables.k = findTensor(context, tables.kUid); + tables.v = findTensor(context, tables.vUid); + for(const auto& [role, table] : {std::pair{std::string_view("page_table_k"), tables.k}, + std::pair{std::string_view("page_table_v"), tables.v}}) + { + if(table == nullptr || !isWellFormedOperand(*table) || !hasNonNegativeStrides(*table)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "page_table"}) + << role + << " is missing, virtual, pass-by-value, not rank 4, or has " + "a non-positive extent or negative stride"); + return std::nullopt; + } + if(table->ragged_offset_tensor_uid().has_value()) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "page_table"}) + << role + << " is packed (has a ragged_offset); the kernels read B rows " + "of M entries"); + return std::nullopt; + } + const auto* dims = table->dims(); + if(table->data_type() != data_objects::DataType::INT32 || dims->Get(BATCH_AXIS) != batch + || dims->Get(HEAD_AXIS) != 1 || dims->Get(HEAD_SIZE_AXIS) != 1 + || (dims->Get(SEQ_AXIS) > 1 && table->strides()->Get(SEQ_AXIS) != 1)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "page_table"}) + << role + << " must be a device INT32 [B, 1, M, 1] tensor with a unit " + "entry stride; got " + << describeOperand(role, *table)); + return std::nullopt; + } + } + if(tables.vUid != tables.kUid) + { + if(tables.v->dims()->Get(SEQ_AXIS) != tables.k->dims()->Get(SEQ_AXIS)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "page_table"}) + << "the K and V page tables differ in width (" + << tables.k->dims()->Get(SEQ_AXIS) << " and " + << tables.v->dims()->Get(SEQ_AXIS) + << "); the kernels read both at one row offset"); + return std::nullopt; + } + if(batch > 1 + && tables.v->strides()->Get(BATCH_AXIS) != tables.k->strides()->Get(BATCH_AXIS)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "page_table"}) + << "the K and V page tables differ in row stride (" + << tables.k->strides()->Get(BATCH_AXIS) << " and " + << tables.v->strides()->Get(BATCH_AXIS) + << "); the kernels read both at one row offset"); + return std::nullopt; + } + } + return tables; +} + +/// seq_len_q and seq_len_kv, which a paged graph carries both of (also for a dense Q). +struct SequenceLengths +{ + int64_t kvUid = 0; + int64_t qUid = 0; + const data_objects::TensorAttributes* kv = nullptr; + const data_objects::TensorAttributes* q = nullptr; +}; + +/// The sequence lengths: INT32 `[B, 1, 1, 1]` device vectors with a unit stride. Checks +/// seq_len_kv first, then seq_len_q. +inline std::optional + sequenceLengthsFor(std::string_view engine, + const MatchContext& context, + const data_objects::SdpaAttributes& attributes, + int64_t batch) +{ + const auto lengthFor = [&](std::string_view role, + const flatbuffers::Optional& uid, + const data_objects::TensorAttributes*& tensor, + int64_t& tensorUid) { + if(!uid.has_value()) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, role}) << "a paged graph needs " << role); + return false; + } + tensor = findTensor(context, *uid); + if(tensor == nullptr || !isInt32Vector(*tensor, batch)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, role}) + << role + << " must be a device INT32 [B, 1, 1, 1] vector with a unit " + "stride"); + return false; + } + tensorUid = *uid; + return true; + }; + SequenceLengths lengths; + if(!lengthFor("seq_len_kv", attributes.seq_len_kv_tensor_uid(), lengths.kv, lengths.kvUid) + || !lengthFor("seq_len_q", attributes.seq_len_q_tensor_uid(), lengths.q, lengths.qUid)) + { + return std::nullopt; + } + return lengths; +} + +/// A ragged Q's offsets (RFC 0014), or none for a dense Q. +struct RaggedQuery +{ + bool ragged = false; + int64_t offsetsUid = 0; + const data_objects::TensorAttributes* offsets = nullptr; +}; + +/// Q and O are both dense, or both ragged at the sequence axis through one INT32 +/// `[B+1, 1, 1, 1]` offset tensor with a unit stride; paged K and V are never ragged. +/// Call with well-formed Q, O, K and V. +inline std::optional raggedQueryFor(std::string_view engine, + const MatchContext& context, + const data_objects::TensorAttributes& q, + const data_objects::TensorAttributes& o, + const data_objects::TensorAttributes& k, + const data_objects::TensorAttributes& v, + int64_t batch) +{ + const auto qOffsets = q.ragged_offset_tensor_uid(); + const auto oOffsets = o.ragged_offset_tensor_uid(); + if(qOffsets.has_value() != oOffsets.has_value() + || (qOffsets.has_value() && *qOffsets != *oOffsets)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "ragged"}) + << "Q and O must both be dense or both ragged through the same " + "ragged_offset tensor"); + return std::nullopt; + } + if(k.ragged_offset_tensor_uid().has_value() || v.ragged_offset_tensor_uid().has_value()) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "ragged"}) + << "ragged K/V containers are not supported; paged K and V are " + "addressed through their page tables"); + return std::nullopt; + } + RaggedQuery query; + if(!qOffsets.has_value()) + { + return query; + } + query.ragged = true; + query.offsetsUid = *qOffsets; + query.offsets = findTensor(context, query.offsetsUid); + if(query.offsets == nullptr || !isInt32Vector(*query.offsets, batch + 1)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "ragged"}) + << "the ragged offsets must be a device INT32 [B+1, 1, 1, 1] " + "vector with a unit stride"); + return std::nullopt; + } + return query; +} + +/// A ragged Q's or O's offsets count tokens: its ragged_offset_multiplier is its token +/// (sequence-axis) stride. The kernels take rows per sequence and query-block starts from +/// the stored offsets themselves and scale only a sequence's base; RFC 0014 also allows +/// other units, which they would misread. +inline bool countsOffsetsInTokens(std::string_view engine, + std::string_view role, + const data_objects::TensorAttributes& tensor) +{ + if(tensor.ragged_offset_multiplier() == tensor.strides()->Get(SEQ_AXIS)) + { + return true; + } + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "ragged"}) + << describeOperand(role, tensor) << " with ragged_offset_multiplier " + << tensor.ragged_offset_multiplier() + << ": the multiplier must equal the sequence-axis (token) stride; " + "the kernels read stored offsets as token counts"); + return false; +} + +/// An operand and the name a decline gives it. +using NamedOperand = std::pair; + +/** + * @brief The declared device-pointer alignments the kernels need (engine API 1.3.0 lets a + * graph declare them; 16 bytes unless set). + * + * The kernels load Q/K/V/O as @p vectorBytes vectors and the INT32 page tables, sequence + * lengths and ragged offsets as 4-byte words, so a graph declaring less for any of them is + * declined here, where hipDNN can still pick another engine, rather than at execute. + * Null operands (absent ones) are skipped. + */ +inline bool declaresServedAlignment(std::string_view engine, + std::initializer_list vectorOperands, + int64_t vectorBytes, + std::initializer_list wordOperands) +{ + for(const auto& [role, tensor] : vectorOperands) + { + if(tensor != nullptr && !declaresAlignment(*tensor, vectorBytes)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "alignment"}) + << role << " declares a " << tensor->alignment() + << "-byte alignment; the kernels load Q, K, V and O as " + << vectorBytes << "-byte vectors, so each must declare a " + << "multiple of " << vectorBytes << " bytes"); + return false; + } + } + for(const auto& [role, tensor] : wordOperands) + { + if(tensor != nullptr && !declaresAlignment(*tensor, int64_t{sizeof(int32_t)})) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "alignment"}) + << role << " declares a " << tensor->alignment() + << "-byte alignment; the kernels read the INT32 page tables, " + "sequence lengths and ragged offsets as 4-byte words"); + return false; + } + } + return true; +} + +/// The graph's attention sink, if it has one. +struct SinkOperand +{ + bool present = false; + int64_t uid = 0; + const data_objects::TensorAttributes* tensor = nullptr; + /// FLOAT logits (cuDNN's form); otherwise the logits are in Q's data type. + bool f32 = false; +}; + +/** + * @brief The attention sink (SEM-022): sink_token `[1, Hq, 1, 1]`, one logit per query + * head, which the kernels load at index `query head`. + * + * Served as FLOAT (cuDNN's form) or in Q's data type, with a unit head stride; any other + * data type is declined (cause `sinks`). @p minAlignmentBytes is the calling engine's sink + * load width: a sink declaring less is declined with cause `alignment`. Absent sink: + * present = false. + */ +inline std::optional sinkFor(std::string_view engine, + const MatchContext& context, + const data_objects::SdpaAttributes& attributes, + int64_t numQueryHeads, + data_objects::DataType queryType, + int64_t minAlignmentBytes) +{ + SinkOperand sink; + const auto uid = attributes.sink_token_tensor_uid(); + if(!uid.has_value()) + { + return sink; + } + sink.present = true; + sink.uid = *uid; + sink.tensor = findTensor(context, sink.uid); + const auto* tensor = sink.tensor; + if(tensor == nullptr || !isWellFormedOperand(*tensor) || !hasNonNegativeStrides(*tensor) + || tensor->ragged_offset_tensor_uid().has_value() || tensor->dims()->Get(BATCH_AXIS) != 1 + || tensor->dims()->Get(HEAD_AXIS) != numQueryHeads || tensor->dims()->Get(SEQ_AXIS) != 1 + || tensor->dims()->Get(HEAD_SIZE_AXIS) != 1) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "sinks"}) + << "sink_token must be a device tensor [1, Hq, 1, 1] (Hq = " + << numQueryHeads << ", one logit per query head)"); + return std::nullopt; + } + if(tensor->data_type() != data_objects::DataType::FLOAT && tensor->data_type() != queryType) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "sinks"}) + << "sink_token's data type is neither FLOAT nor the Q data type"); + return std::nullopt; + } + sink.f32 = tensor->data_type() == data_objects::DataType::FLOAT; + if(numQueryHeads > 1 && tensor->strides()->Get(HEAD_AXIS) != 1) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "sinks"}) + << "the kernels read sink_token with a unit head stride"); + return std::nullopt; + } + if(!declaresAlignment(*tensor, minAlignmentBytes)) + { + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "alignment"}) + << "sink_token declares a " << tensor->alignment() + << "-byte alignment; the kernels load the sink with " + << minAlignmentBytes << "-byte alignment"); + return std::nullopt; + } + return sink; +} + +/// No additive attention mask (attn_mask): the paged kernels take no bias input. +inline bool takesNoAttentionMask(std::string_view engine, + const data_objects::SdpaAttributes& attributes) +{ + if(!attributes.attn_mask_tensor_uid().has_value()) + { + return true; + } + HIPDNN_PLUGIN_LOG_INFO((DeclinedBy{engine, "attn_mask"}) + << "the paged kernels take no additive attention mask"); + return false; +} + } // namespace hip_kernel_provider::kernel_ingestor_engine::sdpa_graph diff --git a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/UnifiedAttention2DCommon.hpp b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/UnifiedAttention2DCommon.hpp index 7c61f5661ef2..d583f186d4b5 100644 --- a/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/UnifiedAttention2DCommon.hpp +++ b/dnn-providers/hip-kernel-provider/src/engines/kernel_ingestor_engine/packs/UnifiedAttention2DCommon.hpp @@ -27,6 +27,7 @@ #include "compilation/KpackKernelLoader.hpp" #include "core/Handle.hpp" #include "engines/kernel_ingestor_engine/IngestorKernelCode.hpp" +#include "engines/kernel_ingestor_engine/packs/AttentionTiled2DSignature.hpp" #include "engines/kernel_ingestor_engine/packs/UnifiedAttentionGeometry.hpp" #include "engines/kernel_ingestor_engine/packs/UnifiedAttentionGraphMatch.hpp" @@ -352,58 +353,6 @@ bool kernelMatches(const MatchContext& context, .has_value(); } -/// The kernel signature for all variants of the 2D engines: 10 pointers, 6 scalars, the two -/// strides (`_attn_signature(include_bt_stride=True, include_qq_bias_stride=True)`) and the -/// runtime shape kernargs (`RUNTIME_KERNARG_FIELDS`: head counts and window). -/// -/// NAMES ARE LOAD-BEARING. requireSignatureMatch compares kind and size always, but names -/// only when BOTH sides carry one. Kind and size alone cannot tell the ten pointers apart, nor -/// the f32 scalars from the i32 ones, so without names an operand permutation passes the check -/// and the kernel reads the wrong buffers with no error and no status code. hkp_pack lowers -/// the recorded names out of the rocKE builder's own parameter list, so keep these spellings -/// identical to the Python (kernels//attention_tiled_2d.py, -/// build_unified_attention_2d_tiled's `b.param` calls); a divergence here fails every -/// dispatch rather than silently weakening the check. -/// -/// Offsets mirror the packed kernarg layout. They are not compared; they exist so the -/// mismatch diagnostic prints the real layout beside the recorded one. An LSE-on kernel -/// (@p emitLse) appends lse_ptr. -inline std::vector unified2DKernelSignature(bool emitLse = false) -{ - constexpr auto PTR = static_cast(sizeof(void*)); - constexpr auto I32 = static_cast(sizeof(int32_t)); - constexpr auto F32 = static_cast(sizeof(float)); - - std::vector arguments{ - KernelArgument{"global_buffer", PTR, 0, "output_ptr"}, - KernelArgument{"global_buffer", PTR, 8, "query_ptr"}, - KernelArgument{"global_buffer", PTR, 16, "key_cache_ptr"}, - KernelArgument{"global_buffer", PTR, 24, "value_cache_ptr"}, - KernelArgument{"global_buffer", PTR, 32, "sink_ptr"}, - KernelArgument{"global_buffer", PTR, 40, "block_tables_ptr"}, - KernelArgument{"global_buffer", PTR, 48, "seq_lens_ptr"}, - KernelArgument{"global_buffer", PTR, 56, "alibi_slopes_ptr"}, - KernelArgument{"global_buffer", PTR, 64, "qq_bias_ptr"}, - KernelArgument{"global_buffer", PTR, 72, "query_start_len_ptr"}, - KernelArgument{"by_value", F32, 80, "scale"}, - KernelArgument{"by_value", F32, 84, "k_scale"}, - KernelArgument{"by_value", F32, 88, "v_scale"}, - KernelArgument{"by_value", F32, 92, "out_scale"}, - KernelArgument{"by_value", F32, 96, "softcap"}, - KernelArgument{"by_value", I32, 100, "num_seqs"}, - KernelArgument{"by_value", I32, 104, "block_table_stride"}, - KernelArgument{"by_value", I32, 108, "qq_bias_stride_0"}, - KernelArgument{"by_value", I32, 112, "num_query_heads"}, - KernelArgument{"by_value", I32, 116, "num_kv_heads"}, - KernelArgument{"by_value", I32, 120, "sliding_window"}}; - if(emitLse) - { - // After the runtime kernargs, 8-byte aligned (read off the compiled LSE kernel). - arguments.push_back(KernelArgument{"global_buffer", PTR, 128, "lse_ptr"}); - } - return arguments; -} - /// The compiled kernel plus everything launch() needs, owning nothing that points back into /// the MatchContext or BoundTokens it came from. class PreparedUnified2D : public PreparedDispatch @@ -573,7 +522,7 @@ class Unified2DDispatchHandler : public IKernelDispatchHandler } auto code = buildIngestorKernelCode( - _kpackLoader, context, kernel, unified2DKernelSignature(candidate.emitLse)); + _kpackLoader, context, kernel, tiled2DKernelSignature(candidate.emitLse)); // Grid from the SELECTED CANDIDATE'S geometry and the GRAPH PROBLEM, not from // descriptor shape metadata: the binary takes its shape at runtime. diff --git a/dnn-providers/hip-kernel-provider/src/integration_tests/CMakeLists.txt b/dnn-providers/hip-kernel-provider/src/integration_tests/CMakeLists.txt index 978b8357ba1a..5d01e8ae7112 100644 --- a/dnn-providers/hip-kernel-provider/src/integration_tests/CMakeLists.txt +++ b/dnn-providers/hip-kernel-provider/src/integration_tests/CMakeLists.txt @@ -82,11 +82,12 @@ if(ENABLE_HIP_FLASH2_ENGINE) endif() endif() if(HIPDNN_ENABLE_KERNEL_INGESTOR) - # The attention knob suites: each a source and the comma-separated engines it pins. A - # suite is compiled whenever the product root carries all of them, on any build arch, - # so a binary built for one arch still runs it against another build's content for the - # engines' arch, and it GTEST_SKIPs on other devices. The predicate is arch-agnostic and - # lives in HkpPackaging.cmake, which only an ingestor build includes -- hence this guard. + # The attention knob suites and the paged/ragged attention suite: each a source and the + # comma-separated engines it pins. A suite is compiled whenever the product root carries + # all of them, on any build arch, so a binary built for one arch still runs it against + # another build's content for the engines' arch, and it GTEST_SKIPs on other devices. + # The predicate is arch-agnostic and lives in HkpPackaging.cmake, which only an ingestor + # build includes -- hence this guard. set(_knob_suites IntegrationGpuGfx950AttentionDenseKnobs.cpp Gfx950AttentionDense IntegrationGpuGfx950AttentionUnifiedKnobs.cpp @@ -94,6 +95,7 @@ if(HIPDNN_ENABLE_KERNEL_INGESTOR) IntegrationGpuGfx942AttentionUnified3dKnobs.cpp Gfx942AttentionUnified3d IntegrationGpuGfx942AttentionUnified2DKnobs.cpp Gfx942AttentionUnified2D IntegrationGpuGfx942AttentionDenseKnobs.cpp Gfx942AttentionDense + IntegrationGpuAttentionPagedUnified.cpp AttentionPagedUnified ) while(_knob_suites) list(POP_FRONT _knob_suites _source _engines) diff --git a/dnn-providers/hip-kernel-provider/src/integration_tests/kernel_ingestor_engine/IntegrationGpuAttentionPagedUnified.cpp b/dnn-providers/hip-kernel-provider/src/integration_tests/kernel_ingestor_engine/IntegrationGpuAttentionPagedUnified.cpp new file mode 100644 index 000000000000..f205d1377a58 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/integration_tests/kernel_ingestor_engine/IntegrationGpuAttentionPagedUnified.cpp @@ -0,0 +1,1264 @@ +// Copyright © Advanced Micro Devices, Inc., or its affiliates. +// SPDX-License-Identifier: MIT + +#if defined(HIPDNN_ENABLE_KERNEL_INGESTOR) && defined(HIPDNN_ENABLE_SDPA) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "IngestorIntegrationSupport.hpp" + +/** + * @file IntegrationGpuAttentionPagedUnified.cpp + * @brief End-to-end runs of hipkernel:AttentionPagedUnified through the hipDNN frontend: + * paged uniform decode (dense Q), ragged Q over paged K/V (mixed decode and + * chunked prefill, a first origin past 0), sliding windows, + * separate K and V page tables, attention sinks (FLOAT and in the I/O dtype), + * HIP-graph capture/replay with changed sequence lengths, block ids and data, and + * saved plans restored into a fresh handle. Every output is compared with a host + * gather-then-dense fp32 reference over the same page tables, which is itself + * checked against hipDNN's CPU SDPA reference. A dense Q's rows past seq_len_q, + * and rows with no visible key, must be zero (SdpaSemanticsRegister SEM-008, + * SEM-010); a ragged Q's rows past seq_len_q belong to no sequence (RFC 0014) and + * must keep their contents. + * + * Set HIPDNN_TEST_EXPECTED_ARCH=gfx942 (or gfx950) on required runs so a missing or + * different device fails instead of skipping. + */ +namespace +{ + +using namespace hipdnn_frontend; +using namespace hipdnn_frontend::graph; + +constexpr const char* ENGINE = "hipkernel:AttentionPagedUnified"; + +namespace ingestor_it = hip_kernel_provider::kernel_ingestor_engine::integration; +using ingestor_it::SaveForm; + +uint16_t toBits(float x, DataType type) +{ + if(type == DataType::BFLOAT16) + { + uint32_t bits = 0; + std::memcpy(&bits, &x, 4); + bits += 0x7fffU + ((bits >> 16) & 1U); + return static_cast(bits >> 16); + } + const auto half = static_cast<_Float16>(x); + uint16_t bits = 0; + std::memcpy(&bits, &half, 2); + return bits; +} + +float fromBits(uint16_t bits, DataType type) +{ + if(type == DataType::BFLOAT16) + { + const uint32_t wide = static_cast(bits) << 16; + float value = 0; + std::memcpy(&value, &wide, 4); + return value; + } + _Float16 half = 0; + std::memcpy(&half, &bits, 2); + return static_cast(half); +} + +/// One problem. Q/O are token-major (`[tokens, Hq, D]` with a token stride of +/// `qTokenHeads * D`, so a fused QKV view is expressible); the cache is one +/// `[numBlocks, Hkv, blockSize, 2*D]` allocation viewed as K (first D) and V (last D), +/// exactly vLLM's TRITON_ATTN layout. +struct Problem +{ + DataType type = DataType::BFLOAT16; + int64_t queryHeads = 32; + int64_t kvHeads = 8; + int64_t headSize = 128; + int64_t blockSize = 16; + int64_t numBlocks = 96; + int64_t maxBlocks = 24; ///< page-table width M; max_seq_len_kv = M * blockSize + bool ragged = false; + int64_t denseQueryLength = 1; ///< Sq of a dense Q + int64_t raggedMaxLength = 0; ///< Sq (S_max) of a ragged Q + /// Ragged origins [B+1] (non-decreasing, off[B] the end of the last block); empty = + /// each sequence right after the previous one's live rows and gap. + std::vector raggedOffsets; + std::vector queryLengths; ///< seq_len_q; empty = denseQueryLength each + std::vector kvLengths; + std::vector gapsAfter; ///< ragged: unaddressed tokens after each sequence + bool setMaxSeqLenKv = true; ///< false leaves max_seq_len_kv for the engine to infer + int64_t leftBound = -1; ///< the graph's (cuDNN) left_bound; -1 = none + int64_t qTokenHeads = 0; ///< Q token stride in heads; 0 = queryHeads + bool sinks = false; ///< a sink_token `[1, Hq, 1, 1]` + bool floatSinks = false; ///< the sink is FLOAT (cuDNN's form), not in the I/O dtype + /// V pages through its own page_table_v, which places V in other blocks than K; + /// otherwise one tensor is both page_table_k and page_table_v. + bool separateVTable = false; + uint32_t seed = 1; + + int64_t batch() const + { + return static_cast(kvLengths.size()); + } +}; + +class DeviceBuffers +{ +public: + DeviceBuffers() = default; + DeviceBuffers(const DeviceBuffers&) = delete; + DeviceBuffers& operator=(const DeviceBuffers&) = delete; + DeviceBuffers(DeviceBuffers&&) = delete; + DeviceBuffers& operator=(DeviceBuffers&&) = delete; + ~DeviceBuffers() + { + for(void* p : _allocations) + { + EXPECT_EQ(hipFree(p), hipSuccess); + } + } + void* allocate(size_t bytes) + { + void* p = nullptr; + if(hipMalloc(&p, std::max(bytes, 16)) != hipSuccess) + { + throw std::runtime_error("hipMalloc failed"); + } + _allocations.push_back(p); + return p; + } + +private: + std::vector _allocations; +}; + +/// Host-side state of one problem instance: data, page table and lengths. +struct HostState +{ + std::vector q; ///< token-major, token stride qTokenHeads*D + std::vector cache; ///< [NB, Hkv, bs, 2D] + std::vector pageTable; ///< [B, M]: K's table (and V's, unless separate) + std::vector vPageTable; ///< [B, M]: V's table + std::vector kvLengths; + std::vector queryLengths; + std::vector offsets; ///< ragged token offsets [B+1] + int64_t qTokens = 0; ///< tokens of the Q/O storage + std::vector sinks; ///< [Hq] sink logits as the engine reads them (p.sinks only) +}; + +/// seq_len_q[b]: the live query rows of sequence b. +int64_t queryRowsFor(const HostState& s, int64_t b) +{ + return s.queryLengths[static_cast(b)]; +} + +/// The rows the engine writes for sequence b: Sq for a dense Q (rows past seq_len_q are +/// padding, written as zeros), the live rows for a ragged one (rows of its offset block +/// past seq_len_q belong to no sequence, so the engine leaves them alone). +int64_t rowsWritten(const Problem& p, const HostState& s, int64_t b) +{ + return p.ragged ? queryRowsFor(s, b) : p.denseQueryLength; +} + +int64_t firstToken(const Problem& p, const HostState& s, int64_t b) +{ + return p.ragged ? s.offsets[static_cast(b)] : b * p.denseQueryLength; +} + +/// A ragged Q's offsets [B+1]: p.raggedOffsets, or each sequence after the previous one's +/// live rows and gap. +std::vector raggedOffsetsFor(const Problem& p) +{ + if(!p.raggedOffsets.empty()) + { + return p.raggedOffsets; + } + std::vector offsets(static_cast(p.batch() + 1), 0); + for(int64_t b = 0; b < p.batch(); ++b) + { + const auto gap = p.gapsAfter.empty() ? 0 : p.gapsAfter[static_cast(b)]; + offsets[static_cast(b + 1)] + = offsets[static_cast(b)] + p.queryLengths[static_cast(b)] + gap; + } + return offsets; +} + +/// The tokens the Q and O storage holds: Sq rows per sequence, and for a ragged Q at +/// least Sq rows from every origin, so a write past a sequence's live rows lands in the +/// storage, where check() sees it. +int64_t storageTokens(const Problem& p) +{ + const int64_t sq = p.ragged ? p.raggedMaxLength : p.denseQueryLength; + int64_t tokens = p.batch() * sq; + if(p.ragged) + { + const auto offsets = raggedOffsetsFor(p); + for(int64_t b = 0; b < p.batch(); ++b) + { + const int64_t rows = std::max(sq, p.queryLengths[static_cast(b)]); + tokens = std::max(tokens, offsets[static_cast(b)] + rows); + } + if(p.raggedOffsets.empty()) + { + tokens = std::max(tokens, offsets.back()); + } + } + return std::max(tokens, 1); +} + +/// Random data, and shuffled page tables whose unused entries hold garbage block ids +/// the kernel must never follow. +HostState makeState(const Problem& p, uint32_t seed) +{ + std::mt19937 rng(seed); + std::uniform_real_distribution uniform(-1.0F, 1.0F); + HostState s; + s.kvLengths = p.kvLengths; + s.queryLengths + = p.queryLengths.empty() + ? std::vector(p.kvLengths.size(), static_cast(p.denseQueryLength)) + : p.queryLengths; + const int64_t batch = p.batch(); + if(p.ragged) + { + s.offsets = raggedOffsetsFor(p); + } + s.qTokens = storageTokens(p); + const int64_t tokenHeads = p.qTokenHeads > 0 ? p.qTokenHeads : p.queryHeads; + s.q.resize(static_cast(s.qTokens * tokenHeads * p.headSize)); + for(auto& x : s.q) + { + x = toBits(uniform(rng), p.type); + } + s.cache.resize(static_cast(p.numBlocks * p.kvHeads * p.blockSize * 2 * p.headSize)); + for(auto& x : s.cache) + { + x = toBits(uniform(rng), p.type); + } + std::vector blocks(static_cast(p.numBlocks)); + std::iota(blocks.begin(), blocks.end(), 0); + std::shuffle(blocks.begin(), blocks.end(), rng); + s.pageTable.assign(static_cast(batch * p.maxBlocks), 0x7fffffff); + size_t next = 0; + for(int64_t b = 0; b < batch; ++b) + { + const int64_t used = (s.kvLengths[static_cast(b)] + p.blockSize - 1) / p.blockSize; + for(int64_t i = 0; i < used; ++i) + { + s.pageTable[static_cast(b * p.maxBlocks + i)] + = blocks.at(next++ % blocks.size()); + } + } + s.vPageTable = s.pageTable; + if(p.separateVTable) + { + // Another shuffle: V of a token sits in another block than its K. + std::shuffle(blocks.begin(), blocks.end(), rng); + next = 0; + for(int64_t b = 0; b < batch; ++b) + { + const int64_t used + = (s.kvLengths[static_cast(b)] + p.blockSize - 1) / p.blockSize; + for(int64_t i = 0; i < used; ++i) + { + s.vPageTable[static_cast(b * p.maxBlocks + i)] + = blocks.at(next++ % blocks.size()); + } + } + } + if(p.sinks) + { + // From negligible to row-dominating, so a head that loses its sink, or reads + // another head's, fails the comparison. A FLOAT sink keeps every mantissa bit, so + // a kernel that read it in the I/O dtype would fail too. + std::uniform_real_distribution logit(-4.0F, 6.0F); + s.sinks.resize(static_cast(p.queryHeads)); + for(auto& x : s.sinks) + { + x = logit(rng); + if(!p.floatSinks) + { + x = fromBits(toBits(x, p.type), p.type); + } + } + } + return s; +} + +/// fp32 gather-then-dense reference: for each sequence, gather its K and V through their +/// page tables into dense rows, then bottom-right causal (plus window) softmax attention. +/// A sink joins the row max and the denominator. Rows past seq_len_q and rows with no +/// visible key stay zero. +std::vector reference(const Problem& p, const HostState& s, float scale) +{ + const int64_t d = p.headSize; + const int64_t tokenHeads = p.qTokenHeads > 0 ? p.qTokenHeads : p.queryHeads; + const int64_t group = p.queryHeads / p.kvHeads; + std::vector out(static_cast(s.qTokens * p.queryHeads * d), 0.0F); + for(int64_t b = 0; b < p.batch(); ++b) + { + const int64_t kv = s.kvLengths[static_cast(b)]; + const int64_t rows = queryRowsFor(s, b); + const int64_t first = firstToken(p, s, b); + const auto cacheAt = [&](int64_t token, int64_t head, int64_t dim, bool value) { + const auto& table = value ? s.vPageTable : s.pageTable; + const int64_t block = table[static_cast(b * p.maxBlocks + token / p.blockSize)]; + const int64_t index + = ((block * p.kvHeads + head) * p.blockSize + token % p.blockSize) * 2 * d + + (value ? d : 0) + dim; + return fromBits(s.cache[static_cast(index)], p.type); + }; + for(int64_t row = 0; row < rows; ++row) + { + const int64_t diagonal = row + kv - rows; + for(int64_t h = 0; h < p.queryHeads; ++h) + { + const int64_t kvHead = h / group; + std::vector scores; + std::vector keys; + for(int64_t key = 0; key < kv; ++key) + { + // left_bound L keeps the L keys ending at the diagonal (cuDNN). + if(key > diagonal || (p.leftBound > 0 && key <= diagonal - p.leftBound)) + { + continue; + } + float dot = 0.0F; + for(int64_t i = 0; i < d; ++i) + { + dot += fromBits(s.q[static_cast(((first + row) * tokenHeads + h) * d + + i)], + p.type) + * cacheAt(key, kvHead, i, false); + } + scores.push_back(dot * scale); + keys.push_back(key); + } + auto* o = &out[static_cast(((first + row) * p.queryHeads + h) * d)]; + if(scores.empty()) + { + continue; // no visible key: zeros + } + float maximum = *std::max_element(scores.begin(), scores.end()); + const float sink = p.sinks ? s.sinks[static_cast(h)] : 0.0F; + if(p.sinks) + { + maximum = std::max(maximum, sink); + } + float sum = p.sinks ? std::exp(sink - maximum) : 0.0F; + for(auto& x : scores) + { + x = std::exp(x - maximum); + sum += x; + } + for(size_t j = 0; j < keys.size(); ++j) + { + for(int64_t i = 0; i < d; ++i) + { + o[i] += scores[j] / sum * cacheAt(keys[j], kvHead, i, true); + } + } + } + } + } + return out; +} + +constexpr uint16_t SENTINEL = 0x7e00; // a NaN in fp16, a finite value in bf16; checked bitwise + +/// hipDNN's own SDPA reference (CpuFpReferenceSdpa, the dense path the paged graph bundles +/// run through) over the same host state, as float O laid out like the device O +/// ([tokens, Hq, D]): K and V gathered through their page tables, Q and O dense padded +/// [B, Hq, Sq, D] with seq_len_q / seq_len_kv padding, and the ragged layout mapped by +/// the offsets. +template +std::vector hipdnnReferenceAs(const Problem& p, HostState s, float scale) +{ + using namespace hipdnn_data_sdk::utilities; + using hipdnn_test_sdk::utilities::CpuFpReferenceSdpa; + using hipdnn_test_sdk::utilities::SdpaFwdOptions; + const int64_t batch = p.batch(); + const int64_t d = p.headSize; + const int64_t tokenHeads = p.qTokenHeads > 0 ? p.qTokenHeads : p.queryHeads; + const int64_t sq = p.ragged ? p.raggedMaxLength : p.denseQueryLength; + const int64_t tokens = s.qTokens; + + Tensor q({batch, p.queryHeads, sq, d}); + q.fillWithValue(static_cast(0.0F)); + for(int64_t b = 0; b < batch; ++b) + { + for(int64_t row = 0; row < std::min(rowsWritten(p, s, b), sq); ++row) + { + for(int64_t h = 0; h < p.queryHeads; ++h) + { + for(int64_t i = 0; i < d; ++i) + { + const auto bits = s.q[static_cast( + ((firstToken(p, s, b) + row) * tokenHeads + h) * d + i)]; + q.setHostValue(static_cast(fromBits(bits, p.type)), + std::vector{b, h, row, i}); + } + } + } + } + const std::vector kvDims = {p.numBlocks, p.kvHeads, p.blockSize, d}; + const std::vector kvStrides + = {p.kvHeads * p.blockSize * 2 * d, p.blockSize * 2 * d, 2 * d, 1}; + const ShallowTensor kCache(s.cache.data(), kvDims, kvStrides); + const ShallowTensor vCache(s.cache.data() + d, kvDims, kvStrides); + Tensor table({batch, 1, p.maxBlocks, 1}, {p.maxBlocks, p.maxBlocks, 1, 1}); + Tensor vTable({batch, 1, p.maxBlocks, 1}, {p.maxBlocks, p.maxBlocks, 1, 1}); + Tensor kvLengths({batch, 1, 1, 1}); + Tensor qLengths({batch, 1, 1, 1}); + for(int64_t b = 0; b < batch; ++b) + { + const int32_t kv = s.kvLengths[static_cast(b)]; + const int64_t used = (kv + p.blockSize - 1) / p.blockSize; + for(int64_t j = 0; j < p.maxBlocks; ++j) + { + // The gather reads only the used ids; the rest may hold anything. + const auto at = static_cast(b * p.maxBlocks + j); + table.setHostValue(j < used ? s.pageTable[at] : -1, std::vector{b, 0, j, 0}); + vTable.setHostValue(j < used ? s.vPageTable[at] : -1, std::vector{b, 0, j, 0}); + } + kvLengths.setHostValue(kv, std::vector{b, 0, 0, 0}); + qLengths.setHostValue(static_cast(queryRowsFor(s, b)), + std::vector{b, 0, 0, 0}); + } + const int64_t maxSeqKv = p.maxBlocks * p.blockSize; + const auto k = CpuFpReferenceSdpa::gatherPagedKv(kCache, table, kvLengths, maxSeqKv); + const auto v = CpuFpReferenceSdpa::gatherPagedKv(vCache, vTable, kvLengths, maxSeqKv); + Tensor o({batch, p.queryHeads, sq, d}); + auto options = SdpaFwdOptions{} + .setScale(scale) + .setBand(p.leftBound, 0, false) + .setSeqLens(&qLengths, &kvLengths); + // The reference takes cuDNN's FLOAT sink; Q-dtype sink values upcast exactly. + Tensor sink({1, p.queryHeads, 1, 1}); + if(p.sinks) + { + for(int64_t h = 0; h < p.queryHeads; ++h) + { + sink.setHostValue(s.sinks[static_cast(h)], std::vector{0, h, 0, 0}); + } + options.setSink(&sink); + } + CpuFpReferenceSdpa::forward(q, k, v, o, options); + + std::vector out(static_cast(tokens * p.queryHeads * d), 0.0F); + for(int64_t b = 0; b < batch; ++b) + { + for(int64_t row = 0; row < std::min(rowsWritten(p, s, b), sq); ++row) + { + for(int64_t h = 0; h < p.queryHeads; ++h) + { + for(int64_t i = 0; i < d; ++i) + { + out[static_cast(((firstToken(p, s, b) + row) * p.queryHeads + h) * d + + i)] + = o.getHostValue(std::vector{b, h, row, i}); + } + } + } + } + return out; +} + +std::vector hipdnnReference(const Problem& p, const HostState& s, float scale) +{ + if(p.type == DataType::BFLOAT16) + { + return hipdnnReferenceAs(p, s, scale); + } + return hipdnnReferenceAs(p, s, scale); +} + +class IntegrationGpuAttentionPagedUnified : public ::testing::Test +{ +protected: + hipdnnHandle_t _handle = nullptr; + hipStream_t _stream = nullptr; + + void SetUp() override + { + const auto expectedArch = hipdnn_data_sdk::utilities::getEnv("HIPDNN_TEST_EXPECTED_ARCH"); + if(expectedArch.empty()) + { + SKIP_IF_NO_DEVICES(); + } + ASSERT_EQ(hipStreamCreate(&_stream), hipSuccess); + const auto pluginPath + = std::filesystem::weakly_canonical( + hipdnn_data_sdk::utilities::getCurrentExecutableDirectory() / PLUGIN_PATH) + .string(); + const char* path = pluginPath.c_str(); + ASSERT_EQ(hipdnnSetEnginePluginPaths_ext(1, &path, HIPDNN_PLUGIN_LOADING_ABSOLUTE), + HIPDNN_STATUS_SUCCESS); + ASSERT_EQ(hipdnnCreate(&_handle), HIPDNN_STATUS_SUCCESS); + ASSERT_EQ(hipdnnSetStream(_handle, _stream), HIPDNN_STATUS_SUCCESS); + int device = 0; + ASSERT_EQ(hipGetDevice(&device), hipSuccess); + hipDeviceProp_t props{}; + ASSERT_EQ(hipGetDeviceProperties(&props, device), hipSuccess); + const std::string arch = props.gcnArchName; + const auto base = arch.substr(0, arch.find(':')); + if(!expectedArch.empty()) + { + ASSERT_EQ(base, expectedArch); + } + if(base != "gfx942" && base != "gfx950") + { + GTEST_SKIP() << ENGINE << " ships for gfx942/gfx950; found " << arch; + } + } + + void TearDown() override + { + if(_stream != nullptr) + { + EXPECT_EQ(hipStreamSynchronize(_stream), hipSuccess); + } + if(_handle != nullptr) + { + EXPECT_EQ(hipdnnDestroy(_handle), HIPDNN_STATUS_SUCCESS); + } + if(_stream != nullptr) + { + EXPECT_EQ(hipStreamDestroy(_stream), hipSuccess); + } + } + + static bool ok(const Error& error) + { + EXPECT_EQ(error.code, ErrorCode::OK) << error.err_msg; + return error.code == ErrorCode::OK; + } + + /// The graph, its uids and the device buffers for one problem. + struct Built + { + std::unique_ptr graph; + DeviceBuffers memory; + std::unordered_map buffers; + void* cache = nullptr; + size_t qBytes = 0; + size_t oBytes = 0; + float scale = 0.0F; + }; + + enum Uid : int64_t + { + Q = 1, + K = 2, + V = 3, + O = 4, + PAGE_TABLE = 5, + SEQ_LEN_KV = 6, + SEQ_LEN_Q = 7, + OFFSETS = 8, + SINK = 9, + PAGE_TABLE_V = 10 + }; + + /// Builds the graph for @p p, planned on this engine only. + void build(const Problem& p, Built& built) + { + const int64_t batch = p.batch(); + const int64_t d = p.headSize; + const int64_t tokenHeads = p.qTokenHeads > 0 ? p.qTokenHeads : p.queryHeads; + const int64_t sq = p.ragged ? p.raggedMaxLength : p.denseQueryLength; + built.graph = std::make_unique(); + auto& graph = *built.graph; + graph.set_io_data_type(p.type) + .set_compute_data_type(DataType::FLOAT) + .set_intermediate_data_type(DataType::FLOAT); + const auto make = [](int64_t uid, + DataType type, + const std::vector& dims, + const std::vector& strides) { + return std::make_shared( + TensorAttributes().set_uid(uid).set_data_type(type).set_dim(dims).set_stride( + strides)); + }; + auto q = make( + Q, p.type, {batch, p.queryHeads, sq, d}, {sq * tokenHeads * d, d, tokenHeads * d, 1}); + const std::vector kvStrides + = {p.kvHeads * p.blockSize * 2 * d, p.blockSize * 2 * d, 2 * d, 1}; + auto k = make(K, p.type, {p.numBlocks, p.kvHeads, p.blockSize, d}, kvStrides); + auto v = make(V, p.type, {p.numBlocks, p.kvHeads, p.blockSize, d}, kvStrides); + auto pageTable = make(PAGE_TABLE, + DataType::INT32, + {batch, 1, p.maxBlocks, 1}, + {p.maxBlocks, p.maxBlocks, 1, 1}); + auto pageTableV = p.separateVTable ? make(PAGE_TABLE_V, + DataType::INT32, + {batch, 1, p.maxBlocks, 1}, + {p.maxBlocks, p.maxBlocks, 1, 1}) + : pageTable; + auto seqLenKv = make(SEQ_LEN_KV, DataType::INT32, {batch, 1, 1, 1}, {1, 1, 1, 1}); + std::shared_ptr offsets; + if(p.ragged) + { + offsets = make(OFFSETS, DataType::INT32, {batch + 1, 1, 1, 1}, {1, 1, 1, 1}); + q->set_ragged_offset(offsets).set_ragged_offset_multiplier(tokenHeads * d); + } + built.scale = 1.0F / std::sqrt(static_cast(d)); + SdpaAttributes attributes; + // A paged graph carries both seq_len tensors (SdpaSemanticsRegister SEM-009). + attributes.set_attn_scale(built.scale) + .set_generate_stats(false) + .set_padding_mask(true) + .set_seq_len_q(make(SEQ_LEN_Q, DataType::INT32, {batch, 1, 1, 1}, {1, 1, 1, 1})) + .set_seq_len_kv(seqLenKv) + .set_paged_attention_k_table(pageTable) + .set_paged_attention_v_table(pageTableV) + .set_diagonal_band_right_bound(0) + .set_diagonal_alignment(DiagonalAlignment::BOTTOM_RIGHT); + if(p.setMaxSeqLenKv) + { + attributes.set_paged_attention_max_seq_len_kv( + static_cast(p.maxBlocks * p.blockSize)); + } + if(p.leftBound > 0) + { + attributes.set_diagonal_band_left_bound(p.leftBound); + } + if(p.sinks) + { + attributes.set_sink_token(make(SINK, + p.floatSinks ? DataType::FLOAT : p.type, + {1, p.queryHeads, 1, 1}, + {p.queryHeads, 1, 1, 1})); + } + auto o = graph.sdpa(q, k, v, attributes)[0]; + o->set_uid(O) + .set_output(true) + .set_data_type(p.type) + .set_dim({batch, p.queryHeads, sq, d}) + .set_stride({sq * p.queryHeads * d, d, p.queryHeads * d, 1}); + if(p.ragged) + { + o->set_ragged_offset(offsets).set_ragged_offset_multiplier(p.queryHeads * d); + } + // The engine also reads sinks in the I/O dtype (vLLM keeps them in the model + // dtype). A frontend that accepts only cuDNN's FLOAT sink_token rejects that graph + // before any engine sees it, so those cases skip there instead of failing. Only + // that data type rejection of a Q-dtype sink skips; any other validate() error, + // and any error for a FLOAT sink, fails. + const auto validated = graph.validate(); + if(p.sinks && !p.floatSinks && validated.code != ErrorCode::OK + && validated.err_msg.find("sink_token must have FLOAT data type") != std::string::npos) + { + GTEST_SKIP() << "the hipDNN frontend rejects a sink_token in the Q data type (" + << validated.err_msg << "); this case needs a frontend that accepts it"; + } + ASSERT_TRUE(ok(validated)); + ASSERT_TRUE(ok(graph.build_operation_graph(_handle))); + ASSERT_TRUE(ok(graph.create_execution_plan_ext( + hipdnn_data_sdk::utilities::engineNameToId(ENGINE), {}))); + ASSERT_TRUE(ok(graph.check_support())); + ASSERT_TRUE(ok(graph.build_plans())); + int64_t workspace = -1; + ASSERT_TRUE(ok(graph.get_workspace_size(workspace))); + ASSERT_EQ(workspace, 0); + + const int64_t tokens = storageTokens(p); + built.qBytes = static_cast(tokens * tokenHeads * d * 2); + built.oBytes = static_cast(tokens * p.queryHeads * d * 2); + built.cache = built.memory.allocate( + static_cast(p.numBlocks * p.kvHeads * p.blockSize * 2 * d * 2)); + built.buffers[Q] = built.memory.allocate(built.qBytes); + built.buffers[K] = built.cache; + built.buffers[V] = static_cast(built.cache) + d; + built.buffers[O] = built.memory.allocate(built.oBytes); + built.buffers[PAGE_TABLE] + = built.memory.allocate(static_cast(batch * p.maxBlocks * 4)); + if(p.separateVTable) + { + built.buffers[PAGE_TABLE_V] + = built.memory.allocate(static_cast(batch * p.maxBlocks * 4)); + } + built.buffers[SEQ_LEN_KV] = built.memory.allocate(static_cast(batch * 4)); + built.buffers[SEQ_LEN_Q] = built.memory.allocate(static_cast(batch * 4)); + if(p.ragged) + { + built.buffers[OFFSETS] = built.memory.allocate(static_cast((batch + 1) * 4)); + } + if(p.sinks) + { + built.buffers[SINK] + = built.memory.allocate(static_cast(p.queryHeads * (p.floatSinks ? 4 : 2))); + } + } + + /// Uploads @p s and poisons O with SENTINEL (stream-ordered). + void upload(const Problem& p, const HostState& s, Built& built) + { + const auto copy = [&](void* dst, const void* src, size_t bytes) { + ASSERT_EQ(hipMemcpyAsync(dst, src, bytes, hipMemcpyHostToDevice, _stream), hipSuccess); + }; + copy(built.buffers[Q], s.q.data(), std::min(built.qBytes, s.q.size() * 2)); + copy(built.cache, s.cache.data(), s.cache.size() * 2); + copy(built.buffers[PAGE_TABLE], s.pageTable.data(), s.pageTable.size() * 4); + if(p.separateVTable) + { + copy(built.buffers[PAGE_TABLE_V], s.vPageTable.data(), s.vPageTable.size() * 4); + } + copy(built.buffers[SEQ_LEN_KV], s.kvLengths.data(), s.kvLengths.size() * 4); + copy(built.buffers[SEQ_LEN_Q], s.queryLengths.data(), s.queryLengths.size() * 4); + if(p.ragged) + { + copy(built.buffers[OFFSETS], s.offsets.data(), s.offsets.size() * 4); + } + if(p.sinks) + { + if(p.floatSinks) + { + copy(built.buffers[SINK], s.sinks.data(), s.sinks.size() * 4); + } + else + { + std::vector bits(s.sinks.size()); + std::transform(s.sinks.begin(), s.sinks.end(), bits.begin(), [&](float x) { + return toBits(x, p.type); + }); + copy(built.buffers[SINK], bits.data(), bits.size() * 2); + } + } + std::vector poison(built.oBytes / 2, SENTINEL); + copy(built.buffers[O], poison.data(), built.oBytes); + } + + /// Reads O back and compares every row the engine writes with the reference: live rows + /// within tolerance, a dense Q's rows past seq_len_q exactly zero. Every other row (a + /// ragged Q's gap rows included) keeps the sentinel. + void check(const Problem& p, const HostState& s, const Built& built) + { + std::vector out(built.oBytes / 2); + ASSERT_EQ( + hipMemcpyAsync( + out.data(), built.buffers.at(O), built.oBytes, hipMemcpyDeviceToHost, _stream), + hipSuccess); + ASSERT_EQ(hipStreamSynchronize(_stream), hipSuccess); + const auto expected = reference(p, s, built.scale); + // hipDNN's CPU SDPA reference on the same inputs: the test's own gather-then-dense + // reference must agree with it. The reference takes the sink as FLOAT; the + // engine's Q-dtype sink values upcast exactly. + const auto contract = hipdnnReference(p, s, built.scale); + const int64_t d = p.headSize; + std::vector written(built.oBytes / 2 / static_cast(p.queryHeads * d), false); + for(int64_t b = 0; b < p.batch(); ++b) + { + const int64_t first = firstToken(p, s, b); + const int64_t live = queryRowsFor(s, b); + for(int64_t row = 0; row < rowsWritten(p, s, b); ++row) + { + written[static_cast(first + row)] = true; + for(int64_t i = 0; i < p.queryHeads * d; ++i) + { + const auto index = static_cast((first + row) * p.queryHeads * d + i); + const float actual = fromBits(out[index], p.type); + const float want = expected[index]; + ASSERT_TRUE(std::isfinite(actual)) << "b=" << b << " row=" << row << " i=" << i; + // Bottom-right causal: live row r sees keys up to kv - live + r, so + // every row of an empty sequence, and the leading rows of a sequence + // with fewer keys than live rows, see none and must be exact zeros. + const int64_t kv = s.kvLengths[static_cast(b)]; + if(row >= live || row + kv < live) + { + ASSERT_EQ(actual, 0.0F) + << (row >= live ? "padding row past seq_len_q" : "row with no key") + << ": b=" << b << " row=" << row << " i=" << i; + } + // Both references accumulate in fp32 and differ only in summation + // order. + ASSERT_NEAR(contract[index], want, 1.0e-3F + 1.0e-3F * std::abs(want)) + << "references disagree: b=" << b << " row=" << row << " i=" << i; + // The engine rounds P and O to bf16/fp16 (8 or 11 mantissa bits). + const float error = std::abs(actual - want); + ASSERT_LE(error, 2.0e-2F + 2.0e-2F * std::abs(want)) + << "b=" << b << " row=" << row << " head=" << i / d << " d=" << i % d; + } + } + } + for(size_t token = 0; token < written.size(); ++token) + { + if(written[token]) + { + continue; + } + for(int64_t i = 0; i < p.queryHeads * d; ++i) + { + ASSERT_EQ( + out[token * static_cast(p.queryHeads * d) + static_cast(i)], + SENTINEL) + << "the kernel wrote unaddressed token " << token; + } + } + } + + void run(const Problem& p) + { + Built built; + build(p, built); + if(::testing::Test::HasFatalFailure() || ::testing::Test::IsSkipped()) + { + return; + } + const auto state = makeState(p, p.seed); + upload(p, state, built); + ASSERT_TRUE(ok(built.graph->execute(_handle, built.buffers, nullptr))); + check(p, state, built); + } +}; + +Problem decodeProblem(DataType type) +{ + Problem p; + p.type = type; + // Sequence 0 is CUDA-graph padding: no keys, and its row must come back zero. + p.kvLengths = {0, 1, 17, 100, 255, 384}; + return p; +} + +TEST_F(IntegrationGpuAttentionPagedUnified, PagedUniformDecodeBf16) +{ + run(decodeProblem(DataType::BFLOAT16)); +} + +TEST_F(IntegrationGpuAttentionPagedUnified, PagedUniformDecodeHalf) +{ + run(decodeProblem(DataType::HALF)); +} + +/// Sq = 3 rows per sequence, some with fewer live rows (seq_len_q < Sq): the padded rows +/// must come back zero. +TEST_F(IntegrationGpuAttentionPagedUnified, SpeculativeDecodeRowsWithSeqLenQ) +{ + Problem p = decodeProblem(DataType::BFLOAT16); + p.denseQueryLength = 3; + p.queryLengths = {3, 1, 3, 2, 0, 3}; + p.kvLengths = {0, 1, 17, 100, 255, 384}; + run(p); +} + +/// An unset max_seq_len_kv is valid (cuDNN infers it from the table width), and the +/// engine serves it like a set one. +TEST_F(IntegrationGpuAttentionPagedUnified, PagedDecodeWithMaxSeqLenKvUnset) +{ + Problem p = decodeProblem(DataType::HALF); + p.setMaxSeqLenKv = false; + run(p); +} + +/// A batch of one: the page table's batch extent is 1, so hipDNN reads its row stride as +/// irrelevant. The length cap must come from the table's width, not from that stride, or +/// the sequence reads as empty and its row comes back zero. +TEST_F(IntegrationGpuAttentionPagedUnified, DecodeOfASingleSequence) +{ + for(const int32_t kv : {1, 17, 100, 384}) + { + SCOPED_TRACE("seq_len_kv = " + std::to_string(kv)); + Problem p = decodeProblem(DataType::BFLOAT16); + p.kvLengths = {kv}; + run(p); + if(::testing::Test::HasFatalFailure()) + { + return; + } + } +} + +TEST_F(IntegrationGpuAttentionPagedUnified, DecodeHeadSizes64And256) +{ + Problem small = decodeProblem(DataType::HALF); + small.headSize = 64; + small.queryHeads = 8; + small.kvHeads = 8; + small.blockSize = 64; + small.numBlocks = 40; + small.maxBlocks = 8; + small.kvLengths = {511, 0, 64, 65}; + run(small); + + Problem large = decodeProblem(DataType::BFLOAT16); + large.headSize = 256; + large.queryHeads = 16; + large.kvHeads = 2; + large.blockSize = 32; + large.numBlocks = 64; + large.maxBlocks = 12; + large.kvLengths = {300, 33, 0, 7}; + run(large); +} + +Problem mixedProblem(DataType type) +{ + Problem p; + p.type = type; + p.ragged = true; + p.raggedMaxLength = 160; + // decode, prefill without context, a padding sequence, chunked prefill with context. + p.queryLengths = {1, 37, 0, 64, 1}; + p.kvLengths = {200, 37, 0, 150, 9}; + p.gapsAfter = {0, 3, 0, 5, 2}; + // Rows past seq_len_q up to the next offset (the gaps, one after the last sequence) + // are addressed by no sequence: the engine must not write them. + // Q as a view of a fused QKV projection. + p.qTokenHeads = 32 + 2 * 8; + return p; +} + +TEST_F(IntegrationGpuAttentionPagedUnified, RaggedQueryOverPagedKvBf16) +{ + run(mixedProblem(DataType::BFLOAT16)); +} + +TEST_F(IntegrationGpuAttentionPagedUnified, RaggedQueryOverPagedKvHalf) +{ + run(mixedProblem(DataType::HALF)); +} + +TEST_F(IntegrationGpuAttentionPagedUnified, RaggedQueryWithSlidingWindowAndGqa5) +{ + Problem p = mixedProblem(DataType::BFLOAT16); + p.queryHeads = 40; + p.kvHeads = 8; + p.qTokenHeads = 40 + 16; + p.leftBound = 32; // a vLLM sliding window of 32 keys + run(p); +} + +TEST_F(IntegrationGpuAttentionPagedUnified, RaggedQueryWithTotalTokensBeyondSmax) +{ + // Sq (S_max) bounds each sequence, not the batch total, so the kernel's grid-stride + // loop must reach every query block. + Problem p = mixedProblem(DataType::HALF); + p.raggedMaxLength = 64; + p.queryLengths = {64, 64, 64, 64, 64}; + p.kvLengths = {64, 100, 128, 200, 64}; + p.gapsAfter = {}; + run(p); +} + +/// A first origin past 0: the rows before it belong to no sequence and keep the sentinel, +/// and with Sq above seq_len_q the rows after the live one do too. +TEST_F(IntegrationGpuAttentionPagedUnified, RaggedQueryWithAShiftedFirstOrigin) +{ + for(const int64_t sq : {1, 4}) + { + SCOPED_TRACE("Sq = " + std::to_string(sq)); + Problem p = mixedProblem(DataType::BFLOAT16); + p.raggedMaxLength = sq; + p.queryLengths = {1}; + p.kvLengths = {100}; + p.gapsAfter = {}; + p.raggedOffsets = {64, 65}; + run(p); + if(::testing::Test::HasFatalFailure()) + { + return; + } + } +} + +/// 0 < seq_len_kv < seq_len_q: the bottom-right diagonal of the leading rows sits before +/// the first key, so those rows see no key and must be zero; the later rows each see the +/// keys up to their own diagonal. +TEST_F(IntegrationGpuAttentionPagedUnified, KeylessLeadingRowsWhenSeqLenKvBelowSeqLenQ) +{ + Problem dense = decodeProblem(DataType::BFLOAT16); + dense.denseQueryLength = 5; + dense.queryLengths = {5, 5, 3, 5, 4}; + dense.kvLengths = {2, 1, 40, 4, 0}; + run(dense); + + Problem ragged = mixedProblem(DataType::HALF); + ragged.queryLengths = {5, 37, 0, 64, 3}; + ragged.kvLengths = {2, 37, 0, 150, 1}; + ragged.leftBound = 32; + run(ragged); +} + +/// cuDNN's form: page_table_k and page_table_v are two tensors, and the V of each token +/// sits in another block than its K. +TEST_F(IntegrationGpuAttentionPagedUnified, SeparateKAndVPageTablesDecodeBf16) +{ + Problem p = decodeProblem(DataType::BFLOAT16); + p.separateVTable = true; + run(p); +} + +TEST_F(IntegrationGpuAttentionPagedUnified, SeparateKAndVPageTablesRaggedWithWindowHalf) +{ + Problem p = mixedProblem(DataType::HALF); + p.separateVTable = true; + p.leftBound = 32; + p.setMaxSeqLenKv = false; + run(p); +} + +/// gpt-oss style sinks with GQA (8 KV heads): every query head's sink, including those +/// of KV heads past the first, must reach the softmax; keyless rows stay zero. +TEST_F(IntegrationGpuAttentionPagedUnified, DecodeWithAttentionSinksBf16) +{ + Problem p = decodeProblem(DataType::BFLOAT16); + p.sinks = true; + run(p); +} + +TEST_F(IntegrationGpuAttentionPagedUnified, RaggedQueryWithAttentionSinksAndWindowHalf) +{ + Problem p = mixedProblem(DataType::HALF); + p.sinks = true; + p.leftBound = 32; + run(p); +} + +/// cuDNN's FLOAT sink_token, which hipDNN's frontend admits: the kernel reads full fp32 +/// logits. +TEST_F(IntegrationGpuAttentionPagedUnified, DecodeWithFloatAttentionSinksBf16) +{ + Problem p = decodeProblem(DataType::BFLOAT16); + p.sinks = true; + p.floatSinks = true; + run(p); +} + +TEST_F(IntegrationGpuAttentionPagedUnified, RaggedQueryWithFloatAttentionSinksAndWindowHalf) +{ + Problem p = mixedProblem(DataType::HALF); + p.sinks = true; + p.floatSinks = true; + p.leftBound = 32; + run(p); +} + +/// One plan, captured once into a HIP graph and replayed with new lengths, new block ids +/// and new data: the engine reads all of them from device memory, so the replay must +/// match a fresh reference every time. +TEST_F(IntegrationGpuAttentionPagedUnified, HipGraphCaptureReplaysWithChangedLengthsAndBlocks) +{ + for(const bool ragged : {false, true}) + { + SCOPED_TRACE(ragged ? "ragged" : "dense"); + const Problem p + = ragged ? mixedProblem(DataType::BFLOAT16) : decodeProblem(DataType::BFLOAT16); + Built built; + build(p, built); + ASSERT_FALSE(::testing::Test::HasFatalFailure()); + auto state = makeState(p, 11); + upload(p, state, built); + // Warm-up outside capture: the first execute on a device loads the module. + ASSERT_TRUE(ok(built.graph->execute(_handle, built.buffers, nullptr))); + ASSERT_EQ(hipStreamSynchronize(_stream), hipSuccess); + + hipGraph_t graph = nullptr; + ASSERT_EQ(hipStreamBeginCapture(_stream, hipStreamCaptureModeThreadLocal), hipSuccess); + const auto status = built.graph->execute(_handle, built.buffers, nullptr); + ASSERT_EQ(hipStreamEndCapture(_stream, &graph), hipSuccess); + ASSERT_TRUE(ok(status)); + hipGraphExec_t exec = nullptr; + ASSERT_EQ(hipGraphInstantiate(&exec, graph, nullptr, nullptr, 0), hipSuccess); + + for(uint32_t step = 0; step < 3; ++step) + { + SCOPED_TRACE(step); + Problem next = p; + // New lengths (B fixed by the plan), new shuffled blocks, new data. + if(ragged) + { + next.queryLengths = {1, static_cast(5 + step), 1, 0, 2}; + next.kvLengths = {static_cast(30 + 50 * step), + static_cast(5 + step), + 300, + 0, + 2}; + next.gapsAfter = {0, 0, 2, 0, 0}; + } + else + { + next.kvLengths = {static_cast(step), + 0, + 383, + static_cast(40 * step + 1), + 16, + 17}; + } + state = makeState(next, 100 + step); + upload(next, state, built); + ASSERT_EQ(hipGraphLaunch(exec, _stream), hipSuccess); + check(next, state, built); + } + ASSERT_EQ(hipGraphExecDestroy(exec), hipSuccess); + ASSERT_EQ(hipGraphDestroy(graph), hipSuccess); + } +} + +/// Saved plans: the engine saves the kernel's code object and its launch values, and a +/// plan loaded into a fresh handle (a new provider container, no module cache) launches +/// the same kernel with the same arguments. +class IntegrationGpuAttentionPagedUnifiedSaveLoad : public IntegrationGpuAttentionPagedUnified +{ +protected: + std::vector readOutput(const Built& built) + { + std::vector out(built.oBytes / 2); + EXPECT_EQ( + hipMemcpyAsync( + out.data(), built.buffers.at(O), built.oBytes, hipMemcpyDeviceToHost, _stream), + hipSuccess); + EXPECT_EQ(hipStreamSynchronize(_stream), hipSuccess); + return out; + } + + /// Builds and runs @p p, saves the plan in @p form, destroys the graph and the handle, + /// loads the plan into a fresh handle and runs it on the same buffers and inputs. The + /// loaded plan's output must pass the same reference check and equal the original + /// plan's output bit for bit. + void roundTripInAFreshHandle(const Problem& p, SaveForm form) + { + Built built; + build(p, built); + if(::testing::Test::HasFatalFailure() || ::testing::Test::IsSkipped()) + { + return; + } + const int64_t engineId = hipdnn_data_sdk::utilities::engineNameToId(ENGINE); + std::vector notes; + ASSERT_TRUE(ok(built.graph->get_behavior_notes_for_engine(engineId, notes))); + ASSERT_NE(std::find(notes.begin(), + notes.end(), + BehaviorNote::SUPPORTS_EXECUTION_PLAN_SERIALIZATION), + notes.end()); + + const auto state = makeState(p, p.seed); + upload(p, state, built); + ASSERT_TRUE(ok(built.graph->execute(_handle, built.buffers, nullptr))); + ASSERT_NO_FATAL_FAILURE(check(p, state, built)); + const auto original = readOutput(built); + + std::vector saved; + { + auto save = ingestor_it::detail::saveInForm(*built.graph, form); + ASSERT_TRUE(ok(save.second)); + saved = std::move(save.first); + } + if(form == SaveForm::GRAPH_AND_PLAN) + { + int contents = 0; + ASSERT_EQ( + hipdnnBackendGetSerializedBinaryContents_ext(saved.data(), saved.size(), &contents), + HIPDNN_STATUS_SUCCESS); + ASSERT_NE(contents & HIPDNN_SERIALIZED_CONTENT_EXECUTION_PLAN, 0) + << "the saved graph holds no execution plan"; + } + + built.graph.reset(); + ASSERT_NO_FATAL_FAILURE(ingestor_it::detail::replaceHandleWithAFreshOne(_handle, _stream)); + + auto loaded = std::make_shared(); + ASSERT_TRUE(ok(ingestor_it::detail::loadInForm(*loaded, _handle, saved, form))); + int64_t loadedEngineId = 0; + ASSERT_TRUE(ok(loaded->get_execution_plan_engine_id(loadedEngineId))); + EXPECT_EQ(loadedEngineId, engineId); + int64_t workspace = -1; + ASSERT_TRUE(ok(loaded->get_workspace_size(workspace))); + EXPECT_EQ(workspace, 0); + + // upload() poisons O again, so the comparison sees only what the loaded plan wrote. + upload(p, state, built); + ASSERT_TRUE(ok(loaded->execute(_handle, built.buffers, nullptr))); + ASSERT_NO_FATAL_FAILURE(check(p, state, built)); + EXPECT_TRUE(readOutput(built) == original) + << "the loaded plan's output differs from the original plan's"; + } + + void roundTripInBothForms(const Problem& p) + { + for(const SaveForm form : {SaveForm::GRAPH_AND_PLAN, SaveForm::PLAN_ONLY}) + { + SCOPED_TRACE(form == SaveForm::GRAPH_AND_PLAN ? "graph and plan" : "plan only"); + roundTripInAFreshHandle(p, form); + if(::testing::Test::HasFatalFailure() || ::testing::Test::IsSkipped()) + { + return; + } + } + } +}; + +TEST_F(IntegrationGpuAttentionPagedUnifiedSaveLoad, RestoresPagedUniformDecode) +{ + roundTripInBothForms(decodeProblem(DataType::BFLOAT16)); +} + +TEST_F(IntegrationGpuAttentionPagedUnifiedSaveLoad, RestoresSpeculativeDecodeRowsHalf) +{ + Problem p = decodeProblem(DataType::HALF); + p.denseQueryLength = 3; + p.queryLengths = {3, 1, 3, 2, 0, 3}; + roundTripInBothForms(p); +} + +TEST_F(IntegrationGpuAttentionPagedUnifiedSaveLoad, RestoresRaggedQueryOverPagedKvWithWindow) +{ + Problem p = mixedProblem(DataType::BFLOAT16); + p.leftBound = 32; + roundTripInBothForms(p); +} + +TEST_F(IntegrationGpuAttentionPagedUnifiedSaveLoad, RestoresSeparateKAndVPageTables) +{ + Problem dense = decodeProblem(DataType::BFLOAT16); + dense.separateVTable = true; + roundTripInBothForms(dense); + + Problem ragged = mixedProblem(DataType::HALF); + ragged.separateVTable = true; + roundTripInBothForms(ragged); +} + +TEST_F(IntegrationGpuAttentionPagedUnifiedSaveLoad, RestoresAttentionSinks) +{ + Problem p = mixedProblem(DataType::BFLOAT16); + p.sinks = true; + roundTripInBothForms(p); +} + +TEST_F(IntegrationGpuAttentionPagedUnifiedSaveLoad, RestoresFloatAttentionSinks) +{ + Problem p = mixedProblem(DataType::HALF); + p.sinks = true; + p.floatSinks = true; + roundTripInBothForms(p); +} + +} // namespace + +#endif diff --git a/dnn-providers/hip-kernel-provider/src/tests/CMakeLists.txt b/dnn-providers/hip-kernel-provider/src/tests/CMakeLists.txt index 7cb3c9456954..ab29b2282ec1 100644 --- a/dnn-providers/hip-kernel-provider/src/tests/CMakeLists.txt +++ b/dnn-providers/hip-kernel-provider/src/tests/CMakeLists.txt @@ -616,7 +616,13 @@ if(HIPDNN_ENABLE_KERNEL_INGESTOR) # in hkp-unpulled-models.record; the suite tolerates an absent UHD only when that record # names it, and never when HIPKERNELPROVIDER_REQUIRE_DVC_DESCRIPTORS is ON, which it # learns from the compile definition below. - set(_hkp_companion_suites CatalogTiles catalog_tiles ModelBinding model_binding) + # SchemaGate feeds the engine a ragged graph and a graph declaring a non-default + # alignment, both stamped engine API 1.3.0, which GenericPlanBuilder's schema gate + # declines because the descriptor declares sdk_version 1.0.0 and graph_match checks + # neither feature. IngestorGenerator's test_gfx950_attention_dense_schema_gate pins + # the same sdk_version where no gfx950 shard is built. + set(_hkp_companion_suites + CatalogTiles catalog_tiles ModelBinding model_binding SchemaGate schema_gate) set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/engines/kernel_ingestor_engine/packs/TestGfx942AttentionUnified3dModelBinding.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/engines/kernel_ingestor_engine/packs/TestGfx942AttentionDenseModelBinding.cpp" @@ -630,6 +636,10 @@ if(HIPDNN_ENABLE_KERNEL_INGESTOR) EveryShippedKernelsGeometryIsOneTheEngineLaunches EveryEntryLaunchesItsSegmentAndReduceKernels) set(_hkp_catalog_tiles_cases_gfx942_dense EveryShippedKernelsTileIsOneTheEngineLaunches) + set(_hkp_schema_gate_cases_gfx950_dense + DeclinesARaggedGraphAtTheSchemaGate + DeclinesANonDefaultAlignmentGraphAtTheSchemaGate + PassesTheBaselineGraphThroughTheSchemaGate) set(_hkp_catalog_tiles_cases_gfx942_unified_2d EveryShippedKernelsGeometryIsOneTheEngineLaunches EveryCellShipsItsHeadSizesDefaultGeometry @@ -642,21 +652,33 @@ if(HIPDNN_ENABLE_KERNEL_INGESTOR) set(_hkp_model_binding_cases_gfx942_dense TheBoundL2KernelRankerLoads TheBoundL1EnginePredictorLoadsAndMatchesThisBuild) - + # A hand-written TestPacks suite whose cases differ from the generated ones + # lists them under _hkp_packs_cases_. + set(_hkp_packs_cases_AttentionPagedUnified + LoadsExactlyTheEmittedPacks + LoadsExactlyTheEmittedKernels + EveryLoadedDescriptorCoversTheRequestedArch + EveryKernelDeclaresTheEmittedRuntimeSourceKind + DeclaresTheConfiguredSdkVersion + ExposesTheConfiguredKnobs + ShipsNoHeuristicAndRegistersNoScoreSymbol + CarriesOneGraphScopedMatcherPerPack + CarriesExactlyOneSharedKernelScopedMatcher) + + # An engine that ships for several architectures has a row per architecture but one + # Packs suite, and a suite may be declared once, so the rows collect each engine's + # shipped architectures and the Packs census registers after the loop. + set(_hkp_packs_census_engines "") set(_engines ${HKP_PINNED_ATTENTION_ENGINES}) while(_engines) list(POP_FRONT _engines _arch _snake _local _filter_var _toml _categories_var) hkp_product_ships_engine_for_arch(_hkp_${_arch}_attention_${_snake} "hipkernel:${_local}" ${_arch}) if(_hkp_${_arch}_attention_${_snake}) - _hkp_generated_packs_cases_for(_hkp_cases Test${_local}Packs) - hkp_register_census_tests( - TARGET hip_kernel_provider_census_tests - PACK_NAME product - ARCHES ${_arch} - SUITES Test${_local}Packs - EXPECTED_CASES ${_hkp_cases} - ) + if(NOT _local IN_LIST _hkp_packs_census_engines) + list(APPEND _hkp_packs_census_engines ${_local}) + endif() + list(APPEND _hkp_packs_census_arches_${_local} ${_arch}) else() message(STATUS "hkp: this configuration does not ship hipkernel:${_local} for " @@ -678,6 +700,20 @@ if(HIPDNN_ENABLE_KERNEL_INGESTOR) unset(_hkp_${_stem}_cases_${_arch}_${_snake}) endwhile() endwhile() + foreach(_local IN LISTS _hkp_packs_census_engines) + if(DEFINED _hkp_packs_cases_${_local}) + set(_cases ${_hkp_packs_cases_${_local}}) + else() + _hkp_generated_packs_cases_for(_cases Test${_local}Packs) + endif() + hkp_register_census_tests( + TARGET hip_kernel_provider_census_tests + PACK_NAME product + ARCHES ${_hkp_packs_census_arches_${_local}} + SUITES Test${_local}Packs + EXPECTED_CASES ${_cases} + ) + endforeach() # The loop unsets each row's entries, so one left set names no row and its census would # silently never register. set(_hkp_companion_stems "") diff --git a/dnn-providers/hip-kernel-provider/src/tests/core/TestContainer.cpp b/dnn-providers/hip-kernel-provider/src/tests/core/TestContainer.cpp index 81b6352c228d..a0a883497ecd 100644 --- a/dnn-providers/hip-kernel-provider/src/tests/core/TestContainer.cpp +++ b/dnn-providers/hip-kernel-provider/src/tests/core/TestContainer.cpp @@ -444,7 +444,9 @@ TEST(TestContainer, GetEngineNameRejectsANullNameArgument) // backward engines claim 1.4.0 (their UEDs' sdk_version; their matchers reviewed against every field // up to it, and a backward graph never carries cu_seq_len). So does the RDNA WMMA prefill engine, // whose matcher gates paged K/V, ragged Q / O and their offset multipliers, and every declared -// alignment. The gfx950 rocKE conv dgrad engine +// alignment. The rocKE paged/ragged attention engine (AttentionPagedUnified) claims 1.4.0 +// as well: its graph matcher serves ragged Q / O with their offset multipliers and gates +// every declared alignment against what its kernels load. The gfx950 rocKE conv dgrad engine // claims 1.3.0: its graph matcher gates alignment (multiples of 16 bytes) and declines ragged // tensors. Every other engine stays at or below the 1.2.0 baseline, so ragged, aligned and // multiplier graphs never reach it. Opting an engine in is an edit here, reviewed with that @@ -454,6 +456,7 @@ TEST(TestContainer, PinsEveryEnginesDeclaredGraphSchema) const std::map optedIn{ {"hipkernel:Gfx950ConvDgradAot", "1.3.0"}, {"hipkernel:Gfx1151WmmaAttention", "1.4.0"}, + {"hipkernel:AttentionPagedUnified", "1.4.0"}, {std::string(hipdnn_data_sdk::utilities::ASM_SDPA_ENGINE_NAME), "1.4.0"}, {std::string(hipdnn_data_sdk::utilities::HIP_MLOPS_ENGINE_NAME), "1.4.0"}, {std::string(hipdnn_data_sdk::utilities::HIP_FLASH2_ENGINE_NAME), "1.4.0"}, diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/CMakeLists.txt b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/CMakeLists.txt index 5ab8b1f4ccab..e2faf6f21c49 100644 --- a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/CMakeLists.txt +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/CMakeLists.txt @@ -49,6 +49,8 @@ target_sources(hip_kernel_provider_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestFlydslSdpaBwdMatcher.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx950ConvDgradGeometry.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx950ConvDgradMatchers.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestAttentionPagedUnifiedMatchers.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestAttentionPagedUnifiedLaunchValues.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx1250ConvDgradGeometry.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx1250ConvDgradMatchers.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx1151WmmaAttentionPaged.cpp @@ -131,11 +133,13 @@ target_sources(hip_kernel_provider_census_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx950AttentionUnified3DCatalogTiles.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx942AttentionDensePacks.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx942AttentionDenseCatalogTiles.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx950AttentionDenseSchemaGate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx942AttentionDenseModelBinding.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx1151WmmaAttentionPacks.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx1151WmmaAttentionCatalog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx1151WmmaAttentionDecodePacks.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx950ConvDgradAotPacks.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestAttentionPagedUnifiedPacks.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx1250ConvDgradAotPacks.cpp ${CMAKE_CURRENT_SOURCE_DIR}/packs/TestGfx1250ConvDgradAotModelBinding.cpp ) diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/TestKernelIngestorEngine.cpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/TestKernelIngestorEngine.cpp index 5ef0ea614e31..765612510edc 100644 --- a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/TestKernelIngestorEngine.cpp +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/TestKernelIngestorEngine.cpp @@ -650,7 +650,6 @@ TEST(TestKernelIngestorEngine, EveryHandlerReportsSupportsSavingExactlyWhenItSav "hipkernel.gfx950_conv_dgrad_aot.dispatch", "hipkernel.gfx1250_conv_dgrad_aot.dispatch", "hipkernel.gfx942_attention_unified3d.dispatch", - #ifdef HIPDNN_ENGINE_FLYDSL // FlyDSL's packs, compiled in whenever the production root has FlyDSL content. "hipkernel.flydsl_rmsnorm.dispatch", @@ -676,6 +675,7 @@ TEST(TestKernelIngestorEngine, EveryHandlerReportsSupportsSavingExactlyWhenItSav "hipkernel.gfx942_attention_dense.dispatch", "hipkernel.gfx1151_wmma_attention.dispatch", "hipkernel.gfx1151_wmma_attention_decode.dispatch", + "hipkernel.attention_paged_unified.dispatch", }; EXPECT_EQ(packDispatchSymbols.size(), ingestorPacks().size()) << "add the dispatch symbol of each new pack to this list"; diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestAttentionPagedUnifiedLaunchValues.cpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestAttentionPagedUnifiedLaunchValues.cpp new file mode 100644 index 000000000000..152ef7e0fc47 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestAttentionPagedUnifiedLaunchValues.cpp @@ -0,0 +1,394 @@ +// Copyright © Advanced Micro Devices, Inc., or its affiliates. +// SPDX-License-Identifier: MIT + +#ifdef HIPDNN_ENABLE_KERNEL_INGESTOR + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedLaunchValues.hpp" +#include "engines/kernel_ingestor_engine/serialization/IngestorPlanTestUtilities.hpp" + +/** + * @file TestAttentionPagedUnifiedLaunchValues.cpp + * @brief The saved launch values of hipkernel:AttentionPagedUnified: every member of the + * launch state maps to the value of its own name and type, reads back unchanged + * for each binding the engine serves (dense, ragged, separate K and V page tables, + * sinks in the Q data type and FLOAT, every finite scale), and the reader refuses + * values outside the v1 contract. No device needed. + * + * Each member gets a distinct value, so a swapped or dropped mapping shows. The expected + * names are written out again here: they are the stored contract, and a test that shared + * the constants would not see a rename. + */ +namespace hip_kernel_provider::kernel_ingestor_engine +{ +namespace +{ + +using hipdnn_plugin_sdk::ingestor::MetadataType; +using hipdnn_plugin_sdk::ingestor::MetadataValues; +using hipdnn_plugin_sdk::ingestor::SavedLaunchInputs; +using hipdnn_plugin_sdk::ingestor::toString; +using serialization::expectCommonReadRefusals; + +constexpr int64_t NO_UID = ATTENTION_PAGED_UNIFIED_NO_UID; + +/// A dense (uniform decode) binding: one page table for K and V, no sink. +AttentionPagedUnifiedLaunchInputs denseInputs() +{ + AttentionPagedUnifiedLaunchInputs launch; + launch.uids.q = 101; + launch.uids.k = 102; + launch.uids.v = 103; + launch.uids.o = 104; + launch.uids.pageTableK = 105; + launch.uids.pageTableV = 105; + launch.uids.seqLenKv = 107; + launch.uids.seqLenQ = 108; + launch.uids.raggedOffset = NO_UID; + launch.uids.sink = NO_UID; + auto& s = launch.scalars; + s.scale = 1.0F / std::sqrt(128.0F); + s.numSeqs = 6; + s.blockTableStride = 24; + s.numQueryHeads = 32; + s.numKvHeads = 8; + s.slidingWindow = 0x3FFFFFFF; + s.qUniformLen = 3; + s.q = {12288, 4096, 128}; + s.o = {12416, 4224, 136}; + s.kvBlockStride = 65536; + s.kvTokStride = 256; + s.kvHeadStride = 8192; + s.kvBlockSpanBytes = 131072; + s.qBlockGrid = 18; + s.numKvBlocks = 4096; + s.blockTableWidth = 24; + launch.blockThreads = 256; + return launch; +} + +/// A ragged Q over paged K/V with a sliding window. +AttentionPagedUnifiedLaunchInputs raggedInputs() +{ + auto launch = denseInputs(); + launch.uids.raggedOffset = 109; + launch.scalars.numSeqs = 5; + launch.scalars.qUniformLen = 0; + launch.scalars.slidingWindow = 33; + launch.scalars.q = {4096, 4096, 128}; + launch.scalars.o = {4224, 4224, 136}; + launch.scalars.qBlockGrid = 21; + return launch; +} + +/// Separate page_table_k and page_table_v tensors. +AttentionPagedUnifiedLaunchInputs separateTablesInputs() +{ + auto launch = denseInputs(); + launch.uids.pageTableV = 110; + return launch; +} + +/// An attention sink in the I/O dtype. +AttentionPagedUnifiedLaunchInputs sinkInputs() +{ + auto launch = raggedInputs(); + launch.uids.sink = 111; + launch.blockThreads = 128; + return launch; +} + +/// A FLOAT attention sink (cuDNN's form). +AttentionPagedUnifiedLaunchInputs floatSinkInputs() +{ + auto launch = sinkInputs(); + launch.scalars.sinkIsF32 = 1; + return launch; +} + +SavedLaunchInputs saved(const AttentionPagedUnifiedLaunchInputs& launch) +{ + return {std::string(ATTENTION_PAGED_UNIFIED_DISPATCH_SYMBOL_V1), + attentionPagedUnifiedLaunchValues(launch)}; +} + +uint32_t bitsOf(float value) +{ + uint32_t bits = 0; + std::memcpy(&bits, &value, sizeof(bits)); + return bits; +} + +void expectSameLaunch(const AttentionPagedUnifiedLaunchInputs& read, + const AttentionPagedUnifiedLaunchInputs& expected) +{ + EXPECT_EQ(read.uids.q, expected.uids.q); + EXPECT_EQ(read.uids.k, expected.uids.k); + EXPECT_EQ(read.uids.v, expected.uids.v); + EXPECT_EQ(read.uids.o, expected.uids.o); + EXPECT_EQ(read.uids.pageTableK, expected.uids.pageTableK); + EXPECT_EQ(read.uids.pageTableV, expected.uids.pageTableV); + EXPECT_EQ(read.uids.seqLenKv, expected.uids.seqLenKv); + EXPECT_EQ(read.uids.seqLenQ, expected.uids.seqLenQ); + EXPECT_EQ(read.uids.raggedOffset, expected.uids.raggedOffset); + EXPECT_EQ(read.uids.sink, expected.uids.sink); + const auto& r = read.scalars; + const auto& e = expected.scalars; + EXPECT_EQ(bitsOf(r.scale), bitsOf(e.scale)); + EXPECT_EQ(r.numSeqs, e.numSeqs); + EXPECT_EQ(r.blockTableStride, e.blockTableStride); + EXPECT_EQ(r.numQueryHeads, e.numQueryHeads); + EXPECT_EQ(r.numKvHeads, e.numKvHeads); + EXPECT_EQ(r.slidingWindow, e.slidingWindow); + EXPECT_EQ(r.qUniformLen, e.qUniformLen); + EXPECT_EQ(r.q.seqStride, e.q.seqStride); + EXPECT_EQ(r.q.tokenStride, e.q.tokenStride); + EXPECT_EQ(r.q.headStride, e.q.headStride); + EXPECT_EQ(r.o.seqStride, e.o.seqStride); + EXPECT_EQ(r.o.tokenStride, e.o.tokenStride); + EXPECT_EQ(r.o.headStride, e.o.headStride); + EXPECT_EQ(r.kvBlockStride, e.kvBlockStride); + EXPECT_EQ(r.kvTokStride, e.kvTokStride); + EXPECT_EQ(r.kvHeadStride, e.kvHeadStride); + EXPECT_EQ(r.kvBlockSpanBytes, e.kvBlockSpanBytes); + EXPECT_EQ(r.qBlockGrid, e.qBlockGrid); + EXPECT_EQ(r.sinkIsF32, e.sinkIsF32); + EXPECT_EQ(r.numKvBlocks, e.numKvBlocks); + EXPECT_EQ(r.blockTableWidth, e.blockTableWidth); + EXPECT_EQ(read.blockThreads, expected.blockThreads); +} + +// Expects the reader to refuse `inputs` as a valid plan that cannot be restored, with +// `phrase` in the message. +void expectRefusal(const SavedLaunchInputs& inputs, const std::string& phrase) +{ + serialization::expectReadRefusal(&readAttentionPagedUnifiedLaunchInputs, inputs, phrase); +} + +SavedLaunchInputs with(SavedLaunchInputs inputs, + const std::string& name, + hipdnn_plugin_sdk::ingestor::MetadataValue value) +{ + inputs.values[name] = std::move(value); + return inputs; +} + +TEST(TestAttentionPagedUnifiedLaunchValues, ValuesMatchTheV1Contract) +{ + const auto launch = denseInputs(); + + const MetadataValues values = attentionPagedUnifiedLaunchValues(launch); + + const MetadataValues expected{{"q.uid", int64_t{101}}, + {"k.uid", int64_t{102}}, + {"v.uid", int64_t{103}}, + {"o.uid", int64_t{104}}, + {"page_table_k.uid", int64_t{105}}, + {"page_table_v.uid", int64_t{105}}, + {"seq_len_kv.uid", int64_t{107}}, + {"seq_len_q.uid", int64_t{108}}, + {"ragged_offset.uid", int64_t{-1}}, + {"sink.uid", int64_t{-1}}, + {"scale", static_cast(launch.scalars.scale)}, + {"num_seqs", int64_t{6}}, + {"block_table_stride", int64_t{24}}, + {"num_query_heads", int64_t{32}}, + {"num_kv_heads", int64_t{8}}, + {"sliding_window", int64_t{0x3FFFFFFF}}, + {"q_uniform_len", int64_t{3}}, + {"q_seq_stride", int64_t{12288}}, + {"q_tok_stride", int64_t{4096}}, + {"q_head_stride", int64_t{128}}, + {"o_seq_stride", int64_t{12416}}, + {"o_tok_stride", int64_t{4224}}, + {"o_head_stride", int64_t{136}}, + {"kv_block_stride", int64_t{65536}}, + {"kv_tok_stride", int64_t{256}}, + {"kv_head_stride", int64_t{8192}}, + {"kv_block_span_bytes", int64_t{131072}}, + {"q_block_grid", int64_t{18}}, + {"sink_is_f32", int64_t{0}}, + {"num_kv_blocks", int64_t{4096}}, + {"block_table_width", int64_t{24}}, + {"block_threads", int64_t{256}}}; + EXPECT_EQ(values, expected); + EXPECT_EQ(ATTENTION_PAGED_UNIFIED_DISPATCH_SYMBOL_V1, + "hipkernel.attention_paged_unified.dispatch.v1"); +} + +TEST(TestAttentionPagedUnifiedLaunchValues, DenseInputsRoundTripThroughTheirValues) +{ + expectSameLaunch(readAttentionPagedUnifiedLaunchInputs(saved(denseInputs())), denseInputs()); +} + +TEST(TestAttentionPagedUnifiedLaunchValues, RaggedInputsRoundTripThroughTheirValues) +{ + expectSameLaunch(readAttentionPagedUnifiedLaunchInputs(saved(raggedInputs())), raggedInputs()); +} + +TEST(TestAttentionPagedUnifiedLaunchValues, SeparateKAndVTablesRoundTripThroughTheirValues) +{ + const auto read = readAttentionPagedUnifiedLaunchInputs(saved(separateTablesInputs())); + expectSameLaunch(read, separateTablesInputs()); + EXPECT_NE(read.uids.pageTableK, read.uids.pageTableV); +} + +TEST(TestAttentionPagedUnifiedLaunchValues, SinkInputsRoundTripThroughTheirValues) +{ + expectSameLaunch(readAttentionPagedUnifiedLaunchInputs(saved(sinkInputs())), sinkInputs()); + const auto read = readAttentionPagedUnifiedLaunchInputs(saved(floatSinkInputs())); + expectSameLaunch(read, floatSinkInputs()); + EXPECT_EQ(read.scalars.sinkIsF32, 1); +} + +// graph_match serves every finite attn_scale, so a plan with a zero or negative scale +// saves and must load back. +TEST(TestAttentionPagedUnifiedLaunchValues, ZeroAndNegativeScalesRoundTripThroughTheirValues) +{ + for(const float scale : {0.0F, -0.0F, -0.125F, -std::numeric_limits::max()}) + { + SCOPED_TRACE(scale); + auto launch = denseInputs(); + launch.scalars.scale = scale; + expectSameLaunch(readAttentionPagedUnifiedLaunchInputs(saved(launch)), launch); + } +} + +TEST(TestAttentionPagedUnifiedLaunchValues, RefusesWhatEveryReaderRefuses) +{ + expectCommonReadRefusals(&readAttentionPagedUnifiedLaunchInputs, + saved(denseInputs()), + "hipkernel.attention_paged_unified.dispatch", + "num_seqs"); +} + +TEST(TestAttentionPagedUnifiedLaunchValues, RefusesAnotherContractName) +{ + for(const char* name : {"hipkernel.attention_paged_unified.dispatch.v2", + "hipkernel.gfx950_attention_dense.dispatch.v2"}) + { + SCOPED_TRACE(name); + auto inputs = saved(denseInputs()); + inputs.dispatchSymbol = name; + expectRefusal(inputs, "names no launch-value contract"); + } +} + +TEST(TestAttentionPagedUnifiedLaunchValues, RefusesAMissingOptionalOrFloatValue) +{ + for(const char* name : + {"sink.uid", + "ragged_offset.uid", + "scale", + "sink_is_f32", + "num_kv_blocks", + "block_table_width"}) + { + SCOPED_TRACE(name); + auto missing = saved(denseInputs()); + missing.values.erase(name); + expectRefusal(missing, "needs launch value '" + std::string(name) + "'"); + } +} + +TEST(TestAttentionPagedUnifiedLaunchValues, RefusesAValueOfAnotherType) +{ + const auto valid = saved(denseInputs()); + expectRefusal(with(valid, "k.uid", 102.0), "launch value 'k.uid'"); + + const std::string mustBeFloat + = "must be " + toString(MetadataType::FLOAT) + ", and the plan holds "; + expectRefusal(with(valid, "scale", int64_t{1}), mustBeFloat + toString(MetadataType::INT)); + expectRefusal(with(valid, "scale", std::string("0.088")), + mustBeFloat + toString(MetadataType::STRING)); +} + +TEST(TestAttentionPagedUnifiedLaunchValues, RefusesAnIntegerOutsideWhatTheKernelTakes) +{ + const auto dense = saved(denseInputs()); + const auto ragged = saved(raggedInputs()); + struct OutOfRange + { + const SavedLaunchInputs* base; + const char* name; + int64_t value; + }; + const std::vector cases = { + {&dense, "num_seqs", 0}, + {&dense, "num_seqs", int64_t{2147483648}}, + {&dense, "num_query_heads", 0}, + {&dense, "num_kv_heads", 0}, + // The kernel keeps key k iff d - k < window, so 0 or below keeps none. + {&dense, "sliding_window", 0}, + {&dense, "sliding_window", -1}, + {&dense, "sliding_window", int64_t{0x40000000}}, + {&dense, "q_uniform_len", 0}, // a dense Q has at least one row per sequence + {&dense, "q_uniform_len", -3}, + {&ragged, "q_uniform_len", 1}, // a ragged Q reads its rows from the offsets + {&ragged, "q_uniform_len", -1}, + {&dense, "sink_is_f32", -1}, + {&dense, "sink_is_f32", 2}, + {&dense, "num_kv_blocks", 0}, // a K/V container holds at least one block + {&dense, "num_kv_blocks", -1}, + {&dense, "num_kv_blocks", int64_t{2147483648}}, + // A page-table row is at least one entry wide; a length is capped at its width. + {&dense, "block_table_width", 0}, + {&dense, "block_table_width", -1}, + {&dense, "block_table_width", int64_t{2147483648}}, + {&dense, "block_table_stride", -1}, + {&dense, "q_tok_stride", -1}, + {&dense, "o_head_stride", int64_t{2147483648}}, + {&dense, "kv_block_stride", -1}, + {&dense, "kv_block_span_bytes", 0}, + {&dense, "kv_block_span_bytes", int64_t{0x7FFF0001}}, + {&dense, "q_block_grid", 0}, + {&dense, "q_block_grid", 65536}, + {&dense, "block_threads", 32}, + {&dense, "block_threads", 2048}, + }; + for(const auto& c : cases) + { + SCOPED_TRACE(std::string(c.name) + " = " + std::to_string(c.value)); + expectRefusal(with(*c.base, c.name, c.value), "launch value '" + std::string(c.name) + "'"); + } + + // In range, but not a whole number of waves. + expectRefusal(with(dense, "block_threads", int64_t{96}), "a multiple of 64"); + // The query heads must share the KV heads evenly. + expectRefusal(with(dense, "num_query_heads", int64_t{12}), "a multiple of 'num_kv_heads'"); +} + +TEST(TestAttentionPagedUnifiedLaunchValues, RefusesAScaleNoFiniteFloatWasSavedAs) +{ + const auto valid = saved(denseInputs()); + // 0.1 as a double is not a float value, so no float scale was saved as it. + for(const double scale : {0.1, + std::numeric_limits::infinity(), + -std::numeric_limits::infinity(), + std::numeric_limits::quiet_NaN(), + 1.0e39, + -1.0e39}) + { + SCOPED_TRACE(scale); + expectRefusal(with(valid, "scale", scale), "launch value 'scale'"); + } +} + +} // namespace +} // namespace hip_kernel_provider::kernel_ingestor_engine + +#endif // HIPDNN_ENABLE_KERNEL_INGESTOR diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestAttentionPagedUnifiedMatchers.cpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestAttentionPagedUnifiedMatchers.cpp new file mode 100644 index 000000000000..bc5319c9971d --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestAttentionPagedUnifiedMatchers.cpp @@ -0,0 +1,991 @@ +// Copyright © Advanced Micro Devices, Inc., or its affiliates. +// SPDX-License-Identifier: MIT + +#ifdef HIPDNN_ENABLE_KERNEL_INGESTOR + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "engines/kernel_ingestor_engine/IngestorPacks.hpp" +#include "engines/kernel_ingestor_engine/KernelIngestorEngine.hpp" + +/** + * @file TestAttentionPagedUnifiedMatchers.cpp + * @brief Graph and kernel matching for hipkernel:AttentionPagedUnified: the paged + * uniform-decode (dense Q) and ragged-Q graphs it serves, and a logged decline, + * with its cause, for everything else. Matcher-only: no device, no launch. + */ +namespace hip_kernel_provider::kernel_ingestor_engine::testing +{ +namespace +{ + +namespace d = hipdnn_flatbuffers_sdk::data_objects; +using hipdnn_plugin_sdk::ingestor::BoundTokens; +using hipdnn_plugin_sdk::ingestor::DeviceProperties; +using hipdnn_plugin_sdk::ingestor::KernelDefinition; +using hipdnn_plugin_sdk::ingestor::MatchContext; +using hipdnn_plugin_sdk::ingestor::tryGetBoundInt; + +constexpr std::string_view GRAPH_MATCHER_SYMBOL = "hipkernel.attention_paged_unified.graph_match"; +constexpr std::string_view KERNEL_MATCHER_SYMBOL = "hipkernel.attention_paged_unified.kernel_match"; + +constexpr int64_t Q_UID = 1; +constexpr int64_t K_UID = 2; +constexpr int64_t V_UID = 3; +constexpr int64_t O_UID = 4; +constexpr int64_t PAGE_TABLE_UID = 5; +constexpr int64_t SEQ_LEN_KV_UID = 6; +constexpr int64_t SEQ_LEN_Q_UID = 7; +constexpr int64_t RAGGED_OFFSET_UID = 8; +constexpr int64_t EXTRA_UID = 9; +constexpr int64_t SINK_UID = 10; + +constexpr int64_t BATCH = 4; +constexpr int64_t QUERY_HEADS = 32; +constexpr int64_t KV_HEADS = 8; +constexpr int64_t HEAD_SIZE = 128; +constexpr int64_t BLOCK_SIZE = 16; +constexpr int64_t NUM_BLOCKS = 1000; +constexpr int64_t MAX_BLOCKS = 64; + +std::unique_ptr + tensor(int64_t uid, d::DataType type, std::vector dims, std::vector strides) +{ + auto t = std::make_unique(); + t->uid = uid; + t->data_type = type; + t->dims = std::move(dims); + t->strides = std::move(strides); + return t; +} + +std::vector packed(const std::vector& dims) +{ + std::vector strides(dims.size(), 1); + for(size_t i = dims.size(); i > 1; --i) + { + strides[i - 2] = strides[i - 1] * dims[i - 1]; + } + return strides; +} + +/** + * The uniform-decode graph the vLLM plugin builds: Q/O `[B, Hq, 1, D]` token-major, + * K/V the interleaved views of one `[num_blocks, Hkv, block_size, 2*D]` cache, one page + * table `[B, 1, M, 1]` (vLLM's block_table view) for both K and V, INT32 seq_len_q and + * seq_len_kv (a paged graph carries both), and bottom-right causal masking. + */ +d::GraphT decodeGraph(d::DataType type = d::DataType::BFLOAT16) +{ + d::GraphT g; + const int64_t tokenStride = QUERY_HEADS * HEAD_SIZE; + g.tensors.push_back(tensor( + Q_UID, type, {BATCH, QUERY_HEADS, 1, HEAD_SIZE}, {tokenStride, HEAD_SIZE, tokenStride, 1})); + const std::vector kvStrides + = {KV_HEADS * BLOCK_SIZE * 2 * HEAD_SIZE, BLOCK_SIZE * 2 * HEAD_SIZE, 2 * HEAD_SIZE, 1}; + g.tensors.push_back( + tensor(K_UID, type, {NUM_BLOCKS, KV_HEADS, BLOCK_SIZE, HEAD_SIZE}, kvStrides)); + g.tensors.push_back( + tensor(V_UID, type, {NUM_BLOCKS, KV_HEADS, BLOCK_SIZE, HEAD_SIZE}, kvStrides)); + g.tensors.push_back(tensor( + O_UID, type, {BATCH, QUERY_HEADS, 1, HEAD_SIZE}, {tokenStride, HEAD_SIZE, tokenStride, 1})); + g.tensors.push_back(tensor(PAGE_TABLE_UID, + d::DataType::INT32, + {BATCH, 1, MAX_BLOCKS, 1}, + {MAX_BLOCKS, MAX_BLOCKS, 1, 1})); + g.tensors.push_back(tensor(SEQ_LEN_KV_UID, d::DataType::INT32, {BATCH, 1, 1, 1}, {1, 1, 1, 1})); + g.tensors.push_back(tensor(SEQ_LEN_Q_UID, d::DataType::INT32, {BATCH, 1, 1, 1}, {1, 1, 1, 1})); + + d::SdpaAttributesT a; + a.q_tensor_uid = Q_UID; + a.k_tensor_uid = K_UID; + a.v_tensor_uid = V_UID; + a.o_tensor_uid = O_UID; + a.page_table_k_tensor_uid = PAGE_TABLE_UID; + a.page_table_v_tensor_uid = PAGE_TABLE_UID; + a.seq_len_kv_tensor_uid = SEQ_LEN_KV_UID; + a.seq_len_q_tensor_uid = SEQ_LEN_Q_UID; + a.max_seq_len_kv = static_cast(MAX_BLOCKS * BLOCK_SIZE); + a.padding_mask = true; + a.right_bound = 0; + a.diagonal_alignment = d::DiagonalAlignment::BOTTOM_RIGHT; + a.attn_scale_value = 0.08838835F; + auto n = std::make_unique(); + n->compute_data_type = d::DataType::FLOAT; + n->attributes.Set(a); + g.nodes.push_back(std::move(n)); + return g; +} + +/// The mixed-batch graph: Q/O ragged at the sequence axis through one token-unit +/// offset table (multiplier = token stride). +d::GraphT raggedGraph() +{ + auto g = decodeGraph(); + const int64_t maxTokens = 2048; + // Q is a view of a fused QKV projection: token stride (Hq + 2 Hkv) * D. + const int64_t qTokenStride = (QUERY_HEADS + 2 * KV_HEADS) * HEAD_SIZE; + auto& q = *g.tensors[0]; + q.dims = {BATCH, QUERY_HEADS, maxTokens, HEAD_SIZE}; + q.strides = {maxTokens * qTokenStride, HEAD_SIZE, qTokenStride, 1}; + q.ragged_offset_tensor_uid = RAGGED_OFFSET_UID; + q.ragged_offset_multiplier = qTokenStride; + auto& o = *g.tensors[3]; + const int64_t oTokenStride = QUERY_HEADS * HEAD_SIZE; + o.dims = {BATCH, QUERY_HEADS, maxTokens, HEAD_SIZE}; + o.strides = {maxTokens * oTokenStride, HEAD_SIZE, oTokenStride, 1}; + o.ragged_offset_tensor_uid = RAGGED_OFFSET_UID; + o.ragged_offset_multiplier = oTokenStride; + g.tensors.push_back( + tensor(RAGGED_OFFSET_UID, d::DataType::INT32, {BATCH + 1, 1, 1, 1}, {1, 1, 1, 1})); + return g; +} + +/// The decode graph with a gpt-oss attention sink: one BF16 logit per query head, +/// `[1, Hq, 1, 1]` packed. +d::GraphT sinkGraph() +{ + auto g = decodeGraph(); + g.tensors.push_back(tensor( + SINK_UID, d::DataType::BFLOAT16, {1, QUERY_HEADS, 1, 1}, packed({1, QUERY_HEADS, 1, 1}))); + g.nodes[0]->attributes.AsSdpaAttributes()->sink_token_tensor_uid = SINK_UID; + return g; +} + +DeviceProperties deviceProperties() +{ + DeviceProperties properties; + properties.gcnArchName = "gfx942"; + properties.warpSize = 64; + return properties; +} + +d::SdpaAttributesT& attrs(d::GraphT& g) +{ + return *g.nodes[0]->attributes.AsSdpaAttributes(); +} + +d::TensorAttributesT& find(d::GraphT& g, int64_t uid) +{ + for(auto& t : g.tensors) + { + if(t->uid == uid) + { + return *t; + } + } + throw std::runtime_error("no tensor " + std::to_string(uid)); +} + +using Mutation = std::function; + +std::optional match(d::GraphT g, const Mutation& change = {}) +{ + registerNativeIngestorSymbols(); + if(change) + { + change(g); + } + flatbuffers::FlatBufferBuilder builder; + builder.Finish(d::Graph::Pack(builder, &g)); + const hipdnn_flatbuffers_sdk::flatbuffer_utilities::GraphWrapper wrapper( + builder.GetBufferPointer(), builder.GetSize()); + const auto properties = deviceProperties(); + const MatchContext context{wrapper, 0, properties}; + return hipdnn_plugin_sdk::ingestor::GraphMatchRegistry::resolve( + std::string(GRAPH_MATCHER_SYMBOL))(context); +} + +struct LoggedDecline +{ + std::string cause; + std::string detail; +}; + +/// The decline graph_match logged at INFO, or an empty cause. +LoggedDecline loggedDecline(d::GraphT g, const Mutation& change) +{ + const std::string marker + = std::string(ATTENTION_PAGED_UNIFIED_ENGINE_NAME) + " declined the graph ["; + const auto recorder + = hipdnn_test_sdk::utilities::SharedLogRecorder::withOverrideLevel(HIPDNN_SEV_INFO); + EXPECT_FALSE(match(std::move(g), change).has_value()); + for(const auto& log : recorder.getRecordedLogs()) + { + const auto at = log.message.find(marker); + const auto end = at == std::string::npos ? at : log.message.find(']', at + marker.size()); + if(log.severity == HIPDNN_SEV_INFO && end != std::string::npos) + { + return {log.message.substr(at + marker.size(), end - at - marker.size()), + log.message.substr(end + 1)}; + } + } + return {}; +} + +KernelDefinition kernel(const std::string& dtype, + int64_t headSize, + int64_t blockSize, + int64_t queriesPerKv, + int64_t numWarps = 1, + int64_t kvHeads = 1) +{ + KernelDefinition k; + k.kernelId + = hipdnn_flatbuffers_sdk::utilities::parseUuid("00000000-0000-4000-8000-0000000000a1"); + k.metadata = { + {std::string("dtype"), dtype}, + {std::string("head_size"), headSize}, + {std::string("block_size"), blockSize}, + {std::string("num_query_heads"), queriesPerKv}, + {std::string("num_kv_heads"), kvHeads}, + {std::string("num_warps"), numWarps}, + {std::string("block_m_per_warp"), int64_t{16}}, + }; + return k; +} + +/// A candidate built with use_sinks. +KernelDefinition + sinkKernel(const std::string& dtype, int64_t headSize, int64_t blockSize, int64_t queriesPerKv) +{ + auto k = kernel(dtype, headSize, blockSize, queriesPerKv); + k.metadata[std::string("use_sinks")] = int64_t{1}; + return k; +} + +bool kernelMatches(const d::GraphT& g, const KernelDefinition& candidate) +{ + registerNativeIngestorSymbols(); + flatbuffers::FlatBufferBuilder builder; + builder.Finish(d::Graph::Pack(builder, &g)); + const hipdnn_flatbuffers_sdk::flatbuffer_utilities::GraphWrapper wrapper( + builder.GetBufferPointer(), builder.GetSize()); + const auto properties = deviceProperties(); + const MatchContext context{wrapper, 0, properties}; + const auto bound = hipdnn_plugin_sdk::ingestor::GraphMatchRegistry::resolve( + std::string(GRAPH_MATCHER_SYMBOL))(context); + EXPECT_TRUE(bound.has_value()); + if(!bound.has_value()) + { + return false; + } + return hipdnn_plugin_sdk::ingestor::KernelMatcherRegistry::resolve( + std::string(KERNEL_MATCHER_SYMBOL))(context, *bound, candidate); +} + +TEST(TestAttentionPagedUnifiedMatchers, ServesPagedUniformDecode) +{ + const auto bound = match(decodeGraph()); + ASSERT_TRUE(bound.has_value()); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.queries_per_kv"), 4); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.block_size"), BLOCK_SIZE); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.ragged_offset.uid"), -1); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.seq_len_q.uid"), SEQ_LEN_Q_UID); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.window"), 0x3FFFFFFF); +} + +/// Sq = 3 rows per sequence with seq_len_q below it for some: the padded rows are the +/// kernel's to zero. +TEST(TestAttentionPagedUnifiedMatchers, ServesSpeculativeDecodeRowsWithSeqLenQ) +{ + EXPECT_TRUE(match(decodeGraph(), [](d::GraphT& g) { + for(const auto uid : {Q_UID, O_UID}) + { + auto& t = find(g, uid); + t.dims[2] = 3; + t.strides + = {3 * QUERY_HEADS * HEAD_SIZE, HEAD_SIZE, QUERY_HEADS * HEAD_SIZE, 1}; + } + }).has_value()); +} + +TEST(TestAttentionPagedUnifiedMatchers, ServesRaggedQueryOverPagedKv) +{ + const auto bound = match(raggedGraph()); + ASSERT_TRUE(bound.has_value()); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.ragged_offset.uid"), + RAGGED_OFFSET_UID); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.seq_len_q.uid"), SEQ_LEN_Q_UID); +} + +/// cuDNN's form: page_table_v is its own tensor (EXTRA_UID), [B, 1, M, 1] with K's width +/// and batch stride unless @p dims / @p strides say otherwise. +void useSeparateVTable(d::GraphT& g, + std::vector dims = {BATCH, 1, MAX_BLOCKS, 1}, + std::vector strides = {MAX_BLOCKS, MAX_BLOCKS, 1, 1}) +{ + g.tensors.push_back(tensor(EXTRA_UID, d::DataType::INT32, std::move(dims), std::move(strides))); + attrs(g).page_table_v_tensor_uid = EXTRA_UID; +} + +TEST(TestAttentionPagedUnifiedMatchers, ServesSeparateKAndVPageTables) +{ + const auto bound = match(decodeGraph(), [](d::GraphT& g) { useSeparateVTable(g); }); + ASSERT_TRUE(bound.has_value()); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.page_table_k.uid"), PAGE_TABLE_UID); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.page_table_v.uid"), EXTRA_UID); + // One tensor for both binds the same uid twice. + const auto shared = match(decodeGraph()); + ASSERT_TRUE(shared.has_value()); + EXPECT_EQ(tryGetBoundInt(*shared, "attention_paged_unified.page_table_v.uid"), PAGE_TABLE_UID); + // A ragged Q with an unset max_seq_len_kv, as the paged graph bundles build it. + EXPECT_TRUE(match(raggedGraph(), [](d::GraphT& g) { + useSeparateVTable(g); + attrs(g).max_seq_len_kv = flatbuffers::nullopt; + }).has_value()); + // A unit-extent batch makes the batch strides irrelevant. + EXPECT_TRUE(match(decodeGraph(), [](d::GraphT& g) { + for(const auto uid : + {Q_UID, O_UID, PAGE_TABLE_UID, SEQ_LEN_KV_UID, SEQ_LEN_Q_UID}) + { + find(g, uid).dims[0] = 1; + } + useSeparateVTable(g, {1, 1, MAX_BLOCKS, 1}, {7 * MAX_BLOCKS, 1, 1, 1}); + }).has_value()); +} + +TEST(TestAttentionPagedUnifiedMatchers, ServesDenseAndRaggedBatchesPast65536Sequences) +{ + // A dense Q indexes its sequence from the grid; a ragged Q's sequence search takes its + // trip count from the batch at run time. Neither has a sequence limit below int32. + EXPECT_TRUE(match(decodeGraph(), [](d::GraphT& g) { + for(const auto uid : + {Q_UID, O_UID, PAGE_TABLE_UID, SEQ_LEN_KV_UID, SEQ_LEN_Q_UID}) + { + find(g, uid).dims[0] = 65537; + } + }).has_value()); + EXPECT_TRUE(match(raggedGraph(), [](d::GraphT& g) { + for(const auto uid : + {Q_UID, O_UID, PAGE_TABLE_UID, SEQ_LEN_KV_UID, SEQ_LEN_Q_UID}) + { + find(g, uid).dims[0] = 65537; + } + find(g, RAGGED_OFFSET_UID).dims[0] = 65538; + }).has_value()); +} + +TEST(TestAttentionPagedUnifiedMatchers, ServesSlidingWindowsAndDeprecatedBottomRightFlag) +{ + const auto bound = match(decodeGraph(), [](d::GraphT& g) { attrs(g).left_bound = 4096; }); + ASSERT_TRUE(bound.has_value()); + // left_bound L keeps the L keys ending at the diagonal (cuDNN); the kernel keeps + // key k for diagonal d iff d - k < window, so window = L. + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.window"), 4096); + EXPECT_EQ(tryGetBoundInt(*match(decodeGraph(), [](d::GraphT& g) { attrs(g).left_bound = 1; }), + "attention_paged_unified.window"), + 1); + EXPECT_TRUE(match(decodeGraph(), [](d::GraphT& g) { + attrs(g).right_bound = flatbuffers::nullopt; + attrs(g).diagonal_alignment = d::DiagonalAlignment::TOP_LEFT; + attrs(g).causal_mask_bottom_right = true; + }).has_value()); +} + +TEST(TestAttentionPagedUnifiedMatchers, ServesAnUnsetMaxSeqLenKv) +{ + // The kernel reads only seq_len_kv; the extent cuDNN infers (M * block_size) bounds + // it as a set max_seq_len_kv would. + EXPECT_TRUE(match(decodeGraph(), [](d::GraphT& g) { + attrs(g).max_seq_len_kv = flatbuffers::nullopt; + }).has_value()); + EXPECT_TRUE(match(raggedGraph(), [](d::GraphT& g) { + attrs(g).max_seq_len_kv = flatbuffers::nullopt; + }).has_value()); +} + +TEST(TestAttentionPagedUnifiedMatchers, ServesOtherContainerLayoutsAndHalf) +{ + // Plain NHD caches: [num_blocks, block_size, Hkv, D] contiguous. + EXPECT_TRUE(match(decodeGraph(), [](d::GraphT& g) { + for(const auto uid : {K_UID, V_UID}) + { + find(g, uid).strides = { + BLOCK_SIZE * KV_HEADS * HEAD_SIZE, HEAD_SIZE, KV_HEADS * HEAD_SIZE, 1}; + } + }).has_value()); + // HND: packed [num_blocks, Hkv, block_size, D]. + EXPECT_TRUE(match(decodeGraph(), [](d::GraphT& g) { + for(const auto uid : {K_UID, V_UID}) + { + find(g, uid).strides + = packed({NUM_BLOCKS, KV_HEADS, BLOCK_SIZE, HEAD_SIZE}); + } + }).has_value()); + EXPECT_TRUE(match(decodeGraph(d::DataType::HALF)).has_value()); +} + +TEST(TestAttentionPagedUnifiedMatchers, IgnoresStridesOfUnitExtentAxes) +{ + EXPECT_TRUE(match(decodeGraph(), [](d::GraphT& g) { + find(g, Q_UID).strides[2] = 7; // Sq == 1 + find(g, PAGE_TABLE_UID).strides[1] = 3; + }).has_value()); +} + +TEST(TestAttentionPagedUnifiedMatchers, MatchesOnlyTheCandidateBuiltForTheGraph) +{ + EXPECT_TRUE(kernelMatches(decodeGraph(), kernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4))); + EXPECT_FALSE(kernelMatches(decodeGraph(), kernel("FP16", HEAD_SIZE, BLOCK_SIZE, 4))); + EXPECT_FALSE(kernelMatches(decodeGraph(), kernel("BF16", 64, BLOCK_SIZE, 4))); + EXPECT_FALSE(kernelMatches(decodeGraph(), kernel("BF16", HEAD_SIZE, 32, 4))); + EXPECT_FALSE(kernelMatches(decodeGraph(), kernel("BF16", HEAD_SIZE, BLOCK_SIZE, 8))); + // A candidate not built for runtime head counts (num_kv_heads != 1) never matches. + EXPECT_FALSE(kernelMatches(decodeGraph(), kernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4, 1, 2))); + // Nor one whose geometry has no query rows per block. + EXPECT_FALSE(kernelMatches(decodeGraph(), kernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4, 0))); + KernelDefinition incomplete = kernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4); + incomplete.metadata.erase("num_warps"); + EXPECT_FALSE(kernelMatches(decodeGraph(), incomplete)); +} + +TEST(TestAttentionPagedUnifiedMatchers, ServesAnAttentionSinkInTheIoDataType) +{ + const auto bound = match(sinkGraph()); + ASSERT_TRUE(bound.has_value()); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.sink.uid"), SINK_UID); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.sink_is_f32"), 0); + EXPECT_EQ(tryGetBoundInt(*match(decodeGraph()), "attention_paged_unified.sink.uid"), -1); + EXPECT_EQ(tryGetBoundInt(*match(decodeGraph()), "attention_paged_unified.sink_is_f32"), 0); + // FP16 graph with an FP16 sink; a ragged Q with a sink. + EXPECT_TRUE(match(decodeGraph(d::DataType::HALF), [](d::GraphT& g) { + g.tensors.push_back(tensor(SINK_UID, + d::DataType::HALF, + {1, QUERY_HEADS, 1, 1}, + packed({1, QUERY_HEADS, 1, 1}))); + attrs(g).sink_token_tensor_uid = SINK_UID; + }).has_value()); + EXPECT_TRUE(match(raggedGraph(), [](d::GraphT& g) { + g.tensors.push_back(tensor(SINK_UID, + d::DataType::BFLOAT16, + {1, QUERY_HEADS, 1, 1}, + packed({1, QUERY_HEADS, 1, 1}))); + attrs(g).sink_token_tensor_uid = SINK_UID; + }).has_value()); + // Only the head stride matters: the other axes have unit extent. + EXPECT_TRUE(match(sinkGraph(), [](d::GraphT& g) { + find(g, SINK_UID).strides = {7, 1, 5, 3}; + }).has_value()); +} + +/// cuDNN's FLOAT sink_token, the form hipDNN's frontend admits, on a BF16 and an FP16 +/// graph, dense and ragged: the launch passes sink_is_f32 = 1 and the same sink objects +/// serve it. +TEST(TestAttentionPagedUnifiedMatchers, ServesAFloatAttentionSink) +{ + const auto floatSink = [](d::GraphT& g) { + g.tensors.push_back(tensor( + SINK_UID, d::DataType::FLOAT, {1, QUERY_HEADS, 1, 1}, packed({1, QUERY_HEADS, 1, 1}))); + attrs(g).sink_token_tensor_uid = SINK_UID; + }; + const std::vector> graphs + = {[] { return decodeGraph(); }, + [] { return decodeGraph(d::DataType::HALF); }, + [] { return raggedGraph(); }}; + for(const auto& graph : graphs) + { + const auto bound = match(graph(), floatSink); + ASSERT_TRUE(bound.has_value()); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.sink.uid"), SINK_UID); + EXPECT_EQ(tryGetBoundInt(*bound, "attention_paged_unified.sink_is_f32"), 1); + } + auto graph = decodeGraph(); + floatSink(graph); + EXPECT_TRUE(kernelMatches(graph, sinkKernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4))); + EXPECT_FALSE(kernelMatches(graph, kernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4))); +} + +/// Every finite attn_scale is served, zero and negative ones included; the saved-plan +/// reader takes the same set (TestAttentionPagedUnifiedLaunchValues). +TEST(TestAttentionPagedUnifiedMatchers, ServesEveryFiniteScale) +{ + for(const float scale : {0.0F, -0.125F, 1.0e30F}) + { + SCOPED_TRACE(scale); + EXPECT_TRUE(match(decodeGraph(), [scale](d::GraphT& g) { + attrs(g).attn_scale_value = scale; + }).has_value()); + } + for(const float scale : + {std::numeric_limits::quiet_NaN(), std::numeric_limits::infinity()}) + { + SCOPED_TRACE(scale); + const auto decline = loggedDecline( + decodeGraph(), [scale](d::GraphT& g) { attrs(g).attn_scale_value = scale; }); + EXPECT_EQ(decline.cause, "scale") << decline.detail; + } +} + +TEST(TestAttentionPagedUnifiedMatchers, SelectsTheSinkObjectExactlyWhenTheGraphHasASink) +{ + EXPECT_TRUE(kernelMatches(sinkGraph(), sinkKernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4))); + EXPECT_FALSE(kernelMatches(sinkGraph(), kernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4))); + EXPECT_FALSE(kernelMatches(decodeGraph(), sinkKernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4))); + // An explicit use_sinks = 0 is the plain object. + KernelDefinition plain = kernel("BF16", HEAD_SIZE, BLOCK_SIZE, 4); + plain.metadata[std::string("use_sinks")] = int64_t{0}; + EXPECT_TRUE(kernelMatches(decodeGraph(), plain)); + EXPECT_FALSE(kernelMatches(sinkGraph(), plain)); + // The sink object still matches only its own dtype, head size, block size and ratio. + EXPECT_FALSE(kernelMatches(sinkGraph(), sinkKernel("FP16", HEAD_SIZE, BLOCK_SIZE, 4))); + EXPECT_FALSE(kernelMatches(sinkGraph(), sinkKernel("BF16", HEAD_SIZE, BLOCK_SIZE, 8))); +} + +struct DeclineCase +{ + const char* name; + std::function graph; + Mutation change; + const char* cause; +}; + +TEST(TestAttentionPagedUnifiedMatchers, DeclinesWithALoggedCause) +{ + const auto decode = [] { return decodeGraph(); }; + const auto ragged = [] { return raggedGraph(); }; + const std::vector cases = { + {"no page tables", + decode, + [](d::GraphT& g) { + attrs(g).page_table_k_tensor_uid = flatbuffers::nullopt; + attrs(g).page_table_v_tensor_uid = flatbuffers::nullopt; + }, + "not_paged"}, + {"only K paged", + decode, + [](d::GraphT& g) { attrs(g).page_table_v_tensor_uid = flatbuffers::nullopt; }, + "one_sided_paging"}, + {"only V paged", + decode, + [](d::GraphT& g) { attrs(g).page_table_k_tensor_uid = flatbuffers::nullopt; }, + "one_sided_paging"}, + {"K and V page tables of different widths", + decode, + [](d::GraphT& g) { + useSeparateVTable(g, {BATCH, 1, MAX_BLOCKS / 2, 1}, {MAX_BLOCKS, MAX_BLOCKS, 1, 1}); + }, + "page_table"}, + {"K and V page tables with different batch strides", + decode, + [](d::GraphT& g) { + useSeparateVTable( + g, {BATCH, 1, MAX_BLOCKS, 1}, {2 * MAX_BLOCKS, 2 * MAX_BLOCKS, 1, 1}); + }, + "page_table"}, + {"int64 page table", + decode, + [](d::GraphT& g) { find(g, PAGE_TABLE_UID).data_type = d::DataType::INT64; }, + "page_table"}, + {"int64 V page table", + decode, + [](d::GraphT& g) { + useSeparateVTable(g); + find(g, EXTRA_UID).data_type = d::DataType::INT64; + }, + "page_table"}, + {"strided page-table entries", + decode, + [](d::GraphT& g) { find(g, PAGE_TABLE_UID).strides = {2 * MAX_BLOCKS, 1, 2, 1}; }, + "page_table"}, + {"packed page table", + ragged, + [](d::GraphT& g) { find(g, PAGE_TABLE_UID).ragged_offset_tensor_uid = RAGGED_OFFSET_UID; }, + "page_table"}, + {"packed V page table", + ragged, + [](d::GraphT& g) { + useSeparateVTable(g); + find(g, EXTRA_UID).ragged_offset_tensor_uid = RAGGED_OFFSET_UID; + }, + "page_table"}, + {"fp32", + decode, + [](d::GraphT& g) { + for(auto& t : g.tensors) + { + if(t->data_type == d::DataType::BFLOAT16) + { + t->data_type = d::DataType::FLOAT; + } + } + }, + "data_type"}, + {"mixed dtypes", + decode, + [](d::GraphT& g) { find(g, O_UID).data_type = d::DataType::HALF; }, + "data_type"}, + {"half compute", + decode, + [](d::GraphT& g) { g.nodes[0]->compute_data_type = d::DataType::HALF; }, + "compute_data_type"}, + {"head size 96", + decode, + [](d::GraphT& g) { + for(auto& t : g.tensors) + { + if(t->uid <= O_UID) + { + t->dims[3] = 96; + } + } + }, + "head_size"}, + {"block size 8", + decode, + [](d::GraphT& g) { + find(g, K_UID).dims[2] = 8; + find(g, V_UID).dims[2] = 8; + }, + "block_size"}, + {"K and V block sizes differ, each with its own table (cuDNN's form)", + decode, + [](d::GraphT& g) { + useSeparateVTable( + g, {BATCH, 1, MAX_BLOCKS / 2, 1}, {MAX_BLOCKS / 2, MAX_BLOCKS / 2, 1, 1}); + attrs(g).max_seq_len_kv = flatbuffers::nullopt; + find(g, V_UID).dims[2] = 2 * BLOCK_SIZE; + }, + "block_size"}, + {"K and V block sizes differ over one table", + decode, + [](d::GraphT& g) { + attrs(g).max_seq_len_kv = flatbuffers::nullopt; + find(g, V_UID).dims[2] = 2 * BLOCK_SIZE; + }, + "block_size"}, + {"gqa 3", + decode, + [](d::GraphT& g) { + find(g, K_UID).dims[1] = 4; + find(g, V_UID).dims[1] = 4; + find(g, Q_UID).dims[1] = 12; + find(g, O_UID).dims[1] = 12; + }, + "gqa"}, + {"unequal K/V strides", + decode, + [](d::GraphT& g) { + find(g, V_UID).strides = packed({NUM_BLOCKS, KV_HEADS, BLOCK_SIZE, HEAD_SIZE}); + }, + "kv_layout"}, + {"misaligned K token stride", + decode, + [](d::GraphT& g) { + find(g, K_UID).strides[2] = 2 * HEAD_SIZE + 4; + find(g, V_UID).strides[2] = 2 * HEAD_SIZE + 4; + }, + "kv_layout"}, + {"misaligned Q head stride", + decode, + [](d::GraphT& g) { find(g, Q_UID).strides[1] = HEAD_SIZE + 4; }, + "layout"}, + {"no seq_len_kv", + decode, + [](d::GraphT& g) { attrs(g).seq_len_kv_tensor_uid = flatbuffers::nullopt; }, + "seq_len_kv"}, + {"seq_len_kv shape", + decode, + [](d::GraphT& g) { find(g, SEQ_LEN_KV_UID).dims = {1, BATCH, 1, 1}; }, + "seq_len_kv"}, + {"no seq_len_q (a paged graph carries both lengths)", + decode, + [](d::GraphT& g) { attrs(g).seq_len_q_tensor_uid = flatbuffers::nullopt; }, + "seq_len_q"}, + {"seq_len_q shape", + decode, + [](d::GraphT& g) { find(g, SEQ_LEN_Q_UID).dims = {1, BATCH, 1, 1}; }, + "seq_len_q"}, + {"no seq_len_q on a ragged Q", + ragged, + [](d::GraphT& g) { attrs(g).seq_len_q_tensor_uid = flatbuffers::nullopt; }, + "seq_len_q"}, + {"ragged Q only", + ragged, + [](d::GraphT& g) { find(g, O_UID).ragged_offset_tensor_uid = flatbuffers::nullopt; }, + "ragged"}, + {"int64 offsets", + ragged, + [](d::GraphT& g) { find(g, RAGGED_OFFSET_UID).data_type = d::DataType::INT64; }, + "ragged"}, + {"misaligned multiplier", + ragged, + [](d::GraphT& g) { find(g, Q_UID).ragged_offset_multiplier = 4100; }, + "layout"}, + {"zero multiplier", + ragged, + [](d::GraphT& g) { + find(g, Q_UID).ragged_offset_multiplier = 0; + find(g, O_UID).ragged_offset_multiplier = 0; + }, + "layout"}, + // RFC 0014 allows offsets in other units than tokens; the kernel reads them as + // token counts, so a multiplier other than the token stride is declined. + {"Q offsets in half-token units", + ragged, + [](d::GraphT& g) { + auto& q = find(g, Q_UID); + q.ragged_offset_multiplier = q.strides[2] / 2; + }, + "ragged"}, + {"O offsets in two-token units", + ragged, + [](d::GraphT& g) { + auto& o = find(g, O_UID); + o.ragged_offset_multiplier = o.strides[2] * 2; + }, + "ragged"}, + {"ragged K", + ragged, + [](d::GraphT& g) { find(g, K_UID).ragged_offset_tensor_uid = RAGGED_OFFSET_UID; }, + "ragged"}, + {"ragged V", + ragged, + [](d::GraphT& g) { find(g, V_UID).ragged_offset_tensor_uid = RAGGED_OFFSET_UID; }, + "ragged"}, + {"B offsets instead of B+1", + ragged, + [](d::GraphT& g) { find(g, RAGGED_OFFSET_UID).dims[0] = BATCH; }, + "ragged"}, + {"K/V block span past the buffer range", + decode, + [](d::GraphT& g) { + // (Hkv - 1) * head stride elements: within int32 strides, past 0x7FFF0000 + // bytes for one block. + find(g, K_UID).strides[1] = 0x10000000; + find(g, V_UID).strides[1] = 0x10000000; + }, + "size_limit"}, + {"page table past its buffer range", + decode, + [](d::GraphT& g) { + // (B - 1) * stride + M entries: within int32, past 0x7FFF0000 bytes. + find(g, PAGE_TABLE_UID).strides[0] = 0x0B000000; + }, + "size_limit"}, + {"top-left causal", + decode, + [](d::GraphT& g) { attrs(g).diagonal_alignment = d::DiagonalAlignment::TOP_LEFT; }, + "mask"}, + {"no mask", + decode, + [](d::GraphT& g) { attrs(g).right_bound = flatbuffers::nullopt; }, + "mask"}, + {"left bound 0 (outside hipDNN's band domain)", + decode, + [](d::GraphT& g) { attrs(g).left_bound = 0; }, + "mask"}, + {"right bound 2", decode, [](d::GraphT& g) { attrs(g).right_bound = 2; }, "mask"}, + {"fp16 sink on a bf16 graph", + [] { return sinkGraph(); }, + [](d::GraphT& g) { find(g, SINK_UID).data_type = d::DataType::HALF; }, + "sinks"}, + {"int32 sink", + [] { return sinkGraph(); }, + [](d::GraphT& g) { find(g, SINK_UID).data_type = d::DataType::INT32; }, + "sinks"}, + {"double sink", + [] { return sinkGraph(); }, + [](d::GraphT& g) { find(g, SINK_UID).data_type = d::DataType::DOUBLE; }, + "sinks"}, + {"sink per key-value head", + [] { return sinkGraph(); }, + [](d::GraphT& g) { + find(g, SINK_UID).dims = {1, KV_HEADS, 1, 1}; + find(g, SINK_UID).strides = packed({1, KV_HEADS, 1, 1}); + }, + "sinks"}, + {"sink with a sequence axis", + [] { return sinkGraph(); }, + [](d::GraphT& g) { + find(g, SINK_UID).dims = {1, QUERY_HEADS, 2, 1}; + find(g, SINK_UID).strides = packed({1, QUERY_HEADS, 2, 1}); + }, + "sinks"}, + {"sink with a non-unit head stride", + [] { return sinkGraph(); }, + [](d::GraphT& g) { find(g, SINK_UID).strides = {2 * QUERY_HEADS, 2, 1, 1}; }, + "sinks"}, + {"sink tensor missing", + decode, + [](d::GraphT& g) { attrs(g).sink_token_tensor_uid = EXTRA_UID; }, + "sinks"}, + {"alibi", decode, [](d::GraphT& g) { attrs(g).alibi_mask = true; }, "alibi_mask"}, + {"fp8 descale", + decode, + [](d::GraphT& g) { attrs(g).descale_k_tensor_uid = EXTRA_UID; }, + "fp8"}, + {"stats", decode, [](d::GraphT& g) { attrs(g).generate_stats = true; }, "stats"}, + {"dropout", decode, [](d::GraphT& g) { attrs(g).dropout_probability = 0.1F; }, "dropout"}, + {"bias", + decode, + [](d::GraphT& g) { attrs(g).attn_mask_tensor_uid = EXTRA_UID; }, + "attn_mask"}, + {"scale tensor", + decode, + [](d::GraphT& g) { attrs(g).scale_tensor_uid = EXTRA_UID; }, + "scale_tensor"}, + {"block mask", + decode, + [](d::GraphT& g) { attrs(g).block_mask_tensor_uid = EXTRA_UID; }, + "block_mask"}, + {"implementation", + decode, + [](d::GraphT& g) { attrs(g).implementation = d::AttentionImplementation::COMPOSITE; }, + "implementation"}, + {"override shapes", + decode, + [](d::GraphT& g) { g.is_override_shape_enabled = true; }, + "node"}, + {"virtual K", decode, [](d::GraphT& g) { find(g, K_UID).virtual_ = true; }, "operand"}, + }; + for(const auto& testCase : cases) + { + SCOPED_TRACE(testCase.name); + const auto decline = loggedDecline(testCase.graph(), testCase.change); + EXPECT_EQ(decline.cause, testCase.cause) << decline.detail; + EXPECT_FALSE(decline.detail.empty()); + } +} + +/// Sets @p uid's declared device-pointer alignment to @p bytes. +Mutation declaringAlignment(int64_t uid, int64_t bytes) +{ + return [uid, bytes](d::GraphT& g) { find(g, uid).alignment = bytes; }; +} + +// The kernels load Q / K / V / O as 16-byte vectors and the INT32 operands as 4-byte +// words. A graph may declare a lower pointer alignment (engine API 1.3.0, which the +// engine's 1.4.0 admits); the matcher declines it with its cause, so hipDNN can pick +// another engine at plan time instead of the plan failing at execute. +TEST(TestAttentionPagedUnifiedMatchers, DeclinesOperandsDeclaringLessThanTheKernelsLoad) +{ + const auto decode = [] { return decodeGraph(); }; + const auto ragged = [] { return raggedGraph(); }; + const auto separate = [] { + auto g = decodeGraph(); + useSeparateVTable(g); + return g; + }; + const std::vector>> graphs + = {{"decode", decode}, {"ragged", ragged}, {"separate V table", separate}}; + + // A wider declaration than the kernels load is served. + for(const auto& [name, graph] : graphs) + { + SCOPED_TRACE(name); + EXPECT_TRUE(match(graph(), [](d::GraphT& g) { + for(auto& t : g.tensors) + { + t->alignment = t->data_type == d::DataType::INT32 ? 4 : 32; + } + }).has_value()); + } + + for(const int64_t uid : {Q_UID, K_UID, V_UID, O_UID}) + { + for(const int64_t bytes : {8, 24}) + { + for(const auto& [name, graph] : graphs) + { + SCOPED_TRACE(std::string(name) + ", uid " + std::to_string(uid) + ", " + + std::to_string(bytes) + " bytes"); + const auto decline = loggedDecline(graph(), declaringAlignment(uid, bytes)); + EXPECT_EQ(decline.cause, "alignment") << decline.detail; + EXPECT_NE(decline.detail.find("declares a " + std::to_string(bytes) + "-byte"), + std::string::npos) + << decline.detail; + } + } + } + + struct WordCase + { + const char* role; + std::function graph; + int64_t uid; + }; + const std::vector words = {{"page_table_k", decode, PAGE_TABLE_UID}, + {"page_table_v", separate, EXTRA_UID}, + {"seq_len_kv", decode, SEQ_LEN_KV_UID}, + {"seq_len_q", decode, SEQ_LEN_Q_UID}, + {"ragged_offset", ragged, RAGGED_OFFSET_UID}}; + for(const auto& word : words) + { + SCOPED_TRACE(word.role); + const auto decline = loggedDecline(word.graph(), declaringAlignment(word.uid, 2)); + EXPECT_EQ(decline.cause, "alignment") << decline.detail; + EXPECT_NE(decline.detail.find(std::string(word.role) + " declares a 2-byte alignment"), + std::string::npos) + << decline.detail; + } +} + +// The use_sinks kernels take sink_ptr as a 16-byte-aligned pointer, like Q / K / V / O. +TEST(TestAttentionPagedUnifiedMatchers, DeclinesASinkDeclaringLessThanSixteenBytes) +{ + EXPECT_TRUE(match(sinkGraph(), declaringAlignment(SINK_UID, 32)).has_value()); + for(const int64_t bytes : {2, 8, 24}) + { + SCOPED_TRACE(std::to_string(bytes) + " bytes"); + const auto decline = loggedDecline(sinkGraph(), declaringAlignment(SINK_UID, bytes)); + EXPECT_EQ(decline.cause, "alignment") << decline.detail; + EXPECT_NE(decline.detail.find("sink_token declares a " + std::to_string(bytes) + "-byte"), + std::string::npos) + << decline.detail; + } +} + +/// The kernel reads stored offsets as token counts, so a ragged Q or O whose offsets +/// are in other units (RFC 0014's ragged_offset_multiplier != token stride) is declined, +/// and the log names the multiplier. vLLM's multiplier is the token stride, which matches. +TEST(TestAttentionPagedUnifiedMatchers, DeclinesARaggedMultiplierOtherThanTheTokenStride) +{ + const auto decline = loggedDecline(raggedGraph(), [](d::GraphT& g) { + for(const auto uid : {Q_UID, O_UID}) + { + auto& t = find(g, uid); + t.ragged_offset_multiplier = t.strides[2] / 4; + } + }); + EXPECT_EQ(decline.cause, "ragged") << decline.detail; + EXPECT_NE(decline.detail.find("ragged_offset_multiplier"), std::string::npos) << decline.detail; + EXPECT_NE(decline.detail.find("token"), std::string::npos) << decline.detail; +} + +TEST(TestAttentionPagedUnifiedMatchers, LogsNoDeclineForAGraphItServes) +{ + const auto recorder + = hipdnn_test_sdk::utilities::SharedLogRecorder::withOverrideLevel(HIPDNN_SEV_INFO); + EXPECT_TRUE(match(decodeGraph()).has_value()); + EXPECT_TRUE(match(raggedGraph()).has_value()); + EXPECT_TRUE(match(sinkGraph()).has_value()); + EXPECT_FALSE(recorder.hasLogContaining(std::string(ATTENTION_PAGED_UNIFIED_ENGINE_NAME) + + " declined the graph")); +} + +} // namespace +} // namespace hip_kernel_provider::kernel_ingestor_engine::testing + +#endif // HIPDNN_ENABLE_KERNEL_INGESTOR diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestAttentionPagedUnifiedPacks.cpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestAttentionPagedUnifiedPacks.cpp new file mode 100644 index 000000000000..9e6571917f63 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestAttentionPagedUnifiedPacks.cpp @@ -0,0 +1,807 @@ +// Copyright © Advanced Micro Devices, Inc., or its affiliates. +// SPDX-License-Identifier: MIT + +#ifdef HIPDNN_ENABLE_KERNEL_INGESTOR + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "engines/kernel_ingestor_engine/IngestorPacks.hpp" +#include "engines/kernel_ingestor_engine/KernelIngestorEngine.hpp" + +/** + * @file TestAttentionPagedUnifiedPacks.cpp + * @brief A census of what hipkernel:AttentionPagedUnified actually loads, read through + * hip_kernel_provider::kernel_ingestor_engine::discoverDescriptorSets(), + * which runs the provider's real typed registration before validating and + * loading, so a pack whose native symbols do not register drops out here + * rather than at first dispatch on a device. + * + * The expectations are rendered from the finalized emitted-bundle inventory -- the + * documents this run wrote, after metadata resolution, the resolved-knob check and + * engine-wide de-duplication -- not from the authored config, whose pack file stems are + * not the pack names the loader reports. + * + * This file belongs to the census binary, hip_kernel_provider_census_tests, not to the + * ordinary unit binary: every case below needs a descriptor shard and the census + * environment. The generated matcher test is the one that stays in + * hip_kernel_provider_tests. + * + * Register one entry with hkp_register_census_tests(), which documents its own + * arguments, in src/tests/CMakeLists.txt beside hkp_verify_embedded_sources(). + * + * Generated by IngestorGenerator. + */ +namespace +{ + +using namespace hip_kernel_provider::kernel_ingestor_engine; +namespace ingestor = hipdnn_plugin_sdk::ingestor; + +/// One architecture's row of the emitted inventory. +struct ExpectedInventory +{ + std::set packNames; + std::set kernelNames; +}; + +/// Wildcard key: descriptors naming no architecture ship for every device, so they +/// cannot be filed under a concrete id. +constexpr const char* ARCH_WILDCARD = "*"; + +/// The emitted inventory, keyed by architecture. +const std::map& expectedByArch() +{ + static const std::map s_expected = { + {"gfx942", + ExpectedInventory{ + { + "hipkernel:attention_paged_unified_gfx942", + }, + { + "paged_unified.bf16_d128_bs16_g1.gfx942", + "paged_unified.bf16_d128_bs16_g16.gfx942", + "paged_unified.bf16_d128_bs16_g16_sinks.gfx942", + "paged_unified.bf16_d128_bs16_g1_sinks.gfx942", + "paged_unified.bf16_d128_bs16_g2.gfx942", + "paged_unified.bf16_d128_bs16_g2_sinks.gfx942", + "paged_unified.bf16_d128_bs16_g4.gfx942", + "paged_unified.bf16_d128_bs16_g4_sinks.gfx942", + "paged_unified.bf16_d128_bs16_g5.gfx942", + "paged_unified.bf16_d128_bs16_g5_sinks.gfx942", + "paged_unified.bf16_d128_bs16_g6.gfx942", + "paged_unified.bf16_d128_bs16_g6_sinks.gfx942", + "paged_unified.bf16_d128_bs16_g7.gfx942", + "paged_unified.bf16_d128_bs16_g7_sinks.gfx942", + "paged_unified.bf16_d128_bs16_g8.gfx942", + "paged_unified.bf16_d128_bs16_g8_sinks.gfx942", + "paged_unified.bf16_d128_bs32_g1.gfx942", + "paged_unified.bf16_d128_bs32_g16.gfx942", + "paged_unified.bf16_d128_bs32_g16_sinks.gfx942", + "paged_unified.bf16_d128_bs32_g1_sinks.gfx942", + "paged_unified.bf16_d128_bs32_g2.gfx942", + "paged_unified.bf16_d128_bs32_g2_sinks.gfx942", + "paged_unified.bf16_d128_bs32_g4.gfx942", + "paged_unified.bf16_d128_bs32_g4_sinks.gfx942", + "paged_unified.bf16_d128_bs32_g5.gfx942", + "paged_unified.bf16_d128_bs32_g5_sinks.gfx942", + "paged_unified.bf16_d128_bs32_g6.gfx942", + "paged_unified.bf16_d128_bs32_g6_sinks.gfx942", + "paged_unified.bf16_d128_bs32_g7.gfx942", + "paged_unified.bf16_d128_bs32_g7_sinks.gfx942", + "paged_unified.bf16_d128_bs32_g8.gfx942", + "paged_unified.bf16_d128_bs32_g8_sinks.gfx942", + "paged_unified.bf16_d128_bs64_g1.gfx942", + "paged_unified.bf16_d128_bs64_g16.gfx942", + "paged_unified.bf16_d128_bs64_g16_sinks.gfx942", + "paged_unified.bf16_d128_bs64_g1_sinks.gfx942", + "paged_unified.bf16_d128_bs64_g2.gfx942", + "paged_unified.bf16_d128_bs64_g2_sinks.gfx942", + "paged_unified.bf16_d128_bs64_g4.gfx942", + "paged_unified.bf16_d128_bs64_g4_sinks.gfx942", + "paged_unified.bf16_d128_bs64_g5.gfx942", + "paged_unified.bf16_d128_bs64_g5_sinks.gfx942", + "paged_unified.bf16_d128_bs64_g6.gfx942", + "paged_unified.bf16_d128_bs64_g6_sinks.gfx942", + "paged_unified.bf16_d128_bs64_g7.gfx942", + "paged_unified.bf16_d128_bs64_g7_sinks.gfx942", + "paged_unified.bf16_d128_bs64_g8.gfx942", + "paged_unified.bf16_d128_bs64_g8_sinks.gfx942", + "paged_unified.bf16_d256_bs16_g1.gfx942", + "paged_unified.bf16_d256_bs16_g16.gfx942", + "paged_unified.bf16_d256_bs16_g16_sinks.gfx942", + "paged_unified.bf16_d256_bs16_g1_sinks.gfx942", + "paged_unified.bf16_d256_bs16_g2.gfx942", + "paged_unified.bf16_d256_bs16_g2_sinks.gfx942", + "paged_unified.bf16_d256_bs16_g4.gfx942", + "paged_unified.bf16_d256_bs16_g4_sinks.gfx942", + "paged_unified.bf16_d256_bs16_g5.gfx942", + "paged_unified.bf16_d256_bs16_g5_sinks.gfx942", + "paged_unified.bf16_d256_bs16_g6.gfx942", + "paged_unified.bf16_d256_bs16_g6_sinks.gfx942", + "paged_unified.bf16_d256_bs16_g7.gfx942", + "paged_unified.bf16_d256_bs16_g7_sinks.gfx942", + "paged_unified.bf16_d256_bs16_g8.gfx942", + "paged_unified.bf16_d256_bs16_g8_sinks.gfx942", + "paged_unified.bf16_d256_bs32_g1.gfx942", + "paged_unified.bf16_d256_bs32_g16.gfx942", + "paged_unified.bf16_d256_bs32_g16_sinks.gfx942", + "paged_unified.bf16_d256_bs32_g1_sinks.gfx942", + "paged_unified.bf16_d256_bs32_g2.gfx942", + "paged_unified.bf16_d256_bs32_g2_sinks.gfx942", + "paged_unified.bf16_d256_bs32_g4.gfx942", + "paged_unified.bf16_d256_bs32_g4_sinks.gfx942", + "paged_unified.bf16_d256_bs32_g5.gfx942", + "paged_unified.bf16_d256_bs32_g5_sinks.gfx942", + "paged_unified.bf16_d256_bs32_g6.gfx942", + "paged_unified.bf16_d256_bs32_g6_sinks.gfx942", + "paged_unified.bf16_d256_bs32_g7.gfx942", + "paged_unified.bf16_d256_bs32_g7_sinks.gfx942", + "paged_unified.bf16_d256_bs32_g8.gfx942", + "paged_unified.bf16_d256_bs32_g8_sinks.gfx942", + "paged_unified.bf16_d256_bs64_g1.gfx942", + "paged_unified.bf16_d256_bs64_g16.gfx942", + "paged_unified.bf16_d256_bs64_g16_sinks.gfx942", + "paged_unified.bf16_d256_bs64_g1_sinks.gfx942", + "paged_unified.bf16_d256_bs64_g2.gfx942", + "paged_unified.bf16_d256_bs64_g2_sinks.gfx942", + "paged_unified.bf16_d256_bs64_g4.gfx942", + "paged_unified.bf16_d256_bs64_g4_sinks.gfx942", + "paged_unified.bf16_d256_bs64_g5.gfx942", + "paged_unified.bf16_d256_bs64_g5_sinks.gfx942", + "paged_unified.bf16_d256_bs64_g6.gfx942", + "paged_unified.bf16_d256_bs64_g6_sinks.gfx942", + "paged_unified.bf16_d256_bs64_g7.gfx942", + "paged_unified.bf16_d256_bs64_g7_sinks.gfx942", + "paged_unified.bf16_d256_bs64_g8.gfx942", + "paged_unified.bf16_d256_bs64_g8_sinks.gfx942", + "paged_unified.bf16_d64_bs16_g1.gfx942", + "paged_unified.bf16_d64_bs16_g16.gfx942", + "paged_unified.bf16_d64_bs16_g16_sinks.gfx942", + "paged_unified.bf16_d64_bs16_g1_sinks.gfx942", + "paged_unified.bf16_d64_bs16_g2.gfx942", + "paged_unified.bf16_d64_bs16_g2_sinks.gfx942", + "paged_unified.bf16_d64_bs16_g4.gfx942", + "paged_unified.bf16_d64_bs16_g4_sinks.gfx942", + "paged_unified.bf16_d64_bs16_g5.gfx942", + "paged_unified.bf16_d64_bs16_g5_sinks.gfx942", + "paged_unified.bf16_d64_bs16_g6.gfx942", + "paged_unified.bf16_d64_bs16_g6_sinks.gfx942", + "paged_unified.bf16_d64_bs16_g7.gfx942", + "paged_unified.bf16_d64_bs16_g7_sinks.gfx942", + "paged_unified.bf16_d64_bs16_g8.gfx942", + "paged_unified.bf16_d64_bs16_g8_sinks.gfx942", + "paged_unified.bf16_d64_bs32_g1.gfx942", + "paged_unified.bf16_d64_bs32_g16.gfx942", + "paged_unified.bf16_d64_bs32_g16_sinks.gfx942", + "paged_unified.bf16_d64_bs32_g1_sinks.gfx942", + "paged_unified.bf16_d64_bs32_g2.gfx942", + "paged_unified.bf16_d64_bs32_g2_sinks.gfx942", + "paged_unified.bf16_d64_bs32_g4.gfx942", + "paged_unified.bf16_d64_bs32_g4_sinks.gfx942", + "paged_unified.bf16_d64_bs32_g5.gfx942", + "paged_unified.bf16_d64_bs32_g5_sinks.gfx942", + "paged_unified.bf16_d64_bs32_g6.gfx942", + "paged_unified.bf16_d64_bs32_g6_sinks.gfx942", + "paged_unified.bf16_d64_bs32_g7.gfx942", + "paged_unified.bf16_d64_bs32_g7_sinks.gfx942", + "paged_unified.bf16_d64_bs32_g8.gfx942", + "paged_unified.bf16_d64_bs32_g8_sinks.gfx942", + "paged_unified.bf16_d64_bs64_g1.gfx942", + "paged_unified.bf16_d64_bs64_g16.gfx942", + "paged_unified.bf16_d64_bs64_g16_sinks.gfx942", + "paged_unified.bf16_d64_bs64_g1_sinks.gfx942", + "paged_unified.bf16_d64_bs64_g2.gfx942", + "paged_unified.bf16_d64_bs64_g2_sinks.gfx942", + "paged_unified.bf16_d64_bs64_g4.gfx942", + "paged_unified.bf16_d64_bs64_g4_sinks.gfx942", + "paged_unified.bf16_d64_bs64_g5.gfx942", + "paged_unified.bf16_d64_bs64_g5_sinks.gfx942", + "paged_unified.bf16_d64_bs64_g6.gfx942", + "paged_unified.bf16_d64_bs64_g6_sinks.gfx942", + "paged_unified.bf16_d64_bs64_g7.gfx942", + "paged_unified.bf16_d64_bs64_g7_sinks.gfx942", + "paged_unified.bf16_d64_bs64_g8.gfx942", + "paged_unified.bf16_d64_bs64_g8_sinks.gfx942", + "paged_unified.fp16_d128_bs16_g1.gfx942", + "paged_unified.fp16_d128_bs16_g16.gfx942", + "paged_unified.fp16_d128_bs16_g16_sinks.gfx942", + "paged_unified.fp16_d128_bs16_g1_sinks.gfx942", + "paged_unified.fp16_d128_bs16_g2.gfx942", + "paged_unified.fp16_d128_bs16_g2_sinks.gfx942", + "paged_unified.fp16_d128_bs16_g4.gfx942", + "paged_unified.fp16_d128_bs16_g4_sinks.gfx942", + "paged_unified.fp16_d128_bs16_g5.gfx942", + "paged_unified.fp16_d128_bs16_g5_sinks.gfx942", + "paged_unified.fp16_d128_bs16_g6.gfx942", + "paged_unified.fp16_d128_bs16_g6_sinks.gfx942", + "paged_unified.fp16_d128_bs16_g7.gfx942", + "paged_unified.fp16_d128_bs16_g7_sinks.gfx942", + "paged_unified.fp16_d128_bs16_g8.gfx942", + "paged_unified.fp16_d128_bs16_g8_sinks.gfx942", + "paged_unified.fp16_d128_bs32_g1.gfx942", + "paged_unified.fp16_d128_bs32_g16.gfx942", + "paged_unified.fp16_d128_bs32_g16_sinks.gfx942", + "paged_unified.fp16_d128_bs32_g1_sinks.gfx942", + "paged_unified.fp16_d128_bs32_g2.gfx942", + "paged_unified.fp16_d128_bs32_g2_sinks.gfx942", + "paged_unified.fp16_d128_bs32_g4.gfx942", + "paged_unified.fp16_d128_bs32_g4_sinks.gfx942", + "paged_unified.fp16_d128_bs32_g5.gfx942", + "paged_unified.fp16_d128_bs32_g5_sinks.gfx942", + "paged_unified.fp16_d128_bs32_g6.gfx942", + "paged_unified.fp16_d128_bs32_g6_sinks.gfx942", + "paged_unified.fp16_d128_bs32_g7.gfx942", + "paged_unified.fp16_d128_bs32_g7_sinks.gfx942", + "paged_unified.fp16_d128_bs32_g8.gfx942", + "paged_unified.fp16_d128_bs32_g8_sinks.gfx942", + "paged_unified.fp16_d128_bs64_g1.gfx942", + "paged_unified.fp16_d128_bs64_g16.gfx942", + "paged_unified.fp16_d128_bs64_g16_sinks.gfx942", + "paged_unified.fp16_d128_bs64_g1_sinks.gfx942", + "paged_unified.fp16_d128_bs64_g2.gfx942", + "paged_unified.fp16_d128_bs64_g2_sinks.gfx942", + "paged_unified.fp16_d128_bs64_g4.gfx942", + "paged_unified.fp16_d128_bs64_g4_sinks.gfx942", + "paged_unified.fp16_d128_bs64_g5.gfx942", + "paged_unified.fp16_d128_bs64_g5_sinks.gfx942", + "paged_unified.fp16_d128_bs64_g6.gfx942", + "paged_unified.fp16_d128_bs64_g6_sinks.gfx942", + "paged_unified.fp16_d128_bs64_g7.gfx942", + "paged_unified.fp16_d128_bs64_g7_sinks.gfx942", + "paged_unified.fp16_d128_bs64_g8.gfx942", + "paged_unified.fp16_d128_bs64_g8_sinks.gfx942", + "paged_unified.fp16_d256_bs16_g1.gfx942", + "paged_unified.fp16_d256_bs16_g16.gfx942", + "paged_unified.fp16_d256_bs16_g16_sinks.gfx942", + "paged_unified.fp16_d256_bs16_g1_sinks.gfx942", + "paged_unified.fp16_d256_bs16_g2.gfx942", + "paged_unified.fp16_d256_bs16_g2_sinks.gfx942", + "paged_unified.fp16_d256_bs16_g4.gfx942", + "paged_unified.fp16_d256_bs16_g4_sinks.gfx942", + "paged_unified.fp16_d256_bs16_g5.gfx942", + "paged_unified.fp16_d256_bs16_g5_sinks.gfx942", + "paged_unified.fp16_d256_bs16_g6.gfx942", + "paged_unified.fp16_d256_bs16_g6_sinks.gfx942", + "paged_unified.fp16_d256_bs16_g7.gfx942", + "paged_unified.fp16_d256_bs16_g7_sinks.gfx942", + "paged_unified.fp16_d256_bs16_g8.gfx942", + "paged_unified.fp16_d256_bs16_g8_sinks.gfx942", + "paged_unified.fp16_d256_bs32_g1.gfx942", + "paged_unified.fp16_d256_bs32_g16.gfx942", + "paged_unified.fp16_d256_bs32_g16_sinks.gfx942", + "paged_unified.fp16_d256_bs32_g1_sinks.gfx942", + "paged_unified.fp16_d256_bs32_g2.gfx942", + "paged_unified.fp16_d256_bs32_g2_sinks.gfx942", + "paged_unified.fp16_d256_bs32_g4.gfx942", + "paged_unified.fp16_d256_bs32_g4_sinks.gfx942", + "paged_unified.fp16_d256_bs32_g5.gfx942", + "paged_unified.fp16_d256_bs32_g5_sinks.gfx942", + "paged_unified.fp16_d256_bs32_g6.gfx942", + "paged_unified.fp16_d256_bs32_g6_sinks.gfx942", + "paged_unified.fp16_d256_bs32_g7.gfx942", + "paged_unified.fp16_d256_bs32_g7_sinks.gfx942", + "paged_unified.fp16_d256_bs32_g8.gfx942", + "paged_unified.fp16_d256_bs32_g8_sinks.gfx942", + "paged_unified.fp16_d256_bs64_g1.gfx942", + "paged_unified.fp16_d256_bs64_g16.gfx942", + "paged_unified.fp16_d256_bs64_g16_sinks.gfx942", + "paged_unified.fp16_d256_bs64_g1_sinks.gfx942", + "paged_unified.fp16_d256_bs64_g2.gfx942", + "paged_unified.fp16_d256_bs64_g2_sinks.gfx942", + "paged_unified.fp16_d256_bs64_g4.gfx942", + "paged_unified.fp16_d256_bs64_g4_sinks.gfx942", + "paged_unified.fp16_d256_bs64_g5.gfx942", + "paged_unified.fp16_d256_bs64_g5_sinks.gfx942", + "paged_unified.fp16_d256_bs64_g6.gfx942", + "paged_unified.fp16_d256_bs64_g6_sinks.gfx942", + "paged_unified.fp16_d256_bs64_g7.gfx942", + "paged_unified.fp16_d256_bs64_g7_sinks.gfx942", + "paged_unified.fp16_d256_bs64_g8.gfx942", + "paged_unified.fp16_d256_bs64_g8_sinks.gfx942", + "paged_unified.fp16_d64_bs16_g1.gfx942", + "paged_unified.fp16_d64_bs16_g16.gfx942", + "paged_unified.fp16_d64_bs16_g16_sinks.gfx942", + "paged_unified.fp16_d64_bs16_g1_sinks.gfx942", + "paged_unified.fp16_d64_bs16_g2.gfx942", + "paged_unified.fp16_d64_bs16_g2_sinks.gfx942", + "paged_unified.fp16_d64_bs16_g4.gfx942", + "paged_unified.fp16_d64_bs16_g4_sinks.gfx942", + "paged_unified.fp16_d64_bs16_g5.gfx942", + "paged_unified.fp16_d64_bs16_g5_sinks.gfx942", + "paged_unified.fp16_d64_bs16_g6.gfx942", + "paged_unified.fp16_d64_bs16_g6_sinks.gfx942", + "paged_unified.fp16_d64_bs16_g7.gfx942", + "paged_unified.fp16_d64_bs16_g7_sinks.gfx942", + "paged_unified.fp16_d64_bs16_g8.gfx942", + "paged_unified.fp16_d64_bs16_g8_sinks.gfx942", + "paged_unified.fp16_d64_bs32_g1.gfx942", + "paged_unified.fp16_d64_bs32_g16.gfx942", + "paged_unified.fp16_d64_bs32_g16_sinks.gfx942", + "paged_unified.fp16_d64_bs32_g1_sinks.gfx942", + "paged_unified.fp16_d64_bs32_g2.gfx942", + "paged_unified.fp16_d64_bs32_g2_sinks.gfx942", + "paged_unified.fp16_d64_bs32_g4.gfx942", + "paged_unified.fp16_d64_bs32_g4_sinks.gfx942", + "paged_unified.fp16_d64_bs32_g5.gfx942", + "paged_unified.fp16_d64_bs32_g5_sinks.gfx942", + "paged_unified.fp16_d64_bs32_g6.gfx942", + "paged_unified.fp16_d64_bs32_g6_sinks.gfx942", + "paged_unified.fp16_d64_bs32_g7.gfx942", + "paged_unified.fp16_d64_bs32_g7_sinks.gfx942", + "paged_unified.fp16_d64_bs32_g8.gfx942", + "paged_unified.fp16_d64_bs32_g8_sinks.gfx942", + "paged_unified.fp16_d64_bs64_g1.gfx942", + "paged_unified.fp16_d64_bs64_g16.gfx942", + "paged_unified.fp16_d64_bs64_g16_sinks.gfx942", + "paged_unified.fp16_d64_bs64_g1_sinks.gfx942", + "paged_unified.fp16_d64_bs64_g2.gfx942", + "paged_unified.fp16_d64_bs64_g2_sinks.gfx942", + "paged_unified.fp16_d64_bs64_g4.gfx942", + "paged_unified.fp16_d64_bs64_g4_sinks.gfx942", + "paged_unified.fp16_d64_bs64_g5.gfx942", + "paged_unified.fp16_d64_bs64_g5_sinks.gfx942", + "paged_unified.fp16_d64_bs64_g6.gfx942", + "paged_unified.fp16_d64_bs64_g6_sinks.gfx942", + "paged_unified.fp16_d64_bs64_g7.gfx942", + "paged_unified.fp16_d64_bs64_g7_sinks.gfx942", + "paged_unified.fp16_d64_bs64_g8.gfx942", + "paged_unified.fp16_d64_bs64_g8_sinks.gfx942", + }, + }}, + {"gfx950", + ExpectedInventory{ + { + "hipkernel:attention_paged_unified_gfx950", + }, + { + "paged_unified.bf16_d128_bs16_g1.gfx950", + "paged_unified.bf16_d128_bs16_g16.gfx950", + "paged_unified.bf16_d128_bs16_g16_sinks.gfx950", + "paged_unified.bf16_d128_bs16_g1_sinks.gfx950", + "paged_unified.bf16_d128_bs16_g2.gfx950", + "paged_unified.bf16_d128_bs16_g2_sinks.gfx950", + "paged_unified.bf16_d128_bs16_g4.gfx950", + "paged_unified.bf16_d128_bs16_g4_sinks.gfx950", + "paged_unified.bf16_d128_bs16_g5.gfx950", + "paged_unified.bf16_d128_bs16_g5_sinks.gfx950", + "paged_unified.bf16_d128_bs16_g6.gfx950", + "paged_unified.bf16_d128_bs16_g6_sinks.gfx950", + "paged_unified.bf16_d128_bs16_g7.gfx950", + "paged_unified.bf16_d128_bs16_g7_sinks.gfx950", + "paged_unified.bf16_d128_bs16_g8.gfx950", + "paged_unified.bf16_d128_bs16_g8_sinks.gfx950", + "paged_unified.bf16_d128_bs32_g1.gfx950", + "paged_unified.bf16_d128_bs32_g16.gfx950", + "paged_unified.bf16_d128_bs32_g16_sinks.gfx950", + "paged_unified.bf16_d128_bs32_g1_sinks.gfx950", + "paged_unified.bf16_d128_bs32_g2.gfx950", + "paged_unified.bf16_d128_bs32_g2_sinks.gfx950", + "paged_unified.bf16_d128_bs32_g4.gfx950", + "paged_unified.bf16_d128_bs32_g4_sinks.gfx950", + "paged_unified.bf16_d128_bs32_g5.gfx950", + "paged_unified.bf16_d128_bs32_g5_sinks.gfx950", + "paged_unified.bf16_d128_bs32_g6.gfx950", + "paged_unified.bf16_d128_bs32_g6_sinks.gfx950", + "paged_unified.bf16_d128_bs32_g7.gfx950", + "paged_unified.bf16_d128_bs32_g7_sinks.gfx950", + "paged_unified.bf16_d128_bs32_g8.gfx950", + "paged_unified.bf16_d128_bs32_g8_sinks.gfx950", + "paged_unified.bf16_d128_bs64_g1.gfx950", + "paged_unified.bf16_d128_bs64_g16.gfx950", + "paged_unified.bf16_d128_bs64_g16_sinks.gfx950", + "paged_unified.bf16_d128_bs64_g1_sinks.gfx950", + "paged_unified.bf16_d128_bs64_g2.gfx950", + "paged_unified.bf16_d128_bs64_g2_sinks.gfx950", + "paged_unified.bf16_d128_bs64_g4.gfx950", + "paged_unified.bf16_d128_bs64_g4_sinks.gfx950", + "paged_unified.bf16_d128_bs64_g5.gfx950", + "paged_unified.bf16_d128_bs64_g5_sinks.gfx950", + "paged_unified.bf16_d128_bs64_g6.gfx950", + "paged_unified.bf16_d128_bs64_g6_sinks.gfx950", + "paged_unified.bf16_d128_bs64_g7.gfx950", + "paged_unified.bf16_d128_bs64_g7_sinks.gfx950", + "paged_unified.bf16_d128_bs64_g8.gfx950", + "paged_unified.bf16_d128_bs64_g8_sinks.gfx950", + "paged_unified.bf16_d256_bs16_g1.gfx950", + "paged_unified.bf16_d256_bs16_g16.gfx950", + "paged_unified.bf16_d256_bs16_g16_sinks.gfx950", + "paged_unified.bf16_d256_bs16_g1_sinks.gfx950", + "paged_unified.bf16_d256_bs16_g2.gfx950", + "paged_unified.bf16_d256_bs16_g2_sinks.gfx950", + "paged_unified.bf16_d256_bs16_g4.gfx950", + "paged_unified.bf16_d256_bs16_g4_sinks.gfx950", + "paged_unified.bf16_d256_bs16_g5.gfx950", + "paged_unified.bf16_d256_bs16_g5_sinks.gfx950", + "paged_unified.bf16_d256_bs16_g6.gfx950", + "paged_unified.bf16_d256_bs16_g6_sinks.gfx950", + "paged_unified.bf16_d256_bs16_g7.gfx950", + "paged_unified.bf16_d256_bs16_g7_sinks.gfx950", + "paged_unified.bf16_d256_bs16_g8.gfx950", + "paged_unified.bf16_d256_bs16_g8_sinks.gfx950", + "paged_unified.bf16_d256_bs32_g1.gfx950", + "paged_unified.bf16_d256_bs32_g16.gfx950", + "paged_unified.bf16_d256_bs32_g16_sinks.gfx950", + "paged_unified.bf16_d256_bs32_g1_sinks.gfx950", + "paged_unified.bf16_d256_bs32_g2.gfx950", + "paged_unified.bf16_d256_bs32_g2_sinks.gfx950", + "paged_unified.bf16_d256_bs32_g4.gfx950", + "paged_unified.bf16_d256_bs32_g4_sinks.gfx950", + "paged_unified.bf16_d256_bs32_g5.gfx950", + "paged_unified.bf16_d256_bs32_g5_sinks.gfx950", + "paged_unified.bf16_d256_bs32_g6.gfx950", + "paged_unified.bf16_d256_bs32_g6_sinks.gfx950", + "paged_unified.bf16_d256_bs32_g7.gfx950", + "paged_unified.bf16_d256_bs32_g7_sinks.gfx950", + "paged_unified.bf16_d256_bs32_g8.gfx950", + "paged_unified.bf16_d256_bs32_g8_sinks.gfx950", + "paged_unified.bf16_d256_bs64_g1.gfx950", + "paged_unified.bf16_d256_bs64_g16.gfx950", + "paged_unified.bf16_d256_bs64_g16_sinks.gfx950", + "paged_unified.bf16_d256_bs64_g1_sinks.gfx950", + "paged_unified.bf16_d256_bs64_g2.gfx950", + "paged_unified.bf16_d256_bs64_g2_sinks.gfx950", + "paged_unified.bf16_d256_bs64_g4.gfx950", + "paged_unified.bf16_d256_bs64_g4_sinks.gfx950", + "paged_unified.bf16_d256_bs64_g5.gfx950", + "paged_unified.bf16_d256_bs64_g5_sinks.gfx950", + "paged_unified.bf16_d256_bs64_g6.gfx950", + "paged_unified.bf16_d256_bs64_g6_sinks.gfx950", + "paged_unified.bf16_d256_bs64_g7.gfx950", + "paged_unified.bf16_d256_bs64_g7_sinks.gfx950", + "paged_unified.bf16_d256_bs64_g8.gfx950", + "paged_unified.bf16_d256_bs64_g8_sinks.gfx950", + "paged_unified.bf16_d64_bs16_g1.gfx950", + "paged_unified.bf16_d64_bs16_g16.gfx950", + "paged_unified.bf16_d64_bs16_g16_sinks.gfx950", + "paged_unified.bf16_d64_bs16_g1_sinks.gfx950", + "paged_unified.bf16_d64_bs16_g2.gfx950", + "paged_unified.bf16_d64_bs16_g2_sinks.gfx950", + "paged_unified.bf16_d64_bs16_g4.gfx950", + "paged_unified.bf16_d64_bs16_g4_sinks.gfx950", + "paged_unified.bf16_d64_bs16_g5.gfx950", + "paged_unified.bf16_d64_bs16_g5_sinks.gfx950", + "paged_unified.bf16_d64_bs16_g6.gfx950", + "paged_unified.bf16_d64_bs16_g6_sinks.gfx950", + "paged_unified.bf16_d64_bs16_g7.gfx950", + "paged_unified.bf16_d64_bs16_g7_sinks.gfx950", + "paged_unified.bf16_d64_bs16_g8.gfx950", + "paged_unified.bf16_d64_bs16_g8_sinks.gfx950", + "paged_unified.bf16_d64_bs32_g1.gfx950", + "paged_unified.bf16_d64_bs32_g16.gfx950", + "paged_unified.bf16_d64_bs32_g16_sinks.gfx950", + "paged_unified.bf16_d64_bs32_g1_sinks.gfx950", + "paged_unified.bf16_d64_bs32_g2.gfx950", + "paged_unified.bf16_d64_bs32_g2_sinks.gfx950", + "paged_unified.bf16_d64_bs32_g4.gfx950", + "paged_unified.bf16_d64_bs32_g4_sinks.gfx950", + "paged_unified.bf16_d64_bs32_g5.gfx950", + "paged_unified.bf16_d64_bs32_g5_sinks.gfx950", + "paged_unified.bf16_d64_bs32_g6.gfx950", + "paged_unified.bf16_d64_bs32_g6_sinks.gfx950", + "paged_unified.bf16_d64_bs32_g7.gfx950", + "paged_unified.bf16_d64_bs32_g7_sinks.gfx950", + "paged_unified.bf16_d64_bs32_g8.gfx950", + "paged_unified.bf16_d64_bs32_g8_sinks.gfx950", + "paged_unified.bf16_d64_bs64_g1.gfx950", + "paged_unified.bf16_d64_bs64_g16.gfx950", + "paged_unified.bf16_d64_bs64_g16_sinks.gfx950", + "paged_unified.bf16_d64_bs64_g1_sinks.gfx950", + "paged_unified.bf16_d64_bs64_g2.gfx950", + "paged_unified.bf16_d64_bs64_g2_sinks.gfx950", + "paged_unified.bf16_d64_bs64_g4.gfx950", + "paged_unified.bf16_d64_bs64_g4_sinks.gfx950", + "paged_unified.bf16_d64_bs64_g5.gfx950", + "paged_unified.bf16_d64_bs64_g5_sinks.gfx950", + "paged_unified.bf16_d64_bs64_g6.gfx950", + "paged_unified.bf16_d64_bs64_g6_sinks.gfx950", + "paged_unified.bf16_d64_bs64_g7.gfx950", + "paged_unified.bf16_d64_bs64_g7_sinks.gfx950", + "paged_unified.bf16_d64_bs64_g8.gfx950", + "paged_unified.bf16_d64_bs64_g8_sinks.gfx950", + "paged_unified.fp16_d128_bs16_g1.gfx950", + "paged_unified.fp16_d128_bs16_g16.gfx950", + "paged_unified.fp16_d128_bs16_g16_sinks.gfx950", + "paged_unified.fp16_d128_bs16_g1_sinks.gfx950", + "paged_unified.fp16_d128_bs16_g2.gfx950", + "paged_unified.fp16_d128_bs16_g2_sinks.gfx950", + "paged_unified.fp16_d128_bs16_g4.gfx950", + "paged_unified.fp16_d128_bs16_g4_sinks.gfx950", + "paged_unified.fp16_d128_bs16_g5.gfx950", + "paged_unified.fp16_d128_bs16_g5_sinks.gfx950", + "paged_unified.fp16_d128_bs16_g6.gfx950", + "paged_unified.fp16_d128_bs16_g6_sinks.gfx950", + "paged_unified.fp16_d128_bs16_g7.gfx950", + "paged_unified.fp16_d128_bs16_g7_sinks.gfx950", + "paged_unified.fp16_d128_bs16_g8.gfx950", + "paged_unified.fp16_d128_bs16_g8_sinks.gfx950", + "paged_unified.fp16_d128_bs32_g1.gfx950", + "paged_unified.fp16_d128_bs32_g16.gfx950", + "paged_unified.fp16_d128_bs32_g16_sinks.gfx950", + "paged_unified.fp16_d128_bs32_g1_sinks.gfx950", + "paged_unified.fp16_d128_bs32_g2.gfx950", + "paged_unified.fp16_d128_bs32_g2_sinks.gfx950", + "paged_unified.fp16_d128_bs32_g4.gfx950", + "paged_unified.fp16_d128_bs32_g4_sinks.gfx950", + "paged_unified.fp16_d128_bs32_g5.gfx950", + "paged_unified.fp16_d128_bs32_g5_sinks.gfx950", + "paged_unified.fp16_d128_bs32_g6.gfx950", + "paged_unified.fp16_d128_bs32_g6_sinks.gfx950", + "paged_unified.fp16_d128_bs32_g7.gfx950", + "paged_unified.fp16_d128_bs32_g7_sinks.gfx950", + "paged_unified.fp16_d128_bs32_g8.gfx950", + "paged_unified.fp16_d128_bs32_g8_sinks.gfx950", + "paged_unified.fp16_d128_bs64_g1.gfx950", + "paged_unified.fp16_d128_bs64_g16.gfx950", + "paged_unified.fp16_d128_bs64_g16_sinks.gfx950", + "paged_unified.fp16_d128_bs64_g1_sinks.gfx950", + "paged_unified.fp16_d128_bs64_g2.gfx950", + "paged_unified.fp16_d128_bs64_g2_sinks.gfx950", + "paged_unified.fp16_d128_bs64_g4.gfx950", + "paged_unified.fp16_d128_bs64_g4_sinks.gfx950", + "paged_unified.fp16_d128_bs64_g5.gfx950", + "paged_unified.fp16_d128_bs64_g5_sinks.gfx950", + "paged_unified.fp16_d128_bs64_g6.gfx950", + "paged_unified.fp16_d128_bs64_g6_sinks.gfx950", + "paged_unified.fp16_d128_bs64_g7.gfx950", + "paged_unified.fp16_d128_bs64_g7_sinks.gfx950", + "paged_unified.fp16_d128_bs64_g8.gfx950", + "paged_unified.fp16_d128_bs64_g8_sinks.gfx950", + "paged_unified.fp16_d256_bs16_g1.gfx950", + "paged_unified.fp16_d256_bs16_g16.gfx950", + "paged_unified.fp16_d256_bs16_g16_sinks.gfx950", + "paged_unified.fp16_d256_bs16_g1_sinks.gfx950", + "paged_unified.fp16_d256_bs16_g2.gfx950", + "paged_unified.fp16_d256_bs16_g2_sinks.gfx950", + "paged_unified.fp16_d256_bs16_g4.gfx950", + "paged_unified.fp16_d256_bs16_g4_sinks.gfx950", + "paged_unified.fp16_d256_bs16_g5.gfx950", + "paged_unified.fp16_d256_bs16_g5_sinks.gfx950", + "paged_unified.fp16_d256_bs16_g6.gfx950", + "paged_unified.fp16_d256_bs16_g6_sinks.gfx950", + "paged_unified.fp16_d256_bs16_g7.gfx950", + "paged_unified.fp16_d256_bs16_g7_sinks.gfx950", + "paged_unified.fp16_d256_bs16_g8.gfx950", + "paged_unified.fp16_d256_bs16_g8_sinks.gfx950", + "paged_unified.fp16_d256_bs32_g1.gfx950", + "paged_unified.fp16_d256_bs32_g16.gfx950", + "paged_unified.fp16_d256_bs32_g16_sinks.gfx950", + "paged_unified.fp16_d256_bs32_g1_sinks.gfx950", + "paged_unified.fp16_d256_bs32_g2.gfx950", + "paged_unified.fp16_d256_bs32_g2_sinks.gfx950", + "paged_unified.fp16_d256_bs32_g4.gfx950", + "paged_unified.fp16_d256_bs32_g4_sinks.gfx950", + "paged_unified.fp16_d256_bs32_g5.gfx950", + "paged_unified.fp16_d256_bs32_g5_sinks.gfx950", + "paged_unified.fp16_d256_bs32_g6.gfx950", + "paged_unified.fp16_d256_bs32_g6_sinks.gfx950", + "paged_unified.fp16_d256_bs32_g7.gfx950", + "paged_unified.fp16_d256_bs32_g7_sinks.gfx950", + "paged_unified.fp16_d256_bs32_g8.gfx950", + "paged_unified.fp16_d256_bs32_g8_sinks.gfx950", + "paged_unified.fp16_d256_bs64_g1.gfx950", + "paged_unified.fp16_d256_bs64_g16.gfx950", + "paged_unified.fp16_d256_bs64_g16_sinks.gfx950", + "paged_unified.fp16_d256_bs64_g1_sinks.gfx950", + "paged_unified.fp16_d256_bs64_g2.gfx950", + "paged_unified.fp16_d256_bs64_g2_sinks.gfx950", + "paged_unified.fp16_d256_bs64_g4.gfx950", + "paged_unified.fp16_d256_bs64_g4_sinks.gfx950", + "paged_unified.fp16_d256_bs64_g5.gfx950", + "paged_unified.fp16_d256_bs64_g5_sinks.gfx950", + "paged_unified.fp16_d256_bs64_g6.gfx950", + "paged_unified.fp16_d256_bs64_g6_sinks.gfx950", + "paged_unified.fp16_d256_bs64_g7.gfx950", + "paged_unified.fp16_d256_bs64_g7_sinks.gfx950", + "paged_unified.fp16_d256_bs64_g8.gfx950", + "paged_unified.fp16_d256_bs64_g8_sinks.gfx950", + "paged_unified.fp16_d64_bs16_g1.gfx950", + "paged_unified.fp16_d64_bs16_g16.gfx950", + "paged_unified.fp16_d64_bs16_g16_sinks.gfx950", + "paged_unified.fp16_d64_bs16_g1_sinks.gfx950", + "paged_unified.fp16_d64_bs16_g2.gfx950", + "paged_unified.fp16_d64_bs16_g2_sinks.gfx950", + "paged_unified.fp16_d64_bs16_g4.gfx950", + "paged_unified.fp16_d64_bs16_g4_sinks.gfx950", + "paged_unified.fp16_d64_bs16_g5.gfx950", + "paged_unified.fp16_d64_bs16_g5_sinks.gfx950", + "paged_unified.fp16_d64_bs16_g6.gfx950", + "paged_unified.fp16_d64_bs16_g6_sinks.gfx950", + "paged_unified.fp16_d64_bs16_g7.gfx950", + "paged_unified.fp16_d64_bs16_g7_sinks.gfx950", + "paged_unified.fp16_d64_bs16_g8.gfx950", + "paged_unified.fp16_d64_bs16_g8_sinks.gfx950", + "paged_unified.fp16_d64_bs32_g1.gfx950", + "paged_unified.fp16_d64_bs32_g16.gfx950", + "paged_unified.fp16_d64_bs32_g16_sinks.gfx950", + "paged_unified.fp16_d64_bs32_g1_sinks.gfx950", + "paged_unified.fp16_d64_bs32_g2.gfx950", + "paged_unified.fp16_d64_bs32_g2_sinks.gfx950", + "paged_unified.fp16_d64_bs32_g4.gfx950", + "paged_unified.fp16_d64_bs32_g4_sinks.gfx950", + "paged_unified.fp16_d64_bs32_g5.gfx950", + "paged_unified.fp16_d64_bs32_g5_sinks.gfx950", + "paged_unified.fp16_d64_bs32_g6.gfx950", + "paged_unified.fp16_d64_bs32_g6_sinks.gfx950", + "paged_unified.fp16_d64_bs32_g7.gfx950", + "paged_unified.fp16_d64_bs32_g7_sinks.gfx950", + "paged_unified.fp16_d64_bs32_g8.gfx950", + "paged_unified.fp16_d64_bs32_g8_sinks.gfx950", + "paged_unified.fp16_d64_bs64_g1.gfx950", + "paged_unified.fp16_d64_bs64_g16.gfx950", + "paged_unified.fp16_d64_bs64_g16_sinks.gfx950", + "paged_unified.fp16_d64_bs64_g1_sinks.gfx950", + "paged_unified.fp16_d64_bs64_g2.gfx950", + "paged_unified.fp16_d64_bs64_g2_sinks.gfx950", + "paged_unified.fp16_d64_bs64_g4.gfx950", + "paged_unified.fp16_d64_bs64_g4_sinks.gfx950", + "paged_unified.fp16_d64_bs64_g5.gfx950", + "paged_unified.fp16_d64_bs64_g5_sinks.gfx950", + "paged_unified.fp16_d64_bs64_g6.gfx950", + "paged_unified.fp16_d64_bs64_g6_sinks.gfx950", + "paged_unified.fp16_d64_bs64_g7.gfx950", + "paged_unified.fp16_d64_bs64_g7_sinks.gfx950", + "paged_unified.fp16_d64_bs64_g8.gfx950", + "paged_unified.fp16_d64_bs64_g8_sinks.gfx950", + }, + }}, + }; + return s_expected; +} + +/// The runtime source kind every kernel must declare at the loader. A packaged bundle +/// is lowered to a kpack archive first, so the authored builder kind is not what +/// arrives. +constexpr ingestor::KernelSourceKind EXPECTED_SOURCE_KIND = ingestor::KernelSourceKind::KPACK; + +class TestAttentionPagedUnifiedPacks : public ::testing::Test +{ +protected: + void SetUp() override + { + _arch = hipdnn_data_sdk::utilities::getEnv("HIPDNN_TEST_EXPECTED_ARCH"); + ASSERT_FALSE(_arch.empty()) + << "HIPDNN_TEST_EXPECTED_ARCH is unset, so this census has no expectation to " + "check against. The architecture is supplied explicitly by the caller; it " + "is never detected from a device and never taken from the descriptors " + "being censused."; + + const auto& table = expectedByArch(); + auto row = table.find(_arch); + if(row == table.end()) + { + row = table.find(ARCH_WILDCARD); + } + ASSERT_NE(row, table.end()) + << "this bundle emitted no descriptors for architecture '" << _arch + << "' and no architecture-independent ones either, so there is no expected " + "identity to check. Either the wrong architecture was requested or the " + "generation that produced this bundle did not cover it."; + _expected = &row->second; + + const auto& sets = discoverDescriptorSets(); + const auto match = std::find_if(sets.begin(), sets.end(), [](const auto& set) { + return set.engine.name == ATTENTION_PAGED_UNIFIED_ENGINE_NAME; + }); + ASSERT_NE(match, sets.end()) + << "descriptor set '" << ATTENTION_PAGED_UNIFIED_ENGINE_NAME + << "' did not load. Either its descriptors were never installed under the tree " + "this binary reads, its UED declares a different engine name than " + "ATTENTION_PAGED_UNIFIED_ENGINE_NAME, or its pack failed to register its " + "native symbols and every descriptor naming one of them was dropped."; + _set = &*match; + } + + std::string _arch; + const ExpectedInventory* _expected = nullptr; + const ingestor::DescriptorSet* _set = nullptr; +}; + +TEST_F(TestAttentionPagedUnifiedPacks, LoadsExactlyTheEmittedPacks) +{ + std::set loaded; + for(const auto& pack : _set->packs) + { + loaded.insert(pack.name); + } + // Set equality, not a count: a missing pack and an extra one cancel in a count. + EXPECT_EQ(loaded, _expected->packNames); +} + +TEST_F(TestAttentionPagedUnifiedPacks, LoadsExactlyTheEmittedKernels) +{ + std::set loaded; + for(const auto& pack : _set->packs) + { + for(const auto& kernel : pack.kernels) + { + loaded.insert(kernel.name); + } + } + EXPECT_EQ(loaded, _expected->kernelNames); +} + +TEST_F(TestAttentionPagedUnifiedPacks, EveryLoadedDescriptorCoversTheRequestedArch) +{ + for(const auto& pack : _set->packs) + { + EXPECT_TRUE(ingestor::archSupports(pack.arch, _arch)) + << "pack '" << pack.name << "' does not cover '" << _arch + << "', so this is not that architecture's shard"; + for(const auto& kernel : pack.kernels) + { + EXPECT_TRUE(ingestor::archSupports(kernel.arch, _arch)) + << "kernel '" << kernel.name << "' does not cover '" << _arch << "'"; + } + } +} + +TEST_F(TestAttentionPagedUnifiedPacks, EveryKernelDeclaresTheEmittedRuntimeSourceKind) +{ + for(const auto& pack : _set->packs) + { + for(const auto& kernel : pack.kernels) + { + EXPECT_EQ(kernel.source.kind, EXPECTED_SOURCE_KIND) + << "kernel '" << kernel.name << "' reached the loader as a different " + << "source kind than this bundle ships"; + } + } +} + +TEST_F(TestAttentionPagedUnifiedPacks, DeclaresTheConfiguredSdkVersion) +{ + EXPECT_EQ(_set->engine.sdkVersion, hipdnn_data_sdk::utilities::Version{std::string("1.4.0")}); +} + +TEST_F(TestAttentionPagedUnifiedPacks, ExposesTheConfiguredKnobs) +{ + ASSERT_EQ(_set->engine.knobs.size(), 0U); +} + +/// heuristic: none. The engine ranks on priority then descriptor id, so it ships no UHD +/// and registers no score symbol. Loading cannot show the second half, so the registry +/// is asked directly. +TEST_F(TestAttentionPagedUnifiedPacks, ShipsNoHeuristicAndRegistersNoScoreSymbol) +{ + EXPECT_FALSE(_set->heuristic.has_value()); + EXPECT_FALSE(ingestor::ScoreRegistry::isRegistered("hipkernel.attention_paged_unified.score")); +} + +/// UMD policy, this engine's shape: a MULTI-pack engine carries one graph-scoped +/// operation matcher per pack, on top of the one shared kernel-scoped matcher. +TEST_F(TestAttentionPagedUnifiedPacks, CarriesOneGraphScopedMatcherPerPack) +{ + const auto graphScoped + = std::count_if(_set->matchers.begin(), _set->matchers.end(), [](const auto& matcher) { + return matcher.scope == ingestor::MatchScope::GRAPH; + }); + EXPECT_EQ(static_cast(graphScoped), _expected->packNames.size()); +} + +TEST_F(TestAttentionPagedUnifiedPacks, CarriesExactlyOneSharedKernelScopedMatcher) +{ + const auto kernelScoped + = std::count_if(_set->matchers.begin(), _set->matchers.end(), [](const auto& matcher) { + return matcher.scope == ingestor::MatchScope::KERNEL; + }); + EXPECT_EQ(kernelScoped, 1); +} + +} // namespace + +#endif // HIPDNN_ENABLE_KERNEL_INGESTOR diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestGfx950AttentionDenseSchemaGate.cpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestGfx950AttentionDenseSchemaGate.cpp new file mode 100644 index 000000000000..c623f79b7cb4 --- /dev/null +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestGfx950AttentionDenseSchemaGate.cpp @@ -0,0 +1,247 @@ +// Copyright © Advanced Micro Devices, Inc., or its affiliates. +// SPDX-License-Identifier: MIT + +#ifdef HIPDNN_ENABLE_KERNEL_INGESTOR + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "core/Context.hpp" +#include "core/Handle.hpp" +#include "core/Settings.hpp" +#include "engines/kernel_ingestor_engine/IngestorPacks.hpp" +#include "tests/engines/kernel_ingestor_engine/packs/IngestorPackTestSupport.hpp" + +/** + * @file TestGfx950AttentionDenseSchemaGate.cpp + * @brief The schema gate is what keeps ragged and non-default-alignment SDPA graphs away + * from the shipped hipkernel:Gfx950AttentionDense engine. + * + * The engine's graph_match checks neither a ragged_offset on Q/K/V/O nor a declared + * tensor alignment. Both features need engine API 1.3.0: hipDNN stamps such a graph's + * min_required_engine_api_version 1.3.0, a plugin at API 1.4.0 passes the host's plugin + * filter, and the remaining guard is GenericPlanBuilder::understandsGraph(), which + * declines a graph whose stamp is above the engine descriptor's sdk_version. This suite + * offers both graphs to an engine built from the loaded descriptor set, the way the + * provider builds it, and requires that decline. It fails if the gate goes or the + * descriptor's sdk_version rises to 1.3.0: raise it only once the matcher declines ragged + * operands and a declared alignment it cannot serve itself. + * + * Hand-written, not generated: it belongs to the census binary because it reads the + * shipped descriptor set, and is registered with its own hkp_register_census_tests() call + * in src/tests/CMakeLists.txt. That shard is built only where the engine ships for + * gfx950, so IngestorGenerator's test_gfx950_attention_dense_schema_gate.py pins the + * configured sdk_version below 1.3.0 in every build. + */ +namespace +{ + +using namespace hip_kernel_provider::kernel_ingestor_engine; +using namespace hip_kernel_provider::kernel_ingestor_engine::testing; +namespace d = hipdnn_flatbuffers_sdk::data_objects; +namespace ingestor = hipdnn_plugin_sdk::ingestor; +using hipdnn_data_sdk::utilities::Version; + +constexpr int64_t Q_UID = 1; +constexpr int64_t K_UID = 2; +constexpr int64_t V_UID = 3; +constexpr int64_t O_UID = 4; +constexpr int64_t RAGGED_OFFSET_UID = 5; + +constexpr int64_t BATCH = 2; +constexpr int64_t HEADS = 4; +constexpr int64_t SEQ = 256; +constexpr int64_t HEAD_SIZE = 128; + +/// A device-less gfx950: if the gate let a graph through, the engine's real graph_match +/// would run against the architecture it ships for. +class Gfx950Resolver : public ingestor::IDeviceResolver +{ +public: + ingestor::DeviceId deviceId(const Handle& /*handle*/) const override + { + return 0; + } + + const ingestor::DeviceProperties& + deviceProperties(ingestor::DeviceId /*deviceId*/) const override + { + return _properties; + } + +private: + ingestor::DeviceProperties _properties = [] { + ingestor::DeviceProperties properties; + properties.gcnArchName = "gfx950"; + properties.warpSize = 64; + return properties; + }(); +}; + +std::unique_ptr + tensor(int64_t uid, d::DataType type, std::vector dims, std::vector strides) +{ + auto t = std::make_unique(); + t->uid = uid; + t->data_type = type; + t->dims = std::move(dims); + t->strides = std::move(strides); + return t; +} + +/// The graph Gfx950AttentionDense serves: BF16 BSHD Q/K/V/O `[2, 4, 256, 128]`, top-left +/// causal, compute FLOAT. +d::GraphT denseGraph() +{ + d::GraphT g; + const std::vector dims = {BATCH, HEADS, SEQ, HEAD_SIZE}; + const std::vector bshd = {SEQ * HEADS * HEAD_SIZE, HEAD_SIZE, HEADS * HEAD_SIZE, 1}; + for(const int64_t uid : {Q_UID, K_UID, V_UID, O_UID}) + { + g.tensors.push_back(tensor(uid, d::DataType::BFLOAT16, dims, bshd)); + } + d::SdpaAttributesT a; + a.q_tensor_uid = Q_UID; + a.k_tensor_uid = K_UID; + a.v_tensor_uid = V_UID; + a.o_tensor_uid = O_UID; + a.right_bound = 0; + a.diagonal_alignment = d::DiagonalAlignment::TOP_LEFT; + a.attn_scale_value = 0.08838835F; + auto n = std::make_unique(); + n->compute_data_type = d::DataType::FLOAT; + n->attributes.Set(a); + g.nodes.push_back(std::move(n)); + return g; +} + +/// Q and O ragged at the sequence axis through one INT32 `[B+1, 1, 1, 1]` offset tensor. +d::GraphT raggedGraph() +{ + auto g = denseGraph(); + for(auto& t : g.tensors) + { + if(t->uid == Q_UID || t->uid == O_UID) + { + t->ragged_offset_tensor_uid = RAGGED_OFFSET_UID; + } + } + g.tensors.push_back( + tensor(RAGGED_OFFSET_UID, d::DataType::INT32, {BATCH + 1, 1, 1, 1}, {1, 1, 1, 1})); + return g; +} + +/// Q declaring an 8-byte device-pointer alignment instead of the default 16. +d::GraphT eightByteAlignedGraph() +{ + auto g = denseGraph(); + g.tensors[0]->alignment = 8; + return g; +} + +/// Stamps @p g as hipDNN's GraphDescriptor does: the floor from the shared +/// graph -> version mapping. Returns that floor. +Version stamp(d::GraphT& g, bool ragged, bool nonDefaultAlignment) +{ + const auto& floor = hipdnn_plugin_sdk::computeMinimumEnginePluginApiVersion( + false, false, ragged, nonDefaultAlignment, false, false); + g.min_required_engine_api_version + = std::make_unique(hipdnn_plugin_sdk::toEngineApiVersion(floor)); + return floor; +} + +/// Offers @p g to an engine built from the loaded Gfx950AttentionDense set, as the +/// provider builds it, and returns whether the engine found it applicable. +bool offer(const d::GraphT& g) +{ + const Gfx950Resolver resolver; + const auto engine = ingestor::makeEngine( + loadedSet(GFX950_ATTENTION_DENSE_ENGINE_NAME), resolver); + flatbuffers::FlatBufferBuilder builder; + builder.Finish(d::Graph::Pack(builder, &g)); + const hipdnn_flatbuffers_sdk::flatbuffer_utilities::GraphWrapper wrapper( + builder.GetBufferPointer(), builder.GetSize()); + Handle handle; + return engine->isApplicable(handle, wrapper); +} + +/// The decline GenericPlanBuilder::understandsGraph() logs for @p floor. +std::string schemaGateDecline(const Version& floor) +{ + const auto& set = loadedSet(GFX950_ATTENTION_DENSE_ENGINE_NAME); + return "ingestor: engine '" + std::string(GFX950_ATTENTION_DENSE_ENGINE_NAME) + + "' declined the graph: it understands graph schema " + set.engine.sdkVersion.str() + + " but this graph requires " + floor.str(); +} + +/// hip_kernel_provider's advertised engine plugin API version, which the host compares +/// with the stamp before any engine sees the graph. +Version pluginApiVersion() +{ + const char* version = nullptr; + EXPECT_EQ(hipdnnPluginGetApiVersion(&version), HIPDNN_PLUGIN_STATUS_SUCCESS); + return Version{std::string(version != nullptr ? version : "0.0.0")}; +} + +TEST(TestGfx950AttentionDenseSchemaGate, DeclinesARaggedGraphAtTheSchemaGate) +{ + auto g = raggedGraph(); + const auto floor = stamp(g, true, false); + ASSERT_EQ(floor.str(), "1.3.0"); + // The plugin passes the host's filter, so only the engine's gate is left. + ASSERT_TRUE(pluginApiVersion() >= floor) << pluginApiVersion().str(); + + const auto recorder + = hipdnn_test_sdk::utilities::SharedLogRecorder::withOverrideLevel(HIPDNN_SEV_INFO); + EXPECT_FALSE(offer(g)); + EXPECT_TRUE(recorder.hasLogContaining(HIPDNN_SEV_INFO, schemaGateDecline(floor))) + << "expected: " << schemaGateDecline(floor); +} + +TEST(TestGfx950AttentionDenseSchemaGate, DeclinesANonDefaultAlignmentGraphAtTheSchemaGate) +{ + auto g = eightByteAlignedGraph(); + const auto floor = stamp(g, false, true); + ASSERT_EQ(floor.str(), "1.3.0"); + ASSERT_TRUE(pluginApiVersion() >= floor) << pluginApiVersion().str(); + + const auto recorder + = hipdnn_test_sdk::utilities::SharedLogRecorder::withOverrideLevel(HIPDNN_SEV_INFO); + EXPECT_FALSE(offer(g)); + EXPECT_TRUE(recorder.hasLogContaining(HIPDNN_SEV_INFO, schemaGateDecline(floor))) + << "expected: " << schemaGateDecline(floor); +} + +/// Control: the same graph without either feature is stamped at the baseline, passes the +/// gate and is served, so the declines above come from the stamp alone. +TEST(TestGfx950AttentionDenseSchemaGate, PassesTheBaselineGraphThroughTheSchemaGate) +{ + auto g = denseGraph(); + const auto floor = stamp(g, false, false); + ASSERT_EQ(floor.str(), "1.0.0"); + + const auto recorder + = hipdnn_test_sdk::utilities::SharedLogRecorder::withOverrideLevel(HIPDNN_SEV_INFO); + EXPECT_TRUE(offer(g)); + EXPECT_FALSE(recorder.hasLogContaining("understands graph schema")); +} + +} // namespace + +#endif // HIPDNN_ENABLE_KERNEL_INGESTOR diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestIngestorDispatchAliases.cpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestIngestorDispatchAliases.cpp index 149e96d8bc1d..ee3cdd514bb2 100644 --- a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestIngestorDispatchAliases.cpp +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestIngestorDispatchAliases.cpp @@ -12,6 +12,7 @@ #include "core/Handle.hpp" #include "engines/kernel_ingestor_engine/KernelIngestorEngine.hpp" +#include "engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedLaunchValues.hpp" #include "engines/kernel_ingestor_engine/packs/ConvFwdLaunchValues.hpp" #include "engines/kernel_ingestor_engine/packs/Gfx942AttentionDenseLaunchValues.hpp" #include "engines/kernel_ingestor_engine/packs/Gfx950AttentionDenseLaunchValues.hpp" @@ -47,6 +48,8 @@ TEST(TestIngestorDispatchAliases, EachVersionedAliasResolvesToTheSameHandler) expectOneHandler("hipkernel.conv_fwd.dispatch", CONV_FWD_DISPATCH_SYMBOL_V1); expectOneHandler("hipkernel.gfx950_attention_dense.dispatch", GFX950_ATTENTION_DENSE_DISPATCH_SYMBOL_V2); + expectOneHandler("hipkernel.attention_paged_unified.dispatch", + ATTENTION_PAGED_UNIFIED_DISPATCH_SYMBOL_V1); } // A superseded contract keeps its own handler, so a plan saved under it still restores diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestPackLaunchValues.cpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestPackLaunchValues.cpp index 0c6962d29ae5..60ee042abf94 100644 --- a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestPackLaunchValues.cpp +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/TestPackLaunchValues.cpp @@ -46,6 +46,8 @@ using hipdnn_plugin_sdk::ingestor::MetadataValue; using hipdnn_plugin_sdk::ingestor::MetadataValues; using hipdnn_plugin_sdk::ingestor::SavedLaunchInputs; using hipdnn_plugin_sdk::ingestor::toString; +using serialization::expectCommonReadRefusals; +using serialization::expectReadRefusal; TEST(TestPackLaunchValues, PointwiseValuesMatchTheV1Contract) { @@ -201,47 +203,6 @@ SavedLaunchInputs savedGfx950AttentionDense() gfx950AttentionDenseLaunchValues(launch.binding, launch.problem, launch.blockM)}; } -// Expects `read` to refuse `inputs` as a valid plan that cannot be restored, with `phrase` -// in the message. -template -void expectReadRefusal(TReader read, const SavedLaunchInputs& inputs, const std::string& phrase) -{ - serialization::expectIngestorPlanRefusal( - [&]() { static_cast(read(inputs)); }, HIPDNN_PLUGIN_STATUS_NOT_APPLICABLE, phrase); -} - -// The refusals every reader shares: a missing value, an extra value, an integer stored as a -// string or as an integer list, and the unversioned dispatch name, which is registered but -// names no contract. -template -void expectCommonReadRefusals(TReader read, - const SavedLaunchInputs& valid, - const std::string& unversionedAlias, - const std::string& integerName) -{ - SavedLaunchInputs missing = valid; - missing.values.erase(integerName); - expectReadRefusal(read, missing, "needs launch value '" + integerName + "'"); - - SavedLaunchInputs extra = valid; - extra.values["unexpected"] = int64_t{1}; - expectReadRefusal(read, extra, "launch value 'unexpected' is not part of the contract"); - - SavedLaunchInputs wrongType = valid; - wrongType.values[integerName] = std::string("1"); - expectReadRefusal(read, wrongType, "launch value '" + integerName + "'"); - expectReadRefusal(read, wrongType, "must be int in ["); - expectReadRefusal(read, wrongType, "and the plan holds string"); - - SavedLaunchInputs wrongList = valid; - wrongList.values[integerName] = std::vector{1}; - expectReadRefusal(read, wrongList, "and the plan holds int_list"); - - SavedLaunchInputs unversioned = valid; - unversioned.dispatchSymbol = unversionedAlias; - expectReadRefusal(read, unversioned, "names no launch-value contract"); -} - // The scales a dense reader restores: the [2^-64, 2^4] its graph match serves, bounds // included, and nothing else. A float scale outside it is refused with the match's reason; // NaN and the infinities are refused before that, as no float launch argument holds them. diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/UnifiedAttention2DSignatureCases.hpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/UnifiedAttention2DSignatureCases.hpp index 5346f313550d..4d7cfc7de2be 100644 --- a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/UnifiedAttention2DSignatureCases.hpp +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/packs/UnifiedAttention2DSignatureCases.hpp @@ -18,7 +18,7 @@ /** * @file UnifiedAttention2DSignatureCases.hpp * @brief The kernarg-ABI cases the unified-attention 2D packs share: pins the ABI each pack - * marshals (unified2DKernelSignature in UnifiedAttention2DCommon.hpp) against the ABI + * marshals (tiled2DKernelSignature in AttentionTiled2DSignature.hpp) against the ABI * the rocKE builder declares. * * A wrong argument count, order, kind or width is not a launch error. The driver copies diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/serialization/IngestorPlanTestUtilities.hpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/serialization/IngestorPlanTestUtilities.hpp index 850174d0ae82..8fc9e6466631 100644 --- a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/serialization/IngestorPlanTestUtilities.hpp +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/serialization/IngestorPlanTestUtilities.hpp @@ -5,15 +5,18 @@ #ifdef HIPDNN_ENABLE_KERNEL_INGESTOR +#include #include #include #include #include #include +#include #include #include +#include #include "engines/kernel_ingestor_engine/serialization/IngestorPlanRefusal.hpp" @@ -92,6 +95,51 @@ std::string expectPluginInternalError(Action&& action, const std::string& phrase std::forward(action), HIPDNN_PLUGIN_STATUS_INTERNAL_ERROR, "", phrase); } +// Expects `read` to refuse `inputs` as a valid plan that cannot be restored, with `phrase` +// in the message. +template +void expectReadRefusal(TReader read, + const hipdnn_plugin_sdk::ingestor::SavedLaunchInputs& inputs, + const std::string& phrase) +{ + expectIngestorPlanRefusal( + [&]() { static_cast(read(inputs)); }, HIPDNN_PLUGIN_STATUS_NOT_APPLICABLE, phrase); +} + +// The refusals every launch-value reader shares: a missing value, an extra value, an +// integer stored as a string or as an integer list, and the unversioned dispatch name, +// which is registered but names no contract. +template +void expectCommonReadRefusals(TReader read, + const hipdnn_plugin_sdk::ingestor::SavedLaunchInputs& valid, + const std::string& unversionedAlias, + const std::string& integerName) +{ + using hipdnn_plugin_sdk::ingestor::SavedLaunchInputs; + + SavedLaunchInputs missing = valid; + missing.values.erase(integerName); + expectReadRefusal(read, missing, "needs launch value '" + integerName + "'"); + + SavedLaunchInputs extra = valid; + extra.values["unexpected"] = int64_t{1}; + expectReadRefusal(read, extra, "launch value 'unexpected' is not part of the contract"); + + SavedLaunchInputs wrongType = valid; + wrongType.values[integerName] = std::string("1"); + expectReadRefusal(read, wrongType, "launch value '" + integerName + "'"); + expectReadRefusal(read, wrongType, "must be int in ["); + expectReadRefusal(read, wrongType, "and the plan holds string"); + + SavedLaunchInputs wrongList = valid; + wrongList.values[integerName] = std::vector{1}; + expectReadRefusal(read, wrongList, "and the plan holds int_list"); + + SavedLaunchInputs unversioned = valid; + unversioned.dispatchSymbol = unversionedAlias; + expectReadRefusal(read, unversioned, "names no launch-value contract"); +} + } // namespace hip_kernel_provider::kernel_ingestor_engine::serialization #endif // HIPDNN_ENABLE_KERNEL_INGESTOR diff --git a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/serialization/TestIngestorPlanLaunchContractGoldens.cpp b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/serialization/TestIngestorPlanLaunchContractGoldens.cpp index 68626098cb7f..bbd8a5e76ede 100644 --- a/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/serialization/TestIngestorPlanLaunchContractGoldens.cpp +++ b/dnn-providers/hip-kernel-provider/src/tests/engines/kernel_ingestor_engine/serialization/TestIngestorPlanLaunchContractGoldens.cpp @@ -21,6 +21,7 @@ #include "engines/kernel_ingestor_engine/packs/AttentionDenseCommon.hpp" #include "engines/kernel_ingestor_engine/packs/AttentionDensePersistent.hpp" +#include "engines/kernel_ingestor_engine/packs/AttentionPagedUnifiedLaunchValues.hpp" #include "engines/kernel_ingestor_engine/packs/ConvFwdGeometry.hpp" #include "engines/kernel_ingestor_engine/packs/ConvFwdLaunchValues.hpp" #include "engines/kernel_ingestor_engine/packs/Gfx942AttentionDenseGeometry.hpp" @@ -85,6 +86,8 @@ constexpr std::string_view GFX950_ATTENTION_DENSE_V2_SAMPLE_DISPATCH = "hipkernel.gfx950_attention_dense.dispatch.v2"; constexpr std::string_view GFX942_ATTENTION_DENSE_SAMPLE_DISPATCH = "hipkernel.gfx942_attention_dense.dispatch.v1"; +constexpr std::string_view ATTENTION_PAGED_UNIFIED_SAMPLE_DISPATCH + = "hipkernel.attention_paged_unified.dispatch.v1"; // The value names and types of each contract, also spelled out so a pack rename fails // this test. These are what the generator encodes into a new sample. @@ -243,6 +246,44 @@ MetadataValues gfx942AttentionDensePersistentThreePairSampleValues() {"num_persistent", int64_t{304}}}; } +// A ragged Q with a FLOAT sink and separate K and V page tables, so every optional uid +// holds a value and every value differs from the others. +MetadataValues attentionPagedUnifiedSampleValues() +{ + return {{"q.uid", int64_t{51}}, + {"k.uid", int64_t{52}}, + {"v.uid", int64_t{53}}, + {"o.uid", int64_t{54}}, + {"page_table_k.uid", int64_t{55}}, + {"page_table_v.uid", int64_t{56}}, + {"seq_len_kv.uid", int64_t{57}}, + {"seq_len_q.uid", int64_t{58}}, + {"ragged_offset.uid", int64_t{59}}, + {"sink.uid", int64_t{60}}, + {"scale", 0.125}, + {"num_seqs", int64_t{5}}, + {"block_table_stride", int64_t{24}}, + {"num_query_heads", int64_t{32}}, + {"num_kv_heads", int64_t{8}}, + {"sliding_window", int64_t{33}}, + {"q_uniform_len", int64_t{0}}, + {"q_seq_stride", int64_t{4096}}, + {"q_tok_stride", int64_t{4097}}, + {"q_head_stride", int64_t{128}}, + {"o_seq_stride", int64_t{4224}}, + {"o_tok_stride", int64_t{4225}}, + {"o_head_stride", int64_t{136}}, + {"kv_block_stride", int64_t{65536}}, + {"kv_tok_stride", int64_t{256}}, + {"kv_head_stride", int64_t{8192}}, + {"kv_block_span_bytes", int64_t{131072}}, + {"q_block_grid", int64_t{21}}, + {"sink_is_f32", int64_t{1}}, + {"num_kv_blocks", int64_t{8192}}, + {"block_table_width", int64_t{24}}, + {"block_threads", int64_t{128}}}; +} + // The fields outside the dispatch contract. Fixed across the samples, so they differ only // in the contract under test. Each signature column holds different values, and one name // is empty, so a decoder that mixes up two columns fails the comparison. @@ -316,6 +357,12 @@ serialization::IngestorPlanPayload gfx942AttentionDensePersistentThreePairSample gfx942AttentionDensePersistentThreePairSampleValues()); } +serialization::IngestorPlanPayload attentionPagedUnifiedSamplePayload() +{ + return samplePayload(std::string(ATTENTION_PAGED_UNIFIED_SAMPLE_DISPATCH), + attentionPagedUnifiedSampleValues()); +} + // --------------------------------------------------------------------------- // The checked-in bytes // --------------------------------------------------------------------------- @@ -1022,6 +1069,149 @@ constexpr std::array GFX942_ATTENTION_DENSE_V1_PERSISTENT_THREE_P 0x05, 0x00, 0x00, 0x00, 0x61, 0x5F, 0x70, 0x74, 0x72, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x67, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x5F, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x00, 0x00, 0x00}; +constexpr std::array ATTENTION_PAGED_UNIFIED_V1_GOLDEN = { + 0x48, 0x4B, 0x49, 0x50, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x96, 0x3C, 0x2C, 0xA9, 0x89, 0x4E, 0x53, 0xBE, 0x1A, 0x8B, 0x78, 0x04, 0xDF, 0xBD, 0x5F, 0x76, + 0x86, 0x2A, 0xC2, 0xB2, 0xE6, 0x45, 0x5A, 0xE5, 0x1F, 0x7C, 0x52, 0xDF, 0x12, 0x90, 0xF2, 0x74, + 0x1C, 0x00, 0x00, 0x00, 0x48, 0x4B, 0x53, 0x50, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, + 0x20, 0x00, 0x14, 0x00, 0x10, 0x00, 0x0C, 0x00, 0x08, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x2C, 0x00, 0x00, 0x00, 0x34, 0x07, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x22, 0x23, + 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x05, 0x00, 0x00, 0x00, + 0x31, 0x2E, 0x30, 0x2E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, + 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, + 0x2D, 0x00, 0x00, 0x00, 0x68, 0x69, 0x70, 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C, 0x2E, 0x61, 0x74, + 0x74, 0x65, 0x6E, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x70, 0x61, 0x67, 0x65, 0x64, 0x5F, 0x75, 0x6E, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x2E, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2E, 0x76, + 0x31, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x64, 0x06, 0x00, 0x00, 0x1C, 0x06, 0x00, 0x00, + 0xE8, 0x05, 0x00, 0x00, 0xBC, 0x05, 0x00, 0x00, 0x84, 0x05, 0x00, 0x00, 0x44, 0x05, 0x00, 0x00, + 0x10, 0x05, 0x00, 0x00, 0xDC, 0x04, 0x00, 0x00, 0xA8, 0x04, 0x00, 0x00, 0x74, 0x04, 0x00, 0x00, + 0x40, 0x04, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xAC, 0x03, 0x00, 0x00, + 0x78, 0x03, 0x00, 0x00, 0x44, 0x03, 0x00, 0x00, 0x0C, 0x03, 0x00, 0x00, 0xD0, 0x02, 0x00, 0x00, + 0xA0, 0x02, 0x00, 0x00, 0x6C, 0x02, 0x00, 0x00, 0x38, 0x02, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, + 0xD0, 0x01, 0x00, 0x00, 0xA0, 0x01, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0xCC, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x26, 0xFA, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, + 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x76, 0x2E, 0x75, 0x69, + 0x64, 0x00, 0x00, 0x00, 0x0E, 0xFA, 0xFF, 0xFF, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x4E, 0xFA, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x73, 0x6C, 0x69, 0x64, 0x69, 0x6E, 0x67, 0x5F, 0x77, 0x69, 0x6E, 0x64, + 0x6F, 0x77, 0x00, 0x00, 0x4E, 0xFB, 0xFF, 0xFF, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x82, 0xFA, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x73, 0x69, 0x6E, 0x6B, 0x5F, 0x69, 0x73, 0x5F, + 0x66, 0x33, 0x32, 0x00, 0x7E, 0xFB, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xB2, 0xFA, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x73, 0x69, 0x6E, 0x6B, 0x2E, 0x75, 0x69, 0x64, + 0x00, 0x00, 0x00, 0x00, 0x9E, 0xFA, 0xFF, 0xFF, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDE, 0xFA, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0D, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x5F, 0x6C, 0x65, 0x6E, 0x5F, 0x71, 0x2E, 0x75, 0x69, + 0x64, 0x00, 0x00, 0x00, 0xCE, 0xFA, 0xFF, 0xFF, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0xFB, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x73, 0x65, 0x71, 0x5F, 0x6C, 0x65, 0x6E, 0x5F, 0x6B, 0x76, 0x2E, 0x75, + 0x69, 0x64, 0x00, 0x00, 0xFE, 0xFA, 0xFF, 0xFF, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0xFB, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x73, 0x63, 0x61, 0x6C, 0x65, 0x00, 0x00, 0x00, 0x36, 0xFC, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x6A, 0xFB, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x72, 0x61, 0x67, 0x67, 0x65, 0x64, 0x5F, 0x6F, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2E, 0x75, 0x69, + 0x64, 0x00, 0x00, 0x00, 0x6E, 0xFC, 0xFF, 0xFF, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xA2, 0xFB, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, + 0x1C, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x71, 0x5F, 0x75, 0x6E, 0x69, 0x66, 0x6F, 0x72, + 0x6D, 0x5F, 0x6C, 0x65, 0x6E, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xCE, 0xFB, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x71, 0x5F, 0x74, 0x6F, 0x6B, 0x5F, 0x73, 0x74, 0x72, 0x69, 0x64, 0x65, + 0x00, 0x00, 0x00, 0x00, 0xBE, 0xFB, 0xFF, 0xFF, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFE, 0xFB, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x71, 0x5F, 0x73, 0x65, 0x71, 0x5F, 0x73, 0x74, 0x72, 0x69, 0x64, 0x65, + 0x00, 0x00, 0x00, 0x00, 0xEE, 0xFB, 0xFF, 0xFF, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2E, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0D, 0x00, 0x00, 0x00, 0x71, 0x5F, 0x68, 0x65, 0x61, 0x64, 0x5F, 0x73, 0x74, 0x72, 0x69, 0x64, + 0x65, 0x00, 0x00, 0x00, 0x1E, 0xFC, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5E, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x71, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x5F, 0x67, 0x72, 0x69, 0x64, + 0x00, 0x00, 0x00, 0x00, 0x4E, 0xFC, 0xFF, 0xFF, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x8E, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x71, 0x2E, 0x75, 0x69, 0x64, 0x00, 0x00, 0x00, 0x86, 0xFD, 0xFF, 0xFF, + 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBA, 0xFC, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x70, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x5F, 0x76, 0x2E, 0x75, 0x69, 0x64, + 0x00, 0x00, 0x00, 0x00, 0xBE, 0xFD, 0xFF, 0xFF, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xF2, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, + 0x1C, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x61, 0x67, 0x65, 0x5F, 0x74, 0x61, 0x62, + 0x6C, 0x65, 0x5F, 0x6B, 0x2E, 0x75, 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xFC, 0xFF, 0xFF, + 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, + 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x6F, 0x5F, 0x74, 0x6F, + 0x6B, 0x5F, 0x73, 0x74, 0x72, 0x69, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x16, 0xFD, 0xFF, 0xFF, + 0x81, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, + 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x6F, 0x5F, 0x73, 0x65, + 0x71, 0x5F, 0x73, 0x74, 0x72, 0x69, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x46, 0xFD, 0xFF, 0xFF, + 0x80, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, + 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x6F, 0x5F, 0x68, 0x65, + 0x61, 0x64, 0x5F, 0x73, 0x74, 0x72, 0x69, 0x64, 0x65, 0x00, 0x00, 0x00, 0x76, 0xFD, 0xFF, 0xFF, + 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB6, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, + 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6F, 0x2E, 0x75, 0x69, + 0x64, 0x00, 0x00, 0x00, 0xAE, 0xFE, 0xFF, 0xFF, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xE2, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6E, 0x75, 0x6D, 0x5F, 0x73, 0x65, 0x71, 0x73, + 0x00, 0x00, 0x00, 0x00, 0xCE, 0xFD, 0xFF, 0xFF, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0F, 0x00, 0x00, 0x00, 0x6E, 0x75, 0x6D, 0x5F, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5F, 0x68, 0x65, + 0x61, 0x64, 0x73, 0x00, 0xFE, 0xFD, 0xFF, 0xFF, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x6E, 0x75, 0x6D, 0x5F, 0x6B, 0x76, 0x5F, 0x68, 0x65, 0x61, 0x64, 0x73, + 0x00, 0x00, 0x00, 0x00, 0x2E, 0xFE, 0xFF, 0xFF, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6E, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0D, 0x00, 0x00, 0x00, 0x6E, 0x75, 0x6D, 0x5F, 0x6B, 0x76, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, + 0x73, 0x00, 0x00, 0x00, 0x5E, 0xFE, 0xFF, 0xFF, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x9E, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0D, 0x00, 0x00, 0x00, 0x6B, 0x76, 0x5F, 0x74, 0x6F, 0x6B, 0x5F, 0x73, 0x74, 0x72, 0x69, 0x64, + 0x65, 0x00, 0x00, 0x00, 0x8E, 0xFE, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xCE, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x6B, 0x76, 0x5F, 0x68, 0x65, 0x61, 0x64, 0x5F, 0x73, 0x74, 0x72, 0x69, + 0x64, 0x65, 0x00, 0x00, 0xBE, 0xFE, 0xFF, 0xFF, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFE, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x0F, 0x00, 0x00, 0x00, 0x6B, 0x76, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x5F, 0x73, 0x74, 0x72, + 0x69, 0x64, 0x65, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x6B, 0x76, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x5F, 0x73, 0x70, 0x61, 0x6E, 0x5F, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x00, 0x2E, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6E, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x6B, 0x2E, 0x75, 0x69, 0x64, 0x00, 0x00, 0x00, 0x56, 0xFF, 0xFF, 0xFF, + 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, + 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x62, 0x6C, 0x6F, 0x63, + 0x6B, 0x5F, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x00, 0x00, 0x00, 0x86, 0xFF, 0xFF, 0xFF, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02, + 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x62, 0x6C, 0x6F, 0x63, + 0x6B, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x5F, 0x77, 0x69, 0x64, 0x74, 0x68, 0x00, 0x06, 0x00, + 0x0E, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x5F, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x5F, 0x73, 0x74, 0x72, 0x69, + 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x1C, 0x00, 0x07, 0x00, 0x08, 0x00, + 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x18, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x68, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x6C, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x65, 0x66, 0x35, 0x31, 0x39, 0x39, 0x39, 0x39, + 0x39, 0x32, 0x38, 0x65, 0x37, 0x38, 0x37, 0x39, 0x62, 0x64, 0x64, 0x30, 0x36, 0x32, 0x33, 0x30, + 0x31, 0x39, 0x31, 0x36, 0x33, 0x35, 0x64, 0x35, 0x32, 0x65, 0x64, 0x34, 0x32, 0x37, 0x37, 0x37, + 0x64, 0x34, 0x62, 0x33, 0x36, 0x34, 0x66, 0x62, 0x63, 0x63, 0x38, 0x66, 0x36, 0x31, 0x66, 0x62, + 0x30, 0x62, 0x35, 0x34, 0x30, 0x61, 0x35, 0x38, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x67, 0x66, 0x78, 0x39, 0x34, 0x32, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x67, 0x6F, 0x6C, 0x64, + 0x65, 0x6E, 0x5F, 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x7F, 0x45, 0x4C, 0x46, 0x02, 0x01, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, + 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x62, 0x79, 0x5F, 0x76, + 0x61, 0x6C, 0x75, 0x65, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x14, 0x00, 0x04, 0x00, 0x08, 0x00, + 0x0C, 0x00, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x63, 0x6F, 0x75, 0x6E, + 0x74, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x62, 0x79, 0x5F, 0x76, 0x61, 0x6C, 0x75, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x61, 0x5F, 0x70, 0x74, 0x72, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, + 0x67, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x5F, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x00, 0x00, 0x00}; + // --------------------------------------------------------------------------- // Reading a sample // --------------------------------------------------------------------------- @@ -1374,6 +1564,48 @@ TEST(TestIngestorPlanLaunchContractGoldens, {613566757, 3}, {1431655766, 3}, {-1717986918, 3}})); } +TEST(TestIngestorPlanLaunchContractGoldens, AttentionPagedUnifiedV1SampleStillReadsAsItsContract) +{ + const SavedLaunchInputs inputs + = readSample(ATTENTION_PAGED_UNIFIED_V1_GOLDEN, attentionPagedUnifiedSamplePayload()); + ASSERT_EQ(inputs.dispatchSymbol, "hipkernel.attention_paged_unified.dispatch.v1"); + + const AttentionPagedUnifiedLaunchInputs launch = readAttentionPagedUnifiedLaunchInputs(inputs); + EXPECT_EQ(launch.uids.q, 51); + EXPECT_EQ(launch.uids.k, 52); + EXPECT_EQ(launch.uids.v, 53); + EXPECT_EQ(launch.uids.o, 54); + EXPECT_EQ(launch.uids.pageTableK, 55); + EXPECT_EQ(launch.uids.pageTableV, 56); + EXPECT_EQ(launch.uids.seqLenKv, 57); + EXPECT_EQ(launch.uids.seqLenQ, 58); + EXPECT_EQ(launch.uids.raggedOffset, 59); + EXPECT_EQ(launch.uids.sink, 60); + const AttentionPagedUnifiedScalars& s = launch.scalars; + EXPECT_EQ(s.scale, 0.125F); + EXPECT_EQ(s.numSeqs, 5); + EXPECT_EQ(s.blockTableStride, 24); + EXPECT_EQ(s.numQueryHeads, 32); + EXPECT_EQ(s.numKvHeads, 8); + EXPECT_EQ(s.slidingWindow, 33); + EXPECT_EQ(s.qUniformLen, 0); + EXPECT_EQ(s.q.seqStride, 4096); + EXPECT_EQ(s.q.tokenStride, 4097); + EXPECT_EQ(s.q.headStride, 128); + EXPECT_EQ(s.o.seqStride, 4224); + EXPECT_EQ(s.o.tokenStride, 4225); + EXPECT_EQ(s.o.headStride, 136); + EXPECT_EQ(s.kvBlockStride, 65536); + EXPECT_EQ(s.kvTokStride, 256); + EXPECT_EQ(s.kvHeadStride, 8192); + EXPECT_EQ(s.kvBlockSpanBytes, 131072); + EXPECT_EQ(s.qBlockGrid, 21); + EXPECT_EQ(s.sinkIsF32, 1); + EXPECT_EQ(s.numKvBlocks, 8192); + EXPECT_EQ(s.blockTableWidth, 24); + EXPECT_EQ(launch.blockThreads, 128); +} + TEST(TestIngestorPlanLaunchContractGoldens, ConvFwdV1SampleGivesTheSameGeometry) { const ConvFwdLaunchInputs launch @@ -1444,6 +1676,8 @@ TEST(TestIngestorPlanLaunchContractGoldens, DISABLED_PrintLaunchContractSamples) printSample( "GFX942_ATTENTION_DENSE_V1_PERSISTENT_THREE_PAIR_GOLDEN", serialization::encodeIngestorPlan(gfx942AttentionDensePersistentThreePairSamplePayload())); + printSample("ATTENTION_PAGED_UNIFIED_V1_GOLDEN", + serialization::encodeIngestorPlan(attentionPagedUnifiedSamplePayload())); } } // namespace diff --git a/dnn-providers/integration-tests/docs/file-formats.md b/dnn-providers/integration-tests/docs/file-formats.md index 8144964d6172..bbe99cde410c 100644 --- a/dnn-providers/integration-tests/docs/file-formats.md +++ b/dnn-providers/integration-tests/docs/file-formats.md @@ -1016,7 +1016,7 @@ Do not confuse them: | `dnn-providers/integration-tests/test_categories.yaml` | This project's own binaries `hipdnn_integration_tests_unit_tests` and `hipdnn_golden_data_tests` | | `dnn-providers/integration-tests/test_categories_gpu_ref.yaml` | `hipdnn_gpu_ref_tests`. Quick is an fp32 smoke run; reduced-precision and mixed-type cases are in standard | | `dnn-providers/integration-tests/test_categories_external.yaml` | Pre-registered non-GTest CTest tests (the Python verifiers, test-name validation) | -| `dnn-providers//test_categories_integration.yaml` (hip-kernel-provider: `HIP_MLOPS_ENGINE_test_categories_integration.yaml`, `ASM_SDPA_ENGINE_test_categories_integration.yaml`, `hipkernel_Gfx950Attention_test_categories_integration.yaml`, `hipkernel_Gfx942AttentionUnified3d_test_categories_integration.yaml`, `hipkernel_Gfx942AttentionDense_test_categories_integration.yaml`, `hipkernel_Gfx942AttentionUnified2D_test_categories_integration.yaml`, `hipkernel_flydsl_sdpa_test_categories_integration.yaml`, `hipkernel_flydsl_rmsnorm_test_categories_integration.yaml`, `hipkernel_flydsl_rmsnorm_bwd_test_categories_integration.yaml`, `hipkernel_flydsl_sdpa_bwd_split_test_categories_integration.yaml`, `hipkernel_flydsl_sdpa_bwd_merged_test_categories_integration.yaml`) | `hipdnn_integration_tests` **run against that provider's engine** — the lane's bundle suites | +| `dnn-providers//test_categories_integration.yaml` (hip-kernel-provider: `HIP_MLOPS_ENGINE_test_categories_integration.yaml`, `ASM_SDPA_ENGINE_test_categories_integration.yaml`, `hipkernel_Gfx950Attention_test_categories_integration.yaml`, `hipkernel_Gfx942AttentionUnified3d_test_categories_integration.yaml`, `hipkernel_Gfx942AttentionDense_test_categories_integration.yaml`, `hipkernel_AttentionPagedUnified_test_categories_integration.yaml`, `hipkernel_Gfx942AttentionUnified2D_test_categories_integration.yaml`, `hipkernel_flydsl_sdpa_test_categories_integration.yaml`, `hipkernel_flydsl_rmsnorm_test_categories_integration.yaml`, `hipkernel_flydsl_rmsnorm_bwd_test_categories_integration.yaml`, `hipkernel_flydsl_sdpa_bwd_split_test_categories_integration.yaml`, `hipkernel_flydsl_sdpa_bwd_merged_test_categories_integration.yaml`) | `hipdnn_integration_tests` **run against that provider's engine** — the lane's bundle suites | A provider's own `test_categories.yaml` governs its native `*_plugin_tests` binaries, not the shared suite. diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd128_causal_paged/Decode/Decode.support.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd128_causal_paged/Decode/Decode.support.json index 42566e269577..9cb9ed1e55c0 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd128_causal_paged/Decode/Decode.support.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd128_causal_paged/Decode/Decode.support.json @@ -1,4 +1,13 @@ { - "claims": {}, + "claims": { + "hipkernel:AttentionPagedUnified": { + "gfx942": [ + "linux" + ], + "gfx950": [ + "linux" + ] + } + }, "version": 1 } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd64_causal_paged_sinks/Decode/Decode.support.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd64_causal_paged_sinks/Decode/Decode.support.json index 42566e269577..9cb9ed1e55c0 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd64_causal_paged_sinks/Decode/Decode.support.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd64_causal_paged_sinks/Decode/Decode.support.json @@ -1,4 +1,13 @@ { - "claims": {}, + "claims": { + "hipkernel:AttentionPagedUnified": { + "gfx942": [ + "linux" + ], + "gfx950": [ + "linux" + ] + } + }, "version": 1 } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd64_window_ragged_paged_sinks/Mixed/Mixed.support.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd64_window_ragged_paged_sinks/Mixed/Mixed.support.json index 42566e269577..9cb9ed1e55c0 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd64_window_ragged_paged_sinks/Mixed/Mixed.support.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/bf16/hd64_window_ragged_paged_sinks/Mixed/Mixed.support.json @@ -1,4 +1,13 @@ { - "claims": {}, + "claims": { + "hipkernel:AttentionPagedUnified": { + "gfx942": [ + "linux" + ], + "gfx950": [ + "linux" + ] + } + }, "version": 1 } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/fp16/hd64_causal_paged/SpecDecode/SpecDecode.support.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/fp16/hd64_causal_paged/SpecDecode/SpecDecode.support.json index 42566e269577..9cb9ed1e55c0 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/fp16/hd64_causal_paged/SpecDecode/SpecDecode.support.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/fp16/hd64_causal_paged/SpecDecode/SpecDecode.support.json @@ -1,4 +1,13 @@ { - "claims": {}, + "claims": { + "hipkernel:AttentionPagedUnified": { + "gfx942": [ + "linux" + ], + "gfx950": [ + "linux" + ] + } + }, "version": 1 } diff --git a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/fp16/hd64_window_ragged_paged/Mixed/Mixed.support.json b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/fp16/hd64_window_ragged_paged/Mixed/Mixed.support.json index 42566e269577..9cb9ed1e55c0 100644 --- a/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/fp16/hd64_window_ragged_paged/Mixed/Mixed.support.json +++ b/dnn-providers/integration-tests/integration-test-bundles/quick/SdpaFwd/bshd/fp16/hd64_window_ragged_paged/Mixed/Mixed.support.json @@ -1,4 +1,13 @@ { - "claims": {}, + "claims": { + "hipkernel:AttentionPagedUnified": { + "gfx942": [ + "linux" + ], + "gfx950": [ + "linux" + ] + } + }, "version": 1 } diff --git a/projects/hipdnn/tools/IngestorGenerator/README.md b/projects/hipdnn/tools/IngestorGenerator/README.md index 9be6756b7c72..d09cac72ebc9 100644 --- a/projects/hipdnn/tools/IngestorGenerator/README.md +++ b/projects/hipdnn/tools/IngestorGenerator/README.md @@ -846,6 +846,7 @@ There is no packaging `--profile`, CMake `PROFILES` or external root manifest. | `configs/axes_example.yaml` | Pack-level `axes`: one `kernel_template` crossed with value lists, expanded at load time | | `configs/variants_example.yaml` | Pack-level `variants`: a shape list crossed per-shape with a named knob set (below) | | `configs/gfx1151_wmma_attention.yaml` | The shipped `hipkernel:Gfx1151WmmaAttention` catalog: packaged rocKE runtime-shape kernels under `rocKE/gfx1151_wmma_attention` | +| `configs/attention_paged_unified.yaml` | The shipped `hipkernel:AttentionPagedUnified` catalog: packaged rocKE tiled 2D `runtime_layout` kernels for gfx942 and gfx950 under `rocKE/attention_paged_unified` | ## Generated variant sets: `variants` diff --git a/projects/hipdnn/tools/IngestorGenerator/configs/attention_paged_unified.yaml b/projects/hipdnn/tools/IngestorGenerator/configs/attention_paged_unified.yaml new file mode 100644 index 000000000000..197b37904051 --- /dev/null +++ b/projects/hipdnn/tools/IngestorGenerator/configs/attention_paged_unified.yaml @@ -0,0 +1,423 @@ +# Source of truth for the shipped hipkernel:AttentionPagedUnified catalog. +# +# The kernels are rocKE's tiled 2D unified-attention builders +# (kernels/{gfx942,gfx950}/attention_tiled_2d.py, build_unified_attention_2d_tiled) in +# their runtime_layout form: Q/O/K/V strides, the query head count, the sliding window, +# the batch size and whether Q is dense or ragged are launch arguments, and the page +# table and sequence lengths are read on the device. Every object is built with +# num_kv_heads = 1, so num_query_heads is the GQA ratio (query heads per KV head), +# which with the head size, the paged-KV block size and the dtype fixes the kernel. +# +# The native matcher (packs/AttentionPagedUnifiedNative.cpp) serves cuDNN paged +# attention: paged K/V containers with arbitrary strides (including the interleaved +# K|V view of one cache allocation), INT32 page tables (one tensor for K and V, or +# separate K and V tables with the same width and batch stride), INT32 +# sequence lengths, dense or ragged Q, and bottom-right causal masking with an optional +# left bound, optionally with a per-query-head attention sink (sink_token). +# +# Every object ships twice: without sinks, and with use_sinks (name suffix _sinks, +# KMD use_sinks = 1), which loads one sink logit per query head from sink_ptr, FLOAT or +# in the I/O dtype as the sink_is_f32 launch argument says, and joins it to the softmax +# max and denominator. +# +# sdk_version 1.4.0: ragged Q/O (1.3.0) with a token-unit ragged_offset_multiplier +# (1.4.0). The matcher declines override-shape graphs (1.1.0). +# +# Geometry per arch is rocKE's runtime_layout_catalog_spec() in each builder module +# (num_warps, and on gfx942 sub-block tile_size where the LDS budget needs it); the +# engine launches num_warps * 64 threads with BLOCK_Q = 16 * num_warps // num_query_heads. + +dialect: packaged +authored_subpath: rocKE/attention_paged_unified +engine: + name: hipkernel:AttentionPagedUnified + census_name_symbol: ATTENTION_PAGED_UNIFIED_ENGINE_NAME + sdk_version: 1.4.0 + knobs: [] + heuristic: none + +kmd_fields: +- name: dtype + type: string +- name: head_size + type: int +- name: block_size + type: int +- name: num_query_heads + type: int +- name: num_kv_heads + type: int + default_value: 1 +- name: num_warps + type: int + default_value: 1 +- name: block_m_per_warp + type: int + default_value: 16 +- name: use_sinks + type: int + default_value: 0 + +specialization: + metadata_fields: + - dtype + - head_size + - block_size + - num_query_heads + - num_kv_heads + - num_warps + - block_m_per_warp + - use_sinks + matcher_only_fields: [] + vocabulary: + dtype: {bf16: BF16, fp16: FP16} + bindings: + dtype: {field: dtype} + head_size: {field: head_size} + block_size: {field: block_size} + num_query_heads: {field: num_query_heads} + num_kv_heads: {field: num_kv_heads} + num_warps: {field: num_warps} + block_m_per_warp: {field: block_m_per_warp} + use_sinks: {field: use_sinks} + +# One pack per architecture (each builder module is arch-specific); each pack's +# discriminator names its graph-scoped criterion, which admits the pack only on its +# own architecture. +graph_match: + shape: shared_shape + discriminator: none + +kernel_source_kind: rocke +workspace_policy: none +packs: +- name: gfx942 + arch: [gfx942] + discriminator: gfx942 + kernel_defaults: + kind: rocke + source: kernels/gfx942/attention_tiled_2d.py + builder: build_unified_attention_2d_tiled + variants: + - name: paged_unified.{dtype}_d{head_size}_bs{block_size}_g{num_query_heads}_{tag}.gfx942 + metadata: [dtype, head_size, block_size, num_query_heads, num_kv_heads, num_warps, block_m_per_warp, use_sinks] + vocabulary: + dtype: {bf16: BF16, fp16: FP16} + spec_order: [head_size, block_size, num_query_heads, num_kv_heads, dtype, use_sinks, sliding_window, has_softcap, num_warps, block_m_per_warp, runtime_layout] + spec_defaults: + num_kv_heads: 1 + use_sinks: false + sliding_window: 0 + has_softcap: false + num_warps: 4 + block_m_per_warp: 16 + runtime_layout: true + shape_axes: + dtype: [fp16, bf16] + head_size: [64] + block_size: [16, 32, 64] + knob_sets: + gqa: + - {num_query_heads: 1} + - {num_query_heads: 2} + - {num_query_heads: 4} + - {num_query_heads: 5} + - {num_query_heads: 6} + - {num_query_heads: 7} + - {num_query_heads: 8} + - {num_query_heads: 16} + gqa_sinks: + - {num_query_heads: 1, use_sinks: true, tag: sinks} + - {num_query_heads: 2, use_sinks: true, tag: sinks} + - {num_query_heads: 4, use_sinks: true, tag: sinks} + - {num_query_heads: 5, use_sinks: true, tag: sinks} + - {num_query_heads: 6, use_sinks: true, tag: sinks} + - {num_query_heads: 7, use_sinks: true, tag: sinks} + - {num_query_heads: 8, use_sinks: true, tag: sinks} + - {num_query_heads: 16, use_sinks: true, tag: sinks} + shapes: + - {knobs: gqa} + - {knobs: gqa_sinks} + - name: paged_unified.{dtype}_d{head_size}_bs{block_size}_g{num_query_heads}_{tag}.gfx942 + metadata: [dtype, head_size, block_size, num_query_heads, num_kv_heads, num_warps, block_m_per_warp, use_sinks] + vocabulary: + dtype: {bf16: BF16, fp16: FP16} + spec_order: [head_size, block_size, num_query_heads, num_kv_heads, dtype, use_sinks, sliding_window, has_softcap, num_warps, block_m_per_warp, runtime_layout] + spec_defaults: + num_kv_heads: 1 + use_sinks: false + sliding_window: 0 + has_softcap: false + num_warps: 4 + block_m_per_warp: 16 + runtime_layout: true + shape_axes: + dtype: [fp16, bf16] + head_size: [128] + block_size: [16, 32] + knob_sets: + gqa: + - {num_query_heads: 1} + - {num_query_heads: 2} + - {num_query_heads: 4} + - {num_query_heads: 5} + - {num_query_heads: 6} + - {num_query_heads: 7} + - {num_query_heads: 8} + - {num_query_heads: 16} + gqa_sinks: + - {num_query_heads: 1, use_sinks: true, tag: sinks} + - {num_query_heads: 2, use_sinks: true, tag: sinks} + - {num_query_heads: 4, use_sinks: true, tag: sinks} + - {num_query_heads: 5, use_sinks: true, tag: sinks} + - {num_query_heads: 6, use_sinks: true, tag: sinks} + - {num_query_heads: 7, use_sinks: true, tag: sinks} + - {num_query_heads: 8, use_sinks: true, tag: sinks} + - {num_query_heads: 16, use_sinks: true, tag: sinks} + shapes: + - {knobs: gqa} + - {knobs: gqa_sinks} + - name: paged_unified.{dtype}_d{head_size}_bs{block_size}_g{num_query_heads}_{tag}.gfx942 + metadata: [dtype, head_size, block_size, num_query_heads, num_kv_heads, num_warps, block_m_per_warp, use_sinks] + vocabulary: + dtype: {bf16: BF16, fp16: FP16} + spec_order: [head_size, block_size, num_query_heads, num_kv_heads, dtype, use_sinks, sliding_window, has_softcap, num_warps, block_m_per_warp, runtime_layout, tile_size] + spec_defaults: + num_kv_heads: 1 + use_sinks: false + sliding_window: 0 + has_softcap: false + num_warps: 4 + block_m_per_warp: 16 + runtime_layout: true + tile_size: 32 + shape_axes: + dtype: [fp16, bf16] + head_size: [128] + block_size: [64] + knob_sets: + gqa: + - {num_query_heads: 1} + - {num_query_heads: 2} + - {num_query_heads: 4} + - {num_query_heads: 5} + - {num_query_heads: 6} + - {num_query_heads: 7} + - {num_query_heads: 8} + - {num_query_heads: 16} + gqa_sinks: + - {num_query_heads: 1, use_sinks: true, tag: sinks} + - {num_query_heads: 2, use_sinks: true, tag: sinks} + - {num_query_heads: 4, use_sinks: true, tag: sinks} + - {num_query_heads: 5, use_sinks: true, tag: sinks} + - {num_query_heads: 6, use_sinks: true, tag: sinks} + - {num_query_heads: 7, use_sinks: true, tag: sinks} + - {num_query_heads: 8, use_sinks: true, tag: sinks} + - {num_query_heads: 16, use_sinks: true, tag: sinks} + shapes: + - {knobs: gqa} + - {knobs: gqa_sinks} + - name: paged_unified.{dtype}_d{head_size}_bs{block_size}_g{num_query_heads}_{tag}.gfx942 + metadata: [dtype, head_size, block_size, num_query_heads, num_kv_heads, num_warps, block_m_per_warp, use_sinks] + vocabulary: + dtype: {bf16: BF16, fp16: FP16} + spec_order: [head_size, block_size, num_query_heads, num_kv_heads, dtype, use_sinks, sliding_window, has_softcap, num_warps, block_m_per_warp, runtime_layout] + spec_defaults: + num_kv_heads: 1 + use_sinks: false + sliding_window: 0 + has_softcap: false + num_warps: 2 + block_m_per_warp: 16 + runtime_layout: true + shape_axes: + dtype: [fp16, bf16] + head_size: [256] + block_size: [16] + knob_sets: + gqa: + - {num_query_heads: 1} + - {num_query_heads: 2} + - {num_query_heads: 4} + - {num_query_heads: 5} + - {num_query_heads: 6} + - {num_query_heads: 7} + - {num_query_heads: 8} + - {num_query_heads: 16} + gqa_sinks: + - {num_query_heads: 1, use_sinks: true, tag: sinks} + - {num_query_heads: 2, use_sinks: true, tag: sinks} + - {num_query_heads: 4, use_sinks: true, tag: sinks} + - {num_query_heads: 5, use_sinks: true, tag: sinks} + - {num_query_heads: 6, use_sinks: true, tag: sinks} + - {num_query_heads: 7, use_sinks: true, tag: sinks} + - {num_query_heads: 8, use_sinks: true, tag: sinks} + - {num_query_heads: 16, use_sinks: true, tag: sinks} + shapes: + - {knobs: gqa} + - {knobs: gqa_sinks} + - name: paged_unified.{dtype}_d{head_size}_bs{block_size}_g{num_query_heads}_{tag}.gfx942 + metadata: [dtype, head_size, block_size, num_query_heads, num_kv_heads, num_warps, block_m_per_warp, use_sinks] + vocabulary: + dtype: {bf16: BF16, fp16: FP16} + spec_order: [head_size, block_size, num_query_heads, num_kv_heads, dtype, use_sinks, sliding_window, has_softcap, num_warps, block_m_per_warp, runtime_layout, tile_size] + spec_defaults: + num_kv_heads: 1 + use_sinks: false + sliding_window: 0 + has_softcap: false + num_warps: 2 + block_m_per_warp: 16 + runtime_layout: true + tile_size: 16 + shape_axes: + dtype: [fp16, bf16] + head_size: [256] + block_size: [32, 64] + knob_sets: + gqa: + - {num_query_heads: 1} + - {num_query_heads: 2} + - {num_query_heads: 4} + - {num_query_heads: 5} + - {num_query_heads: 6} + - {num_query_heads: 7} + - {num_query_heads: 8} + - {num_query_heads: 16} + gqa_sinks: + - {num_query_heads: 1, use_sinks: true, tag: sinks} + - {num_query_heads: 2, use_sinks: true, tag: sinks} + - {num_query_heads: 4, use_sinks: true, tag: sinks} + - {num_query_heads: 5, use_sinks: true, tag: sinks} + - {num_query_heads: 6, use_sinks: true, tag: sinks} + - {num_query_heads: 7, use_sinks: true, tag: sinks} + - {num_query_heads: 8, use_sinks: true, tag: sinks} + - {num_query_heads: 16, use_sinks: true, tag: sinks} + shapes: + - {knobs: gqa} + - {knobs: gqa_sinks} +- name: gfx950 + arch: [gfx950] + discriminator: gfx950 + kernel_defaults: + kind: rocke + source: kernels/gfx950/attention_tiled_2d.py + builder: build_unified_attention_2d_tiled + variants: + - name: paged_unified.{dtype}_d{head_size}_bs{block_size}_g{num_query_heads}_{tag}.gfx950 + metadata: [dtype, head_size, block_size, num_query_heads, num_kv_heads, num_warps, block_m_per_warp, use_sinks] + vocabulary: + dtype: {bf16: BF16, fp16: FP16} + spec_order: [head_size, block_size, num_query_heads, num_kv_heads, dtype, use_sinks, sliding_window, has_softcap, num_warps, block_m_per_warp, runtime_layout] + spec_defaults: + num_kv_heads: 1 + use_sinks: false + sliding_window: 0 + has_softcap: false + num_warps: 2 + block_m_per_warp: 16 + runtime_layout: true + shape_axes: + dtype: [fp16, bf16] + head_size: [64] + block_size: [16] + knob_sets: + gqa: + - {num_query_heads: 1} + - {num_query_heads: 2} + - {num_query_heads: 4} + - {num_query_heads: 5} + - {num_query_heads: 6} + - {num_query_heads: 7} + - {num_query_heads: 8} + - {num_query_heads: 16} + gqa_sinks: + - {num_query_heads: 1, use_sinks: true, tag: sinks} + - {num_query_heads: 2, use_sinks: true, tag: sinks} + - {num_query_heads: 4, use_sinks: true, tag: sinks} + - {num_query_heads: 5, use_sinks: true, tag: sinks} + - {num_query_heads: 6, use_sinks: true, tag: sinks} + - {num_query_heads: 7, use_sinks: true, tag: sinks} + - {num_query_heads: 8, use_sinks: true, tag: sinks} + - {num_query_heads: 16, use_sinks: true, tag: sinks} + shapes: + - {knobs: gqa} + - {knobs: gqa_sinks} + - name: paged_unified.{dtype}_d{head_size}_bs{block_size}_g{num_query_heads}_{tag}.gfx950 + metadata: [dtype, head_size, block_size, num_query_heads, num_kv_heads, num_warps, block_m_per_warp, use_sinks] + vocabulary: + dtype: {bf16: BF16, fp16: FP16} + spec_order: [head_size, block_size, num_query_heads, num_kv_heads, dtype, use_sinks, sliding_window, has_softcap, num_warps, block_m_per_warp, runtime_layout] + spec_defaults: + num_kv_heads: 1 + use_sinks: false + sliding_window: 0 + has_softcap: false + num_warps: 4 + block_m_per_warp: 16 + runtime_layout: true + shape_axes: + dtype: [fp16, bf16] + head_size: [64] + block_size: [32, 64] + knob_sets: + gqa: + - {num_query_heads: 1} + - {num_query_heads: 2} + - {num_query_heads: 4} + - {num_query_heads: 5} + - {num_query_heads: 6} + - {num_query_heads: 7} + - {num_query_heads: 8} + - {num_query_heads: 16} + gqa_sinks: + - {num_query_heads: 1, use_sinks: true, tag: sinks} + - {num_query_heads: 2, use_sinks: true, tag: sinks} + - {num_query_heads: 4, use_sinks: true, tag: sinks} + - {num_query_heads: 5, use_sinks: true, tag: sinks} + - {num_query_heads: 6, use_sinks: true, tag: sinks} + - {num_query_heads: 7, use_sinks: true, tag: sinks} + - {num_query_heads: 8, use_sinks: true, tag: sinks} + - {num_query_heads: 16, use_sinks: true, tag: sinks} + shapes: + - {knobs: gqa} + - {knobs: gqa_sinks} + - name: paged_unified.{dtype}_d{head_size}_bs{block_size}_g{num_query_heads}_{tag}.gfx950 + metadata: [dtype, head_size, block_size, num_query_heads, num_kv_heads, num_warps, block_m_per_warp, use_sinks] + vocabulary: + dtype: {bf16: BF16, fp16: FP16} + spec_order: [head_size, block_size, num_query_heads, num_kv_heads, dtype, use_sinks, sliding_window, has_softcap, num_warps, block_m_per_warp, runtime_layout] + spec_defaults: + num_kv_heads: 1 + use_sinks: false + sliding_window: 0 + has_softcap: false + num_warps: 4 + block_m_per_warp: 16 + runtime_layout: true + shape_axes: + dtype: [fp16, bf16] + head_size: [128, 256] + block_size: [16, 32, 64] + knob_sets: + gqa: + - {num_query_heads: 1} + - {num_query_heads: 2} + - {num_query_heads: 4} + - {num_query_heads: 5} + - {num_query_heads: 6} + - {num_query_heads: 7} + - {num_query_heads: 8} + - {num_query_heads: 16} + gqa_sinks: + - {num_query_heads: 1, use_sinks: true, tag: sinks} + - {num_query_heads: 2, use_sinks: true, tag: sinks} + - {num_query_heads: 4, use_sinks: true, tag: sinks} + - {num_query_heads: 5, use_sinks: true, tag: sinks} + - {num_query_heads: 6, use_sinks: true, tag: sinks} + - {num_query_heads: 7, use_sinks: true, tag: sinks} + - {num_query_heads: 8, use_sinks: true, tag: sinks} + - {num_query_heads: 16, use_sinks: true, tag: sinks} + shapes: + - {knobs: gqa} + - {knobs: gqa_sinks} diff --git a/projects/hipdnn/tools/IngestorGenerator/tests/test_gfx950_attention_dense_schema_gate.py b/projects/hipdnn/tools/IngestorGenerator/tests/test_gfx950_attention_dense_schema_gate.py new file mode 100644 index 000000000000..155154e7864b --- /dev/null +++ b/projects/hipdnn/tools/IngestorGenerator/tests/test_gfx950_attention_dense_schema_gate.py @@ -0,0 +1,72 @@ +# Copyright (c) Advanced Micro Devices, Inc., or its affiliates. +# SPDX-License-Identifier: MIT + +"""hipkernel:Gfx950AttentionDense stays below engine API 1.3.0 until its matcher declines +ragged operands and a declared tensor alignment itself. + +Its native graph_match checks neither a ragged_offset on Q/K/V/O nor a declared +alignment. hipDNN stamps a graph that uses either with min_required_engine_api_version +1.3.0, and GenericPlanBuilder::understandsGraph declines it only while the engine's +sdk_version is lower. The census suite TestGfx950AttentionDenseSchemaGate proves that +decline end to end, but it registers only where a build ships the engine for gfx950. +This pin runs in every build that runs the IngestorGenerator suite: the authored config, +its engine manifest and the committed UED all declare a version below 1.3.0. +""" + +from __future__ import annotations + +import json +from pathlib import Path + +import pytest +import yaml + +_ROOT = Path(__file__).resolve().parents[1] +_REPO = _ROOT.parents[3] +_CONFIGS = _ROOT / "configs" +_UED = ( + _REPO + / "dnn-providers" + / "hip-kernel-provider" + / "src" + / "engines" + / "kernel_ingestor_engine" + / "descriptors" + / "rocKE" + / "gfx950_attention_dense" + / "gfx950_attention_dense.ued.json" +) + +# The engine API level at which hipDNN stamps ragged and non-default-alignment graphs. +_RAGGED_AND_ALIGNMENT_API = (1, 3, 0) + + +def _version(text: str) -> tuple[int, ...]: + return tuple(int(part) for part in str(text).split(".")) + + +def _authored(name: str) -> str: + return yaml.safe_load((_CONFIGS / name).read_text(encoding="utf-8"))["engine"][ + "sdk_version" + ] + + +@pytest.mark.parametrize( + "source", + [ + "configs/gfx950_attention_dense.yaml", + "configs/gfx950_attention_dense.engine.yaml", + "gfx950_attention_dense.ued.json", + ], +) +def test_sdk_version_stays_below_the_ragged_and_alignment_api(source): + if source.endswith(".ued.json"): + declared = json.loads(_UED.read_text(encoding="utf-8"))["sdk_version"] + else: + declared = _authored(Path(source).name) + assert _version(declared) < _RAGGED_AND_ALIGNMENT_API, ( + f"{source} declares sdk_version {declared}: at 1.3.0 or above the schema gate " + "no longer keeps ragged and non-default-alignment SDPA graphs away from " + "hipkernel:Gfx950AttentionDense, whose graph_match checks neither. Raise it only " + "with explicit declines in the matcher." + )