Repository navigation
[apps] Add LLM kernels (RMSNorm, LayerNorm, SwiGLU, GeGLU) and fuse cos FMAs - #553
Merged
Merged
Conversation
… cos with fused FMA operation
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.
This PR adds four LLM kernels: the normalizations RMSNorm and LayerNorm, and the gated activations SwiGLU and GeGLU (FP32), and fuses the multiply-add pairs of the
coskernel into FMA instructions. It also fixes a race in the CI artifact clean-up.Each new kernel sweeps its size (hidden size
dfor the normalizations, vector length for the gated activations), reports cycles and FLOP/cycle, and checks the full-size result against golden data. SwiGLU and GeGLU use the existing intrinsic__exp_2xf32; GeGLU uses the tanh approximation of GELU. All five apps are added to the CI simulation matrix.The clean-up jobs deleted artifacts that later jobs still needed:
clean-up-compile-runsremovedbenchmark-<config>oncesimulatefinished, sorooflinecould fail when abenchmarkjob finished later. Re-runningrooflinealone could then never pass.clean-uplikewise removedtc-llvm, whichbenchmarkandcheck-clang-formatdownload. Both clean-up jobs now also wait for those jobs.Changelog
Fixed
clean-upalso waits forbenchmarkandcheck-clang-format, andclean-up-compile-runsforbenchmarkandroofline, so no job loses an artifact it still needsAdded
apps/rmsnorm,apps/layernorm,apps/swiglu,apps/geglu, with their default arguments inapps/common/default_args.mkcos,rmsnorm,layernorm,swigluandgegluin the CIsimulatematrixChanged
apps/cos/kernel/cos.h: 9 fused operations per element (vfmacc×3,vfmadd×5,vfnmsac×1) in both the FP64 and FP32 pathsapps/.gitignore: ignore the generated `apps/*/data.SChecklist