dc3fb02aed
- CLI: --verify-data flag enables Phase 2 data verification (ADR-0020) - Tensor.data: returns actual numpy values (verify-data) or zeros placeholder - Tensor.__repr__: shows value summary or data=N/A (placeholder) - DataExecutor: ThreadPoolExecutor for same-timestamp parallel op execution - BenchResult.engine: exposes op_log/memory_store for Phase 2 access Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
"""Tests for --verify-data CLI flag (Phase 1 verification)."""
|
|
import kernbench.cli.main as cli_main
|
|
|
|
|
|
def test_cli_verify_data_flag_parsed(monkeypatch):
|
|
"""--verify-data flag is parsed and stored as True."""
|
|
|
|
def fake_cmd_run(args) -> int:
|
|
assert args.verify_data is True
|
|
return 0
|
|
|
|
monkeypatch.setattr(cli_main, "cmd_run", fake_cmd_run)
|
|
rc = cli_main.main([
|
|
"run", "--topology", "topology.yaml", "--bench", "qkv_gemm",
|
|
"--verify-data",
|
|
])
|
|
assert rc == 0
|
|
|
|
|
|
def test_cli_verify_data_flag_default(monkeypatch):
|
|
"""Without --verify-data, flag defaults to False."""
|
|
|
|
def fake_cmd_run(args) -> int:
|
|
assert args.verify_data is False
|
|
return 0
|
|
|
|
monkeypatch.setattr(cli_main, "cmd_run", fake_cmd_run)
|
|
rc = cli_main.main([
|
|
"run", "--topology", "topology.yaml", "--bench", "qkv_gemm",
|
|
])
|
|
assert rc == 0
|
|
|
|
|
|
def test_cmd_run_verify_data_enables_engine():
|
|
"""--verify-data runs full pipeline with enable_data=True and DataExecutor."""
|
|
rc = cli_main.main([
|
|
"run", "--topology", "topology.yaml", "--bench", "qkv_gemm",
|
|
"--device", "sip:0", "--verify-data",
|
|
])
|
|
assert rc == 0
|
|
|
|
|
|
def test_cmd_run_without_verify_data_no_op_log():
|
|
"""Without --verify-data, engine runs in timing-only mode (no op_log)."""
|
|
rc = cli_main.main([
|
|
"run", "--topology", "topology.yaml", "--bench", "qkv_gemm",
|
|
"--device", "sip:0",
|
|
])
|
|
assert rc == 0
|