Skip to content

Device-specific constraints#

Image constraints#

When memory is allocated for Image pixel data storage, the following constraints are enforced depending on the requested memory residence:

  • Image::MemoryResidence::CPU: base address alignment is 32 bytes;
  • Image::MemoryResidence::GPU: base address alignment is 128 bytes;
  • Image::MemoryResidence::NPU: base address alignment is 128 bytes;
  • Image::MemoryResidence::NPU_DPP: base address alignment is 128 bytes.

Also, in case of Image::MemoryResidence::NPU_DPP image width must be multiple of 16 and image height must be multiple of 2.

When Image is initialized as a wrapper for a user-provided memory block, whose residence is said to be Image::MemoryResidence::NPU or Image::MemoryResidence::NPU_DPP, the above requirements are checked upon the initialization.

Image class implements limited functionality for device-side data. Only the following operations are supported:

  • construction (both with Image-owned memory and as a wrapper for a user-defined memory) and assignment (including deep copy);
  • destruction;
  • set() family of functions (functionally the same as construction/assignment);
  • convert() function, but only in transfer mode; This means that both source and destination formats must match, only memory residency may differ. This function supports only synchronous memory transfers in the following directions:

  • host <-> GPU

  • GPU <-> GPU
  • host <-> NPU
  • NPU <-> NPU.

Full range of functionality (including format conversions) is currently only available for Images with host memory data residence.

The following operations are NOT supported:

  • compressed format encoding/decoding;
  • format/color space conversion;
  • subimage views (i.e. map() function);
  • padding and cropping (i.e. extract() function);
  • manipulation (e.g. getPixel(), setPixel(), etc.).