backend#

Measures backend test cases selected by a regular expression and optionally writes a report. Requires a build with backend tests and kernels enabled.

python -m onnx_light backend --help

See also Run a backend test case with the reference evaluator.

Command-line reference#

    usage: onnx-light backend [-h] [--regex PATTERN] [--mode {test,benchmark}]
                              [--generate-benchmark-expected-outputs]
                              [--include-big] [--repeat REPEAT] [--warmup WARMUP]
                              [--max-repeat-time SECONDS] [--timeout SECONDS]
                              [--parameter NAME=default,VALUE,...]
                              [--criterion {average,sum,median,average-speedup,median-speedup,max-speedup,max-latency}]
                              [--kernel KERNEL] [--dtype DTYPE]
                              [--impl IMPLEMENTATION] [--library LIBRARY] [--json]
                              [--output PATH] [--save-models DIRECTORY]
    
    options:
      -h, --help            show this help message and exit
      --regex PATTERN       Select test case names with an ECMAScript regular
                            expression (default: all).
      --mode {test,benchmark}
                            Generate correctness or benchmark-sized cases
                            (default: test).
      --generate-benchmark-expected-outputs
                            Generate reference outputs for benchmark cases,
                            enabling correctness validation at the cost of the
                            output oracle. Benchmark cases are input-only by
                            default.
      --include-big         Include cases whose name contains '_big_'.
      --repeat REPEAT       Maximum measured iterations per case (default: 10 per
                            CPU).
      --warmup WARMUP       Maximum unmeasured warm-up iterations per case
                            (default: 2 per CPU).
      --max-repeat-time SECONDS
                            Maximum cumulative time for each warm-up and measured
                            phase (default: 1).
      --timeout SECONDS     Stop and mark a backend case after this many seconds
                            (default: 2).
      --parameter NAME=default,VALUE,...
                            Compare explicit integer tuning values without
                            changing the machine cache; repeat the option to
                            evaluate the Cartesian product of multiple parameters;
                            requires --kernel, --dtype, and --impl.
      --criterion {average,sum,median,average-speedup,median-speedup,max-speedup,max-latency}
                            Metric used to select the best parameter set; required
                            with --parameter.
      --kernel KERNEL       Select the kernel tuning schema used by --parameter.
      --dtype DTYPE         Select the ONNX element type of the tuning schema used
                            by --parameter.
      --impl IMPLEMENTATION
                            Select the implementation used by --parameter.
      --library LIBRARY     Select the tuning library used by --parameter
                            (default: onnx_light).
      --json                Print the complete machine-readable report.
      --output PATH, -o PATH
                            Write case timings as CSV or XLSX, selected by the
                            file extension.
      --save-models DIRECTORY
                            Save each completed test as one self-contained <test-
                            name>.onnx file.
    
    examples:
      Measure matching correctness cases:
        python -m onnx_light backend --regex ".*not.*"
    
      Export timings and machine information to XLSX:
        python -m onnx_light backend --regex ".*not.*" --output backend-not.xlsx
    
      Save one self-contained ONNX model per selected test:
        python -m onnx_light backend --regex ".*not.*" --save-models backend-models
    
      Compare tuning values without changing the machine cache:
        python -m onnx_light backend --regex ".*not.*" \
          --kernel Not --dtype BOOL --impl portable \
          --parameter parallel.minimum_elements=default,16384,32768 \
          --criterion average-speedup