zackliqcom commited on
Commit
3b316a5
·
verified ·
1 Parent(s): 6ec1d3e

Delete run_backend_ops.py

Browse files
Files changed (1) hide show
  1. run_backend_ops.py +0 -73
run_backend_ops.py DELETED
@@ -1,73 +0,0 @@
1
- # ---------------------------------------------------------------------
2
- # Copyright (c) 2025 Qualcomm Technologies, Inc. and/or its subsidiaries.
3
- # SPDX-License-Identifier: BSD-3-Clause
4
- # ---------------------------------------------------------------------
5
- """
6
- On-device test-backend-ops runner for llama.cpp (HTP0 backend).
7
- Linux/IoT device version (QCS9075M, etc.)
8
-
9
- Executed by QDC's test framework on the QDC runner.
10
- The runner has SSH access to the allocated Linux device.
11
- """
12
-
13
- import os
14
- import sys
15
-
16
- import pytest
17
-
18
- from utils import BIN_PATH, CMD_PREFIX, push_bundle_if_needed, run_shell_command, verify_binary_exists, write_qdc_log
19
-
20
-
21
- @pytest.fixture(scope="session", autouse=True)
22
- def install():
23
- """Push llama_cpp_bundle to the device if needed."""
24
- binary_path = f"{BIN_PATH}/test-backend-ops"
25
- push_bundle_if_needed(binary_path)
26
-
27
- # Verify binary exists and is executable
28
- if not verify_binary_exists(binary_path):
29
- raise RuntimeError(f"Required binary not found or not executable: {binary_path}")
30
-
31
-
32
- @pytest.mark.parametrize("type_a", ["mxfp4", "fp16", "q4_0"])
33
- def test_backend_ops_htp0(type_a):
34
- print(f"[TEST] Running backend-ops test for type_a={type_a}")
35
-
36
- # Double-check binary exists before running (paranoid check)
37
- binary = f"{BIN_PATH}/test-backend-ops"
38
- if not verify_binary_exists(binary):
39
- pytest.fail(f"Binary disappeared between setup and test execution: {binary}")
40
-
41
- cmd = f"{CMD_PREFIX} GGML_HEXAGON_HOSTBUF=0 GGML_HEXAGON_EXPERIMENTAL=1 {BIN_PATH}/test-backend-ops -b HTP0 -o MUL_MAT"
42
- if type_a == "q4_0":
43
- cmd += r' -p "^(?=.*type_a=q4_0)(?!.*type_b=f32,m=576,n=512,k=576).*$"'
44
- else:
45
- cmd += f" -p type_a={type_a}"
46
-
47
- print(f"[TEST] Executing test-backend-ops with type_a={type_a}")
48
- result = run_shell_command(
49
- cmd,
50
- check=False,
51
- )
52
-
53
- # Save log regardless of pass/fail
54
- write_qdc_log(f"backend_ops_{type_a}.log", result.stdout or "")
55
-
56
- if result.returncode != 0:
57
- print(f"[TEST FAILED] test-backend-ops type_a={type_a} failed with exit code {result.returncode}")
58
- # Print last 50 lines of output for debugging
59
- if result.stdout:
60
- lines = result.stdout.split("\n")
61
- print("[TEST FAILED] Last 50 lines of output:")
62
- print("\n".join(lines[-50:]))
63
-
64
- assert result.returncode == 0, f"test-backend-ops type_a={type_a} failed (exit {result.returncode})"
65
- print(f"[TEST PASSED] type_a={type_a}")
66
-
67
-
68
- if __name__ == "__main__":
69
- ret = pytest.main(["-s", "--junitxml=results.xml", os.path.realpath(__file__)])
70
- if os.path.exists("results.xml"):
71
- with open("results.xml") as f:
72
- write_qdc_log("results.xml", f.read())
73
- sys.exit(ret)