Uh oh!
There was an error while loading. Please reload this page.
feat: qkv fusing - #75
Conversation
Uh oh!
There was an error while loading. Please reload this page.
2850640 to
aa361d1CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
sharpenb
left a comment
There was a problem hiding this comment.
Thanks for the PR! I left some comments :)
nifleisch
left a comment
There was a problem hiding this comment.
Still awesome PR! I only have one small remark about the ModelContext.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
9e5f43b to
fc95279Compare
sharpenb
left a comment
There was a problem hiding this comment.
Looks very good. It can be merged after renaming and fixing the safe_memory_cleanup :)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
davidberenstein1957
commented
May 15, 2025
cbffcc4 to
0c7d7a7Compare… removed from cuda device after smashing
0c7d7a7 to
6f5a331Compare
Description
This PR introduces a new family of algorithm:$n$ matrices together (eg $W_{large}=[W_{small}, \dots, W_{small}]$ ) and perform a single $W_{large} \cdot x$ product instead of $n$ smaller $W _{small} \cdot x$ products.
FUSERFACTORIZER !The general idea behind matrix fusing is to concatenate
There is no memory gains. And, in general, there is no latency gains.
However, when combined with quantization, matrix fusing can enable speedups (see huggingface/diffusers#9185)
The main changes in the code are:
FUSERFACTORIZERin the newfusingfactorizingfolder;fuserfactorizer for qkv matrices fordiffusersmodels;diffuserspackage that are compatible with fusing (ie have some FusedAttention processors);Related Issue
Fixes #(issue number)
Type of Change
How Has This Been Tested?
I have added a unit test for the new qkv fuser on sdv1.4.
Checklist
Additional Notes