[feat] Add TL2 (LUT) support for Falcon3 family models & fix setup_env.py flag#550
Open
7shi wants to merge 2 commits intomicrosoft:mainfrom
Open
[feat] Add TL2 (LUT) support for Falcon3 family models & fix setup_env.py flag#5507shi wants to merge 2 commits intomicrosoft:mainfrom
7shi wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Author
|
@microsoft-github-policy-service agree |
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.
Description
Although the
README.mdstates that TL2 (LUT) inference is supported for the Falcon3 family on x86 CPUs,setup_env.pyandutils/codegen_tl2.pywere missing the required matrix shapes and block configurations for these models. As a result, attempting to build or run Falcon3 with-q tl2would result in aNotImplementedErrorduring the GGUF conversion process, or yield garbage output due to mismatched tensor dimensions in the generated C++ kernels.This PR properly implements the TL2 code generation parameters for the Falcon3 family and fixes a hardcoded compiler flag that was preventing the TL2 kernel from compiling.
Note regarding TL1 (ARM):
The same underlying issue likely affects the TL1 (ARM) path in
setup_env.pyandutils/codegen_tl1.py. However, since I do not have access to an ARM testing environment to verify the mathematical correctness and stability of the generated kernels, the fix for TL1 has been intentionally omitted from this PR.Changes Made
ModelShapeDictinutils/codegen_tl2.pyto include the exact[M, K]dimensions for all Falcon3 models (10B, 7B, 3B, 1B) for both theInstructandBasevariants.gen_code()insetup_env.pyto intercept models starting withFalcon3and pass the mathematically optimal block sizes (--BM 256,128,256,128 --BK 96,96,96,96 --bm 32,32,32,32) to satisfy the LUT kernel constraints.setup_env.py,COMPILER_EXTRA_ARGShardcoded-DBITNET_X86_TL2=OFFregardless of the user's input. Modified the execution block to dynamically set-DBITNET_X86_TL2=ONwhen the-q tl2argument is explicitly provided.Testing
tiiuae/Falcon3-7B-Instruct-1.58bitand other Falcon3 models with the-q tl2flag.