Files
oneDNN/tests/benchdnn/doc/driver_lnorm.md
2025-03-12 15:08:59 -07:00

2.9 KiB

Layer Normalization Driver

Usage

    ./benchdnn --lnorm [benchdnn-knobs] [lnorm-knobs] [lnorm-desc] ...

where lnorm-knobs are:

  • --dir={FWD_D [default], FWD_I, BWD_D, BWD_DW} -- dnnl_prop_kind_t. Refer to direction for details.
  • --dt={f32:f32 [default], ...} -- src and dst data types. Refer to data types for details.
  • --tag={tnc:any [default], ...} -- physical src and dst memory format. If only src memory format is provided, dst memory format will be set to any. Refer to tags for details.
  • --stat_tag={tn [default], ...} -- physical mean and variance memory format. Refer to tags for details.
  • --ss_dt={f32 [default], ...} -- data type of scale and shift.
  • --flags=[|G|C|H] -- layer normalization flags, default none; where multiple simultaneous flags are supported. G is dnnl_use_global_stats; C is dnnl_use_scale; H is dnnl_use_shift; Refer to layer normalization primitive for details.
  • --inplace=BOOL -- memory mode for the primitive. If true, it uses input memory as output, otherwise, input and output are separate. Default is false.
  • --match=REGEX -- skip problems not matching the regular expression in REGEX. By default no pattern is applied (run everything). Note: Windows may interpret only string arguments surrounded by double quotation marks.
  • Any attributes options. Refer to attributes for details.

and lnorm-desc is a problem descriptor. The canonical form is:

    NxNxN

where N is an integer number. This represents a problem with the following logical dimensions: T, N, C. Consider removing each xN from the end to specify fewer dimensions.

Essence of Testing

TBA.

Examples

Run a set of lnorms from an input file, using the default settings:

    ./benchdnn --lnorm --batch=shapes_ci

Run a named problem with single precision src/dst, iterating by:

  1. Src/dst memory formats
  2. Statistics memory formats
  3. forward training, backward by data and weights prop_kinds,
  4. some flag combinations:
    ./benchdnn --lnorm --dt=f32 --tag=tnc,ntc --stat_tag=tn,nt \
               --dir=FWD_D,BWD_DW --flags=GCH,CH 8x32x1024

Run the same problem as previous but with different data types for source and destination:

    ./benchdnn --lnorm --dt=bf16:f32 --tag=tnc,ntc --stat_tag=tn,nt \
               --dir=FWD_D,BWD_DW --flags=GCH,CH 8x32x1024

More examples with different driver options can be found at inputs/lnorm/test_*. Examples with different problem descriptors can be found at inputs/lnorm/shapes_*. Examples with different benchdnn common options can be found at driver_conv.md.