Make examples slightly more idiomatic and aligned#228
Merged
Conversation
Matches the PermutedDimsArray override so a view of a CuArray can be passed directly to a Tile kernel without Adapt trying to wrap a non-AbstractArray TileArray back into a SubArray.
- moe: drop the unsafe_copy2d! workaround that physically split AB into two halves, in favor of two views — matches MoE.py's AB.chunk(2, dim=-1) and now that @cuda backend=cuTile accepts SubArrays it's the cleaner expression. Side effect: -2.3% wall on the benchmark (0.944 -> 0.922 ms) because the copies are gone. - layernorm: remove layer_norm_bwd_dx, an early-development simplified backward that has no counterpart in LayerNorm.py and isn't invoked by run().
Each kernel was subtracting 1 from a 1-indexed bid to do modular arithmetic, then adding 1 back at every load/index site. Push the conversion inside the swizzle helper (matmul, moe) so the kernel body stays 1-indexed throughout, and use cld/mod1 for fmha's batch/head split which gives 1-indexed results directly from a 1-indexed bid_y. Also collapse moe's (token_ids - 1) ÷ replicas + 1 to cld.(token_ids, replicas).
Re-measured on RTX 5080, tileiras 13.2.51. Most kernels within ±2% of the previous reading. MoE improved from 27.0 to 27.7 TFLOPS thanks to the view()-based AB split. Recorded each kernel solo because in-suite runs are sensitive to GPU clock ramp-up — FFT in particular reads ~10% slower in-suite than solo (kernel itself is unchanged, this is a boost-clock interaction).
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.
No description provided.