FlashMLA: Efficient Multi-head Latent Attention Kernels
This report summarizes scanner evidence for deepseek-ai/FlashMLA, a C++ project with 13,063 GitHub stars. SynthScan examined 21,353 lines of code across 87 source files, recording 96 pattern matches distributed across 7 syntactic categories. The legacy adjusted pattern signal is 4.3 (Low pattern signal); it is not an authorship estimate.
Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.
Use each vector to guide manual verification of the underlying findings.
Can maintainers explain intent, assumptions, and trade-offs? 44 finding(s).
Are imports declared and package/API names verified? 48 finding(s).
Are wrappers, guards, and repeated structures necessary? 28 finding(s).
Which changes need focused human review? 96 finding(s).
This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.
Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.
This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.
The scanner identified 96 distinct pattern matches across 7 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/lib.py | 11 | CODE | |
| LOW | tests/kernelkit/__init__.py | 1 | CODE | |
| LOW | tests/kernelkit/__init__.py | 2 | CODE | |
| LOW | tests/kernelkit/__init__.py | 3 | CODE | |
| LOW | tests/kernelkit/__init__.py | 4 | CODE | |
| LOW | tests/kernelkit/__init__.py | 5 | CODE | |
| LOW | tests/kernelkit/__init__.py | 6 | CODE | |
| LOW | tests/kernelkit/__init__.py | 7 | CODE | |
| LOW | tests/kernelkit/__init__.py | 9 | CODE | |
| LOW | tests/kernelkit/__init__.py | 9 | CODE | |
| LOW | tests/kernelkit/__init__.py | 10 | CODE | |
| LOW | tests/kernelkit/__init__.py | 10 | CODE | |
| LOW | tests/kernelkit/__init__.py | 11 | CODE | |
| LOW | tests/kernelkit/__init__.py | 11 | CODE | |
| LOW | tests/kernelkit/__init__.py | 11 | CODE | |
| LOW | tests/kernelkit/__init__.py | 11 | CODE | |
| LOW | tests/kernelkit/__init__.py | 11 | CODE | |
| LOW | tests/kernelkit/__init__.py | 12 | CODE | |
| LOW | tests/kernelkit/__init__.py | 12 | CODE | |
| LOW | tests/kernelkit/__init__.py | 12 | CODE | |
| LOW | tests/kernelkit/__init__.py | 13 | CODE | |
| LOW | tests/kernelkit/__init__.py | 13 | CODE | |
| LOW | tests/kernelkit/__init__.py | 13 | CODE | |
| LOW | tests/kernelkit/__init__.py | 13 | CODE | |
| LOW | tests/kernelkit/__init__.py | 13 | CODE | |
| LOW | tests/kernelkit/__init__.py | 13 | CODE | |
| LOW | tests/kernelkit/__init__.py | 13 | CODE | |
| LOW | tests/kernelkit/__init__.py | 14 | CODE | |
| LOW | tests/kernelkit/__init__.py | 14 | CODE | |
| LOW | tests/kernelkit/__init__.py | 14 | CODE | |
| LOW | tests/kernelkit/__init__.py | 15 | CODE | |
| LOW | tests/kernelkit/__init__.py | 15 | CODE | |
| LOW | tests/kernelkit/__init__.py | 15 | CODE | |
| LOW | tests/kernelkit/__init__.py | 15 | CODE | |
| LOW | tests/kernelkit/__init__.py | 15 | CODE | |
| LOW | tests/kernelkit/bench.py | 1 | CODE | |
| LOW | tests/kernelkit/utils.py | 5 | CODE | |
| LOW | tests/kernelkit/utils.py | 5 | CODE | |
| LOW | tests/kernelkit/compare.py | 1 | CODE | |
| LOW | tests/kernelkit/compare.py | 1 | CODE | |
| LOW | tests/kernelkit/compare.py | 1 | CODE | |
| LOW | flash_mla/__init__.py | 3 | CODE | |
| LOW | flash_mla/__init__.py | 3 | CODE | |
| LOW | flash_mla/__init__.py | 3 | CODE | |
| LOW | flash_mla/__init__.py | 3 | CODE | |
| LOW | flash_mla/__init__.py | 3 | CODE | |
| LOW | flash_mla/__init__.py | 3 | CODE | |
| LOW | flash_mla/__init__.py | 12 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | setup.py | 269 | def get_build_target_platform() -> str: | CODE |
| LOW | tests/test-fused-norm-rope-attn-rope-cast.py | 83 | def ref_fused_norm_rope_attn_rope_cast_fwd(p: TestParam, t: Testcase, enable_q_norm: bool, cos_sin_table: torch.Tensor, | CODE |
| LOW | tests/test-fused-norm-rope-attn-rope-cast.py | 107 | def ref_fused_norm_rope_attn_rope_cast_decode( | CODE |
| LOW | tests/test-fused-norm-rope-attn-rope-cast.py | 238 | def run_fused_norm_rope_attn_rope_cast_fwd(): | CODE |
| LOW | tests/test-fused-norm-rope-attn-rope-cast.py | 335 | def run_fused_norm_rope_attn_rope_cast_decode(): | CODE |
| LOW | tests/lib.py | 20 | def get_current_compute_capability() -> Tuple[int, int]: | CODE |
| LOW | tests/lib.py | 268 | def get_kvcache_for_flash_mla(self) -> torch.Tensor: | CODE |
| LOW | tests/lib.py | 284 | def generate_testcase_for_decode(t: TestParam) -> TestcaseForDecode: | CODE |
| LOW | tests/lib.py | 463 | def count_flop_and_mem_vol_for_decode(p: TestParam, t: TestcaseForDecode) -> FlopsAndMemVolStatisticsForDecode: | CODE |
| LOW | tests/kernelkit/build.py | 17 | def check_kernel_reg_spill_in_artifact(artifact_path: str, stack_baseline: int = 0, quiet: bool = False, suppress_checki | CODE |
| LOW⚡ | tests/kernelkit/generate.py | 3 | def _get_new_non_contiguous_tensor_shape(shape): | CODE |
| LOW⚡ | tests/kernelkit/generate.py | 10 | def gen_non_contiguous_randn_tensor(shape, *args, **kwargs): | CODE |
| LOW⚡ | tests/kernelkit/generate.py | 16 | def gen_non_contiguous_tensor(shape, *args, **kwargs): | CODE |
| LOW | tests/kernelkit/bench.py | 24 | def profiler_range_start_marker_kernel(): | CODE |
| LOW | tests/kernelkit/bench.py | 27 | def _run_profiler_range_start_marker_kernel(): | CODE |
| LOW | tests/kernelkit/compare.py | 7 | def check_is_bitwise_equal_comparator(ans: torch.Tensor, ref: torch.Tensor, result: torch.Tensor): | CODE |
| LOW | tests/kernelkit/compare.py | 107 | def check_is_allclose_comparator(name: str, ans: torch.Tensor, ref: torch.Tensor, out: torch.Tensor, abs_tol: float = 1e | CODE |
| LOW | flash_mla/flash_mla_interface.py | 237 | def _flash_attn_varlen_forward( | CODE |
| LOW | flash_mla/flash_mla_interface.py | 286 | def _flash_attn_varlen_backward( | CODE |
| LOW | flash_mla/flash_mla_interface.py | 458 | def flash_attn_varlen_qkvpacked_func( | CODE |
| LOW | flash_mla/flash_mla_interface.py | 505 | def flash_attn_varlen_kvpacked_func( | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | csrc/params.h | 1 | #pragma once | COMMENT |
| LOW | csrc/params.h | 21 | struct bf16; | COMMENT |
| LOW | csrc/api/common.h | 1 | #pragma once | COMMENT |
| LOW | …100/prefill/sparse/fwd_for_small_topk/head128/config.h | 1 | #pragma once | COMMENT |
| LOW | csrc/3rdparty/kerutils/include/kerutils/host/host.h | 1 | #pragma once | COMMENT |
| LOW | …kerutils/include/kerutils/supplemental/torch_tensors.h | 61 | #define KU_CHECK_DEVICE(tensor) TORCH_CHECK(ku::_check_optional_tensor(tensor, [](const at::Tensor& t) { return t.device | COMMENT |
| LOW | csrc/3rdparty/kerutils/include/kerutils/common/common.h | 1 | #pragma once | COMMENT |
| LOW | …rdparty/kerutils/include/kerutils/device/cuda/common.h | 41 | COMMENT | |
| LOW | …rdparty/kerutils/include/kerutils/device/cuda/common.h | 61 | #define KERUTILS_ENABLE_SM100A | COMMENT |
| LOW | csrc/ascend_kernels/prefill/sparse/config.h | 101 | int32_t indices[INDEX_BLOCK_SIZE]; | COMMENT |
| LOW | tests/__init__.py | 1 | # We use this `__init__.py` to let `setup.py` be able to import `tests.kernelkit` | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | setup.py | 92 | CODE | |
| LOW | setup.py | 115 | CODE | |
| LOW | tests/lib.py | 68 | CODE | |
| LOW | tests/quant.py | 58 | CODE | |
| LOW | tests/quant.py | 139 | CODE | |
| LOW | tests/kernelkit/bench.py | 112 | CODE | |
| LOW | tests/kernelkit/bench.py | 177 | CODE | |
| LOW | tests/kernelkit/bench.py | 264 | CODE | |
| LOW | tests/kernelkit/bench.py | 51 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | setup.py | 294 | except Exception: | CODE |
| MEDIUM | setup.py | 289 | def get_version() -> str: | CODE |
| LOW | tests/kernelkit/bench.py | 279 | except Exception as e: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/quant.py | 194 | CODE | |
| LOW | tests/kernelkit/bench.py | 110 | CODE | |
| LOW | flash_mla/flash_mla_interface.py | 59 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | flash_mla/__init__.py | 14 | __all__ = [ | CODE |