-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Metal: Pre-process gf4 weights in memory to make matmul a little faster
To accelerate matmul further we need a slightly different order and structure of bits, and it's getting relatively expensive to convert this on the fly during a matmul, so we now shuffle the gf4 weight bits in memory. This allows us (for now) to remove a XOR, and with another small tweak wrt bit math we get a ~2% speedup. Slightly more should be possible if we also change the bit order, although we need to be careful to keep fp8 scale fast to decode, so that will have to happen separately.
- Loading branch information
Showing
2 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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