Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions setup_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ def gen_code():
shutil.copyfile(os.path.join(pretuned_kernels, "bitnet-lut-kernels-tl2.h"), "include/bitnet-lut-kernels.h")
if get_model_name() == "bitnet_b1_58-large":
run_command([sys.executable, "utils/codegen_tl2.py", "--model", "bitnet_b1_58-large", "--BM", "256,128,256", "--BK", "96,192,96", "--bm", "32,32,32"], log_step="codegen")
elif get_model_name().startswith("Falcon3"):
run_command([sys.executable, "utils/codegen_tl2.py", "--model", get_model_name(), "--BM", "256,128,256,128", "--BK", "96,96,96,96", "--bm", "32,32,32,32"], log_step="codegen")
elif get_model_name() in llama3_f3_models:
run_command([sys.executable, "utils/codegen_tl2.py", "--model", "Llama3-8B-1.58-100B-tokens", "--BM", "256,128,256,128", "--BK", "96,96,96,96", "--bm", "32,32,32,32"], log_step="codegen")
elif get_model_name() == "bitnet_b1_58-3B":
Expand Down Expand Up @@ -239,6 +241,8 @@ def signal_handler(sig, frame):
if __name__ == "__main__":
signal.signal(signal.SIGINT, signal_handler)
args = parse_args()
if args.quant_type == "tl2":
COMPILER_EXTRA_ARGS["x86_64"] = ["-DBITNET_X86_TL2=ON"]
Path(args.log_dir).mkdir(parents=True, exist_ok=True)
logging.basicConfig(level=logging.INFO)
main()
30 changes: 29 additions & 1 deletion utils/codegen_tl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,35 @@ def get_three_k_two_k(K, bk):
"Llama3-8B-1.58-100B-tokens" : [[14336, 4096],
[4096, 14336],
[1024, 4096],
[4096, 4096]]
[4096, 4096]],
"Falcon3-10B-Instruct-1.58bit" : [[23040, 3072],
[3072, 23040],
[1024, 3072],
[3072, 3072]],
"Falcon3-10B-1.58bit" : [[23040, 3072],
[3072, 23040],
[1024, 3072],
[3072, 3072]],
"Falcon3-7B-Instruct-1.58bit" : [[23040, 3072],
[3072, 23040],
[1024, 3072],
[3072, 3072]],
"Falcon3-7B-1.58bit" : [[23040, 3072],
[3072, 23040],
[1024, 3072],
[3072, 3072]],
"Falcon3-3B-Instruct-1.58bit" : [[9216, 3072],
[3072, 9216],
[1024, 3072],
[3072, 3072]],
"Falcon3-3B-1.58bit" : [[9216, 3072],
[3072, 9216],
[1024, 3072],
[3072, 3072]],
"Falcon3-1B-Instruct-1.58bit" : [[8192, 2048],
[2048, 8192],
[1024, 2048],
[2048, 2048]],
}

parser = argparse.ArgumentParser(description='gen impl')
Expand Down