Add SFC-based GEMM kernel#72
Open
jopperm wants to merge 6 commits into
Open
Conversation
adam-smnk
reviewed
Jun 1, 2026
Collaborator
There was a problem hiding this comment.
nit: I'd throw it into a separate subdir. Otherwise, it'll get a bit lost among other 100 kernels.
Not sure yet how we'd want to organize such helpers so maybe backends/triton/cpu/utils for now?
Collaborator
There was a problem hiding this comment.
nit: This could also go to a subdir for better visibility but could also stay as is as it's a "helper" kernel. Up to you.
| import torch | ||
| import torch.nn as nn | ||
|
|
||
| sys.path.insert(0, str(Path(__file__).parent)) |
| # Data is blocked into contiguous chunks of memory. Neighboring blocks in the K | ||
| # dimension will also be neighboring in memory. | ||
| @triton.jit | ||
| def _block_transpose_kernel( |
Collaborator
There was a problem hiding this comment.
nit: it'd call it ...block_pack... to consistent with the whole block packing naming we use elsewhere
|
|
||
| for ik in range(blocking_factor_k): | ||
| _sfc_matmul_kernel[(BLOCKS_M * BLOCKS_N,)]( | ||
| a, |
Collaborator
There was a problem hiding this comment.
Shouldn't A be block packed too?
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.
Candidate implementation for a high-performance CPU kernel using space-filling curves.