kernel#

Lists registered kernels, inspects tunable parameters, or calibrates a selected kernel. Requires a build with kernels enabled.

python -m onnx_light kernel --list
python -m onnx_light kernel --help

See also ../../howto/tune_kernel_thresholds.

Command-line reference#

    usage: onnx-light kernel [-h] (--list | --kernel NAME) [--json] [--tune]
                             [--parameter NAME=default,VALUE,...] [--verbose]
                             [--library LIBRARY] [--device DEVICE] [--dtype DTYPE]
                             [--impl IMPLEMENTATION] [--cache CACHE]
                             [--maximum-duration-ms MAXIMUM_DURATION_MS]
                             [--maximum-memory-mb MAXIMUM_MEMORY_MB]
    
    Lists registered kernels, inspects their tunable parameters, or calibrates and persists one selected kernel with --tune.
    
    options:
      -h, --help            show this help message and exit
      --list                List every registered native kernel identifier.
      --kernel NAME         Show tunable parameters for a kernel name or domain-
                            qualified identifier; may be specified multiple times.
      --json                Print a machine-readable JSON report.
      --tune                Calibrate and persist exactly one selected kernel,
                            using the duration and memory budgets below.
      --parameter NAME=default,VALUE,...
                            Benchmark explicit integer values side by side while
                            tuning; default resolves to the current active value
                            and defines the speedup baseline.
      --verbose, -v         Report tuning progress to stderr.
      --library LIBRARY     Restrict tuning schemas to one library (default: all).
      --device DEVICE       Restrict tuning schemas to CPU, Undefined, GPU<N>, or
                            a numeric device (default: all).
      --dtype DTYPE         Restrict tuning schemas to one ONNX element type name
                            or integer (default: all).
      --impl IMPLEMENTATION
                            Restrict tuning schemas to one implementation
                            (default: all).
      --cache CACHE         Read and persist tuning parameters in this cache file.
      --maximum-duration-ms MAXIMUM_DURATION_MS
                            Per-key calibration duration budget; 0 uses the
                            callback default.
      --maximum-memory-mb MAXIMUM_MEMORY_MB
                            Calibration memory budget in MiB; 0 uses the callback
                            default.
    
    examples:
      List every registered kernel:
        python -m onnx_light kernel --list
    
      Inspect one kernel's tunable parameters:
        python -m onnx_light kernel --kernel Gemm --dtype FLOAT --impl portable
    
      Tune one kernel automatically:
        python -m onnx_light kernel --kernel Gemm --dtype FLOAT --impl portable --tune
    
      Compare explicit values and persist the fastest:
        python -m onnx_light kernel --kernel Gemm --dtype FLOAT --impl portable --tune \
          --parameter parallel.minimum_tasks=default,2,4