Operators#
Operators are the MathDx + pieces used to compose processing steps in a fused
kernel (ingest, exgest, pointwise, area). Each step also carries the compile-time
configuration it needs (formats, tile geometry, architecture). NPPDx follows the same MathDx
programming model as other device extensions libraries: compose each processing step by
joining operators with +.
See Terminology. The library validates each expression and generates specialized
device code for the specified formats, tile geometry, and target architecture.
For detailed descriptions of each processing step (I/O, pointwise, and area including resize), see Processing overview.
Operators are composed from two groups:
Description: what to execute (I/O direction and format, image-processing function, tile size, precision, architecture, and optional Memory halo optimization).
Execution: how to execute on the GPU (block mapping and thread-block size).
Most function processing steps pair a function tag (Function<function:: ...>) with a
parameter piece that supplies compile-time values (kernel size, color spaces, resize
ratio, and so on). Ingest and exgest steps pair InputOutput with InputFormat or
OutputFormat.
Composing a processing step#
Start by joining a series of MathDx operators with +.
Example: minimal ingest step:
using Ingest = decltype(
InputOutput<input_output_direction::ingest>() +
InputFormat<packing_format::rgb24>() +
TileSize<48, 48>() +
Block() +
SM<900>());
Example compute step between ingest and exgest:
using Blur = decltype(
Function<function::box_blur>() +
BoxBlur<5, 5>() +
TileSize<48, 48>() +
Block() +
SM<900>());
Description operators#
I/O operators#
Operator |
Description |
|---|---|
|
Ingest: load data arranged in global memory according to its packing format into an internal tile (with halo when required). See Ingest. |
|
Exgest: write an internal tile to global memory according to its packing format. See Exgest. |
|
Selects the packed input layout for ingest. See Packing formats (InputFormat / OutputFormat). |
|
Selects the packed output layout for exgest. See Packing formats (InputFormat / OutputFormat). |
Architecture and tile geometry#
Operator |
Description |
|---|---|
|
Target GPU architecture (for example |
|
Tile width and height in pixels. All operators in the same fused kernel must use the same tile size. |
Function tag operator (processing step)#
Function<function::Tag> selects the image-processing step. Pair it with the matching
parameter operator listed in the next section. Detailed behavior is in
Processing overview.
|
Kind |
|---|---|
|
Pointwise color-space / bit-depth conversion. See Color convert. |
|
Forward or inverse gamma (SDR, HLG, or PQ). See Gamma. |
|
Per-channel affine map |
|
Box blur (arithmetic mean); kernel size from |
|
Discrete Gaussian FIR; pixel radius from |
|
Median filter; shape from |
|
3x3 convolutional sharpen; weights from |
|
Rational resize |
Function parameter operators#
Operator |
Parameters / notes |
|---|---|
|
|
|
|
|
Integer affine coefficients; use |
|
Odd kernel sizes \(\geq\) 1. See Box blur. |
|
Pixel radius 0.1–10.0 ( |
|
Square ( |
|
3x3 convolutional sharpen; use |
|
Coprime |
Halo operators#
Neighborhood steps derive a local halo from their parameter operator. A fused kernel’s
cumulative halo is composed from those local halos – overlap between tiles and extended
ingest region for tiled processing – and the remaining halo on each step is tracked through MemoryHalo and
CumulativeHalo (see Halos and step order).
Operator |
Description |
|---|---|
|
Override the in-tile buffer border for this step (advanced). |
|
Remaining halo on this step. On ingest, set to the fused kernel’s full cumulative
halo – minimum additional data so every processing step can run without boundary-condition
considerations – composed from the local
halos of neighborhood steps in the kernel. Set |
Packing formats (InputFormat / OutputFormat)#
The packing_format enumerators available for I/O operators:
Packed RGB: rgb24, rgb10, rgb16
Packed YUV 4:2:2: yuv2, y210, uyvp, v210
Semi-planar YUV: nv12, p010 (4:2:0); nv16, p216 (4:2:2)
Planar: rgbp, bgrp; yuv420p, yuv420p10; yuv422p, yuv422p10;
yuv444p, yuv444p10
See Requirements and Functionality for release-level format support. The authoritative enum is in
operators/formats.hpp.
Execution operators#
Operator |
Description |
|---|---|
|
Block-level execution mapping (the supported execution mode in the current release). |
|
CUDA thread-block size. NPPDx uses 1D thread indexing: |
Complete processing steps (composed operators)#
A processing step is complete when it includes the operators required for its role:
Ingest / exgest:
InputOutput, matching format operator,TileSize,Block,SM, and (for block Shared-memory APIs)BlockDim.Function operator:
Function<...>, matching parameter operator,TileSize,Block,SM, andBlockDimwhen executing on a block.
Use is_supported_v or the shipped examples to confirm that a specific combination of operators, tile size, format, and architecture is implemented for the workload.