feat(ops): mt_cast_f32_bf16 + mt_add_rms_norm_f16norm (carved from #13) - #31
Merged
Conversation
TheTom
force-pushed
the
ek/kernel-reorg-steel
branch
from
June 22, 2026 21:36
ffad7fc to
6a2035a
Compare
Two ops kernels carved from the NVFP4/CUDA work, conformed to the
kernels/ops/ reorg with mt_ names:
mt_cast_f32_bf16 f32 to bf16 narrowing cast, sibling of
mt_cast_f32_f16. The reverse bf16 to f32 widening
is already covered by the generic mt_cast_to_f32.
mt_add_rms_norm_f16norm fused add + RMSNorm with an f16 normed output,
residual stream stays f32. Folds the standalone
cast_f32_f16(normed) into the producer epilogue.
Bit-identical to add_rms_norm(f32) -> cast_f32_f16.
Both land in kernels/ops/unary.rs next to their f32/f16 siblings.
cargo check -p metaltile-std green.
TheTom
force-pushed
the
pr13/p7-ops-cast-addrmsnorm-f16
branch
from
June 22, 2026 22:05
73ed415 to
2b0cd4f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the kernels/ops reorg (#18), carving the two genuinely-novel ops kernels out of the NVFP4/CUDA kitchen-sink branch (#13). Conformed to the reorg:
mt_names, placed inkernels/ops/unary.rsnext to their siblings.Kernels
mt_cast_f32_bf16, f32 to bf16 narrowing cast, sibling ofmt_cast_f32_f16. For models whose residual stream / cache dtype is bf16 (wider exponent range than f16). The reverse bf16 to f32 widening is already covered by the genericmt_cast_to_f32, so only the narrowing direction is added.mt_add_rms_norm_f16norm, fused add + RMSNorm with an f16 normed output, residual stream stays f32 (no narrowing drift over long decodes). Folds the standalonecast_f32_f16(normed)into the producer epilogue, saving one cast dispatch per residual-add+norm pair on bf16/f16-activation paths. Bit-identical toadd_rms_norm(f32) -> cast_f32_f16.Context
Audit of #13 found that most of its std-kernel surface is pre-reorg parallel snapshots already superseded by the reorg (format-axis fold, renamed dsv4/sgload kernels, etc). These two ops kernels are the only std additions in #13 that are not present anywhere in the reorg tree, so they get a home here. The CUDA/NVFP4 backend itself is carved separately.
cargo check -p metaltile-stdgreen on macOS (Metal DSL).