88model = '../gguf/Llama-3.2-1B-Instruct-Q4_0.gguf'
99cli_pref = f'cd { pkg_path } && LD_LIBRARY_PATH={ lib_path } ADSP_LIBRARY_PATH={ lib_path } { bin_path } '
1010
11+
1112def run_cmd (cmd ):
1213 p = subprocess .run (cmd , text = True , stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
1314 sys .stdout .write (p .stdout )
1415 assert (p .returncode == 0 )
1516
17+
1618@pytest .mark .dependency ()
1719def test_install ():
18- run_cmd ([ 'adb' , 'push' , 'llama.cpp' , f'{ tmp_path } ' ])
19- run_cmd ([ 'adb' , 'shell' , f'chmod 755 { bin_path } /*' ])
20+ run_cmd (['adb' , 'push' , 'llama.cpp' , f'{ tmp_path } ' ])
21+ run_cmd (['adb' , 'shell' , f'chmod 755 { bin_path } /*' ])
22+
2023
2124## Basic cli tests
2225def run_llama_cli (dev , opts ):
@@ -25,30 +28,35 @@ def run_llama_cli(dev, opts):
2528 f'-p "what is the most popular cookie in the world?\n Please provide a very brief bullet point summary.\n Begin your answer with **BEGIN**."'
2629 ])
2730
31+
2832@pytest .mark .dependency (depends = ['test_install' ])
2933def test_llama_cli_cpu ():
3034 run_llama_cli ('none' , '-ctk q8_0 -ctv q8_0 -fa on' )
3135
36+
3237@pytest .mark .dependency (depends = ['test_install' ])
3338def test_llama_cli_gpu ():
3439 run_llama_cli ('GPUOpenCL' , '-fa on' )
3540
41+
3642@pytest .mark .dependency (depends = ['test_install' ])
3743def test_llama_cli_npu ():
3844 run_llama_cli ('HTP0' , '-ctk q8_0 -ctv q8_0 -fa on' )
3945
46+
4047## Basic bench tests
4148def run_llama_bench (dev ):
42- run_cmd ([ 'adb' , 'shell' ,
43- f'{ cli_pref } /llama-bench -m { model } --device { dev } -ngl 99 --batch-size 128 -t 4 -p 128 -n 32'
44- ])
49+ run_cmd (['adb' , 'shell' , f'{ cli_pref } /llama-bench -m { model } --device { dev } -ngl 99 --batch-size 128 -t 4 -p 128 -n 32' ])
50+
4551
4652@pytest .mark .dependency (depends = ['test_install' ])
4753def test_llama_bench_cpu ():
4854 run_llama_bench ('none' )
4955
56+
5057def test_llama_bench_gpu ():
5158 run_llama_bench ('GPUOpenCL' )
5259
60+
5361def test_llama_bench_npu ():
5462 run_llama_bench ('HTP0' )
0 commit comments