Task Execution

[toc]


Command Overview

python3 -m ttk {kernel,aclnn,e2e,info,list} [options]
Subcommand Purpose
kernel AscendC kernel compile + NPU execute + precision compare
aclnn aclnn* C API call + precision compare
e2e PyTorch framework API end-to-end test (NPU/MLU/CPU)
info Query local Ascend NPU device info
list Preview test case names from CSV
python3 -m ttk -v                    # Show version
python3 -m ttk kernel --help         # Show help

Quick Start

# Kernel
python3 -m ttk kernel -i examples/case_store/kernel/mat_mul_v3.csv
python3 -m ttk kernel -i examples/case_store/kernel/add.csv -d
python3 -m ttk kernel -i examples/case_store/kernel/add.csv --co

# ACLNN
python3 -m ttk aclnn -i examples/case_store/aclnn/aclnn_cat.csv

# E2E (auto-selects available backend per configured hardware segment)
python3 -m ttk e2e -i examples/case_store/e2e/torch_add.csv
python3 -m ttk e2e -i examples/case_store/e2e/torch_add.csv --cpu

# Device info & case preview
python3 -m ttk info
python3 -m ttk list -i cases.csv --op add

E2E/ACLNN/Kernel Two-Stage Execution

# Prepare input and CPU golden without target API execution or comparison.
python3 -m ttk e2e -i cases.csv --plugin /path/to/assets \
  --no-prof --dump in,golden --dump-format bin \
  --manual-data-dirs /data/manual

# Restore prepared data, execute the target API, and compare.
python3 -m ttk e2e -i cases.csv --plugin /path/to/assets \
  --manual-data-dirs /data/manual

ACLNN uses the same options; add --plat=<target-soc> when a prepare host cannot detect the SoC. See Manual-Data Prepare and Replay for formats, typed-data filename validation, directory defaults, and option constraints.

Kernel uses the same stage selectors while preserving its execution-mode options:

python3 -m ttk kernel -i kernel_cases.csv --plugin /path/to/kernel_assets \
  -d=false -c=false -b=release \
  --no-prof --dump in,golden --dump-format bin \
  --manual-data-dirs /data/kernel_manual

python3 -m ttk kernel -i kernel_cases.csv --plugin /path/to/kernel_assets \
  -d=false -c=false -b=release \
  --manual-data-dirs /data/kernel_manual

Standalone Kernel --no-prof keeps its existing dry-run behavior. Only the exact --no-prof --dump in,golden pair selects prepare; --compile-only cannot be used with either manual-data stage.

Case Selection

Parameter Short Description Example
--testcase -t Filter by case name (comma-separated) -t add_01,add_02
--testcase-index --ti Filter by index --ti=1,3,5 or --ti=1-10
--testcase-count --tc Randomly pick N cases --tc=10
--operator --op Filter by operator name --op add,mat_mul_v3
--exclude-operator --no-op Exclude operator name --no-op concat_d
--priority Filter by priority range --priority=1-3
--rerun Rerun failed cases --rerun=precision_status

Device & Parallelism

Parameter Short Description Default
--device --dev Number of devices to use All
--device-whitelist Device whitelist None
--device-blacklist Device blacklist None
--process-count --pc Processes per device 1
--platform --plat SoC version Auto-detect
--proc-timeout Per-case timeout (seconds) 0 (unlimited)
--limit -l Memory limit per case (GB); skip if input+output exceeds 30

Precision Control

Parameter Description Options Default
--compare Comparison method close/stat_rel_err/cosine/binary/requant/cross_check Spec.tolerance routing (needs --plugin), else stat_rel_err
--input-dist Input distribution uniform/normal uniform
--seed Random seed (reproducible) Integer Random
--golden-mode Golden generation mode Enable/Disable/Promote Enable

See Result Analysis for comparison method details.

Debug & Diagnostics

Parameter Description Example
--dump Dump data: full/in/out/golden --dump full
--dump-format Dump format: bin/npy/pt/print --dump-format npy
--dump-on-fail Auto-dump all data on precision failure --dump-on-fail
--manual-data-dirs Prepare output or ordered replay search roots --manual-data-dirs /data/op
--single-log One log file per test case --single-log
--plugin External plugin path --plugin /path/to/plugin.py
--validate Validate CSV format only (skips compilation, input/golden generation, device execution) --validate

Output

Parameter Short Description Example
--output -o Output result CSV path -o results.csv
--title Custom output columns --title testcase_name,precision_status
--csv-preserve Preserve original CSV headers --csv-preserve

Kernel Compilation Control

Parameter Short Description Default
--dynamic -d Dynamic shape compilation; -d false to disable On
--const -c Static shape compilation Off
--binary -b Binary mode; -b release for released kernels Off
--compile-only --co Compile only, skip execution Off
--no-prof Kernel dry-run; with exact --dump in,golden, select manual-data prepare Off
--compile-opts Compile options (KEY=VALUE, can be specified multiple times) None
--tiling-run --tr Tiling run times 3
--reuse-hbm Each case runs 3 times on NPU by default; reuse same HBM memory to enable L2 Cache Off
--reserve-hbm Reserve HBM (MB) None
--clear-atomic Force clear output and workspace before execution Off
--clear-ub / --clear-l1 Fill UB / L1 with specified value before execution (default: 0) Off
--simt-ub / --simt-stack-dcu SIMT-mode UB / DCU stack size None
--force-block-dim Force block_dim value None

E2E-Specific Parameters

E2E mode runs through a unified Backend abstraction (framework_api/backends/); all backends share the same case parsing and precision comparison pipeline. The CPU backend is commonly used as the Golden source. The backend is auto-selected per the configured hardware segment (yaml frameworks.torch.<seg>); --cpu forces the CPU backend.

Two-Stage Selector

--no-prof --dump in,golden prepares input/CPU-golden data without calling the target API or Kernel. See the two-stage guide above for required combinations.

General Parameters

Parameter Short Description Default
--input -i CSV test case file (required)
--output -o Output result CSV path None
--seed Random seed Random
--print Print summary info On
--no-memory-check Skip host memory check Off
--proc-no-reuse New process per case Off
--task-prof Task-level profiling switch On
--po / --progress-output Progress output path None
--run Execution count 3 (onboard) / 1 (model)
--warmup Warmup before profiling On
--npu-timeout NPU execution timeout (ms) Unlimited