Skip to content

Keep the strided BF16 tile GEMM's fallback tier to its own contract - #415

Merged
AdaWorldAPI merged 1 commit into
masterfrom
ccr-8062bcc7-l7lkz9-strided
Nov 8, 2026
Merged

AdaWorldAPI merged 1 commit into
masterfrom
ccr-8062bcc7-l7lkz9-strided

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Problem

bf16_tile_gemm_16x16_packed_strided (#414) accepts any A buffer of at least 15·stride + K elements, and any K that is a multiple of 32, including 0. On hosts without AMX or AVX-512 BF16, two calls that satisfy those checks panicked in the decode+FMA tier:

  • A longer than 16·K at stride K. The fallback passed the whole slice to the polyfill, which requires exactly 16·K elements.
  • K = 0 with a nonzero stride. Gathering the rows called chunks_exact_mut(0).

The AMX and AVX-512 tiers already handle both cases. Codex reported both findings on #414 after it had merged.

Change

  • The fallback tier is now fallback_vnni, a function of its own, so its tests run on any host. A host with a tile tier otherwise never reaches it.
  • fallback_vnni passes only the 16 rows it uses, &a[..16·K], to the polyfill.
  • It returns early on K = 0, leaving C unchanged, as the tile tiers do.
  • Behaviour on the AMX and AVX-512 tiers is unchanged.

Validation

  • Two new tests drive the fallback tier directly. Both failed against the unchanged body: one at the polyfill's length assertion, the other at the chunks_exact_mut(0) panic. Both pass after the fix.
  • The K = 0 test also calls the public entry, which on this host takes the AMX tier.
  • All 16 bf16_tile_gemm tests pass on an AMX host.
  • cargo clippy --lib --tests -- -D warnings and the facet-stride guard (--diff origin/master) are clean.

Generated by Claude Code

On hosts without AMX or AVX-512 BF16, two calls the strided entry accepts
panicked in the decode+FMA tier: an A buffer longer than 16*K at stride
K (the polyfill requires exactly 16*K elements), and K = 0 with a nonzero
stride (chunks_exact_mut(0)). The fallback now passes only the 16 rows it
uses and returns early on K = 0, as the tile tiers already do. It is a
function of its own so its tests run on any host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMMWgnUU9g7Ldyn6sbk
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bc258584-5217-4b66-ba3e-423acfe66f49
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T00:56:43.207549Z c829a6e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants