-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,274 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ lib | ||
, emurt | ||
, fetchurl | ||
, _caseBuilders | ||
}: | ||
|
||
let | ||
checkpoint_bin = fetchurl { | ||
url = "https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin"; | ||
sha256 = "sha256-zVkGRNljhnorbloRB/UfrWY8QdecFJ++y7sflfqB9Jo="; | ||
}; | ||
|
||
tokenizer_bin = fetchurl { | ||
url = "https://github.com/karpathy/llama2.c/raw/b3c4b6c3c4bbff42e5211293280307019368ccb5/tokenizer.bin"; | ||
sha256 = "sha256-UKUu+CLunoPeXOnQvgoCWnc9AZQ39Ytf+dyvsGPs42E="; | ||
}; | ||
in | ||
|
||
_caseBuilders.mkIntrinsicCase { | ||
casePrefix = "perf"; | ||
caseName = "llama"; | ||
|
||
buildInputs = [ emurt ]; | ||
|
||
src = with lib.fileset; toSource { | ||
root = ./.; | ||
fileset = fileFilter (file: file.name != "default.nix") ./.; | ||
}; | ||
|
||
unpackPhase = '' | ||
cp $src -rT . | ||
chmod -R +w . | ||
''; | ||
|
||
postPatch = '' | ||
substituteInPlace extern_data.S \ | ||
--replace-fail '{{checkpoint_bin}}' ${checkpoint_bin} \ | ||
--replace-fail '{{tokenizer_bin}}' ${tokenizer_bin} | ||
''; | ||
|
||
srcs = [ | ||
"run.c" | ||
"trap.c" | ||
"utils.c" | ||
"extern_data.S" | ||
../../t1_main.S | ||
]; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.section .rodata | ||
.global checkpoint_data | ||
.type checkpoint_data, @object | ||
.align 4 | ||
checkpoint_data: | ||
.incbin "{{checkpoint_bin}}" # will be replaced on nix build | ||
checkpoint_end: | ||
.global checkpoint_size | ||
.type checkpoint_size, @object | ||
.align 4 | ||
checkpoint_size: | ||
.int checkpoint_end - checkpoint_data | ||
|
||
.section .rodata | ||
.global tokenizer_data | ||
.type tokenizer_data, @object | ||
.align 4 | ||
tokenizer_data: | ||
.incbin "{{tokenizer_bin}}" # will be replaced on nix build | ||
tokenizer_end: | ||
.global tokenizer_size | ||
.type tokenizer_size, @object | ||
.align 4 | ||
tokenizer_size: | ||
.int tokenizer_end - tokenizer_data |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern int checkpoint_size; | ||
extern float checkpoint_data[]; | ||
|
||
extern int tokenizer_size; | ||
extern float tokenizer_data[]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SECTIONS | ||
{ | ||
. = 0x20000000; | ||
.text : { *(.text) } | ||
.rodata : { *(.rodata) } | ||
.data : { *(.data) } | ||
.bss : { *(.bss) } | ||
.sbss : { *(.sbss) } | ||
.sdata : { *(.sdata) } | ||
.note.gnu.build-id : { *(.note.gnu.build-id) } | ||
} |
Oops, something went wrong.