Image Util Kernels#

struct Phi4MMIndex#

Phi4MMIndex Device-side index and size metadata for Phi-4MM HD packing. Fields:

  • hBlocks/wBlocks [numImages]: per-image grid sizes (hb = H/blockImageSizeH, wb = W/blockImageSizeW)

  • srcGlbStart [numImages]: starting raw-token offset for the tokensPerSide x tokensPerSide global grid of image i

  • srcSubStart [numImages]: starting raw-token offset for sub-grid tokens of image i

  • dstOutStart [numImages]: starting packed-token offset in dst for image i

  • subOutLen [numImages]: sub segment token count per image (includes one newline per row)

  • numImages: batch size

  • hidden: embedding length

  • totalOutTokens: total tokens to be written across all images

Public Members

int32_t const *hBlocks#
int32_t const *wBlocks#
int64_t const *srcGlbStart#
int64_t const *srcSubStart#
int64_t const *dstOutStart#
int64_t const *subOutLen#
int32_t numImages#
int32_t hidden#
int64_t totalOutTokens#
struct Phi4MMGN#

Phi4MMGN Grid Newline (GN) and separator embeddings.

  • subGN [hidden] FP16: newline token vector inserted at the end of each sub-grid row

  • glbGN [hidden] FP16: single separator token placed between sub and global segments

Public Members

half const *subGN#
half const *glbGN#