feat(zebin): add sampler metadata support

This commit adds support for sampler's metadata in zebinary and
updates some image's metadata field names.

Resolves: NEO-7257

Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
Krystian Chmielewski
2022-08-10 16:11:49 +00:00
committed by Compute-Runtime-Automation
parent 44e1f1ba4b
commit 70ef88c0bb
4 changed files with 371 additions and 118 deletions

View File

@@ -170,6 +170,8 @@ static constexpr ConstStringRef sourceOffset("source_offset");
static constexpr ConstStringRef slmArgAlignment("slm_alignment");
static constexpr ConstStringRef imageType("image_type");
static constexpr ConstStringRef imageTransformable("image_transformable");
static constexpr ConstStringRef samplerType("sampler_type");
namespace ArgType {
static constexpr ConstStringRef localSize("local_size");
static constexpr ConstStringRef groupCount("group_count");
@@ -192,17 +194,56 @@ static constexpr ConstStringRef channelDataType("image_channel_data_type");
static constexpr ConstStringRef channelOrder("image_channel_order");
static constexpr ConstStringRef arraySize("image_array_size");
static constexpr ConstStringRef numSamples("image_num_samples");
static constexpr ConstStringRef numMipLevels("image_mip_levels");
static constexpr ConstStringRef flatBaseOffset("image_flat_base_offset");
static constexpr ConstStringRef flatWidth("image_flat_width");
static constexpr ConstStringRef flatHeight("image_flat_height");
static constexpr ConstStringRef flatPitch("image_flat_pitch");
static constexpr ConstStringRef numMipLevels("image_num_mip_levels");
static constexpr ConstStringRef flatBaseOffset("flat_image_baseoffset");
static constexpr ConstStringRef flatWidth("flat_image_width");
static constexpr ConstStringRef flatHeight("flat_image_height");
static constexpr ConstStringRef flatPitch("flat_image_pitch");
} // namespace Image
namespace Sampler {
static constexpr ConstStringRef snapWa("sampler_snap_wa");
static constexpr ConstStringRef normCoords("sampler_normalized");
static constexpr ConstStringRef addrMode("sampler_address");
namespace Vme {
static constexpr ConstStringRef blockType("vme_mb_block_type");
static constexpr ConstStringRef subpixelMode("vme_subpixel_mode");
static constexpr ConstStringRef sadAdjustMode("vme_sad_adjust_mode");
static constexpr ConstStringRef searchPathType("vme_search_path_type");
} // namespace Vme
} // namespace Sampler
} // namespace ArgType
namespace ImageType {
static constexpr ConstStringRef imageTypeMedia("media");
static constexpr ConstStringRef imageTypeBlock("media_block");
static constexpr ConstStringRef imageTypeBuffer("image_buffer");
static constexpr ConstStringRef imageType1D("image_1d");
static constexpr ConstStringRef imageType1DArray("image_1d_array");
static constexpr ConstStringRef imageType2D("image_2d");
static constexpr ConstStringRef imageType2DArray("image_2d_array");
static constexpr ConstStringRef imageType3D("image_3d");
static constexpr ConstStringRef imageTypeCube("image_cube_array");
static constexpr ConstStringRef imageTypeCubeArray("image_buffer");
static constexpr ConstStringRef imageType2DDepth("image_2d_depth");
static constexpr ConstStringRef imageType2DArrayDepth("image_2d_array_depth");
static constexpr ConstStringRef imageType2DMSAA("image_2d_msaa");
static constexpr ConstStringRef imageType2DMSAADepth("image_2d_msaa_depth");
static constexpr ConstStringRef imageType2DArrayMSAA("image_2d_array_msaa");
static constexpr ConstStringRef imageType2DArrayMSAADepth("image_2d_array_msaa_depth");
static constexpr ConstStringRef imageType2DMedia("image_2d_media");
static constexpr ConstStringRef imageType2DMediaBlock("image_2d_media_block");
} // namespace ImageType
namespace SamplerType {
static constexpr ConstStringRef samplerTypeTexture("texture");
static constexpr ConstStringRef samplerType8x8("sample_8x8");
static constexpr ConstStringRef samplerType2DConsolve8x8("sample_8x8_2dconvolve");
static constexpr ConstStringRef samplerTypeErode8x8("sample_8x8_erode");
static constexpr ConstStringRef samplerTypeDilate8x8("sample_8x8_dilate");
static constexpr ConstStringRef samplerTypeMinMaxFilter8x8("sample_8x8_minmaxfilter");
static constexpr ConstStringRef samplerTypeCentroid8x8("sample_8x8_centroid");
static constexpr ConstStringRef samplerTypeBoolCentroid8x8("sample_8x8_bool_centroid");
static constexpr ConstStringRef samplerTypeBoolSum8x8("sample_8x8_bool_sum");
static constexpr ConstStringRef samplerTypeVD("vd");
static constexpr ConstStringRef samplerTypeVE("ve");
static constexpr ConstStringRef samplerTypeVME("vme");
} // namespace SamplerType
namespace MemoryAddressingMode {
static constexpr ConstStringRef stateless("stateless");
static constexpr ConstStringRef stateful("stateful");
@@ -412,6 +453,13 @@ enum ArgType : uint8_t {
ArgTypeImageFlatWidth,
ArgTypeImageFlatHeight,
ArgTypeImageFlatPitch,
ArgTypeSamplerSnapWa,
ArgTypeSamplerNormCoords,
ArgTypeSamplerAddrMode,
ArgTypeVmeMbBlockType,
ArgTypeVmeSubpixelMode,
ArgTypeVmeSadAdjustMode,
ArgTypeVmeSearchPathType,
ArgTypeMax
};
@@ -463,11 +511,42 @@ enum AccessType : uint8_t {
enum ImageType : uint8_t {
ImageTypeUnknown,
ImageTypeMedia,
ImageTypeMediaBlock,
ImageTypeBuffer,
ImageType1D,
ImageType1DArray,
ImageType2D,
ImageType2DArray,
ImageType3D,
ImageTypeCube,
ImageTypeCubeArray,
ImageType2DDepth,
ImageType2DArrayDepth,
ImageType2DMSAA,
ImageType2DMSAADepth,
ImageType2DArrayMSAA,
ImageType2DArrayMSAADepth,
ImageType2DMedia,
ImageType2DMediaBlock,
ImageTypeMax
};
enum SamplerType : uint8_t {
SamplerTypeUnknown,
SamplerTypeTexture,
SamplerType8x8,
SamplerType2DConvolve8x8,
SamplerTypeErode8x8,
SamplerTypeDilate8x8,
SamplerTypeMinMaxFilter8x8,
SamplerTypeCentroid8x8,
SamplerTypeBoolCentroid8x8,
SamplerTypeBoolSum8x8,
SamplerTypeVME,
SamplerTypeVE,
SamplerTypeVD,
SamplerTypeMax
};
using ArgTypeT = ArgType;
using OffseT = int32_t;
using SourceOffseT = int32_t;
@@ -499,6 +578,7 @@ struct PayloadArgumentBaseT {
SlmAlignmentT slmArgAlignment = Defaults::slmArgAlignment;
ImageType imageType = ImageTypeUnknown;
bool imageTransformable = false;
SamplerType samplerType = SamplerTypeUnknown;
};
} // namespace PayloadArgument

View File

@@ -17,10 +17,12 @@ namespace ArgType {
using namespace Tags::Kernel::PayloadArgument::ArgType;
using namespace Tags::Kernel::PerThreadPayloadArgument::ArgType;
using namespace Tags::Kernel::PayloadArgument::ArgType::Image;
using namespace Tags::Kernel::PayloadArgument::ArgType::Sampler;
using namespace Tags::Kernel::PayloadArgument::ArgType::Sampler::Vme;
using ArgType = Types::Kernel::ArgType;
static constexpr ConstStringRef name = "argument type";
static constexpr LookupArray<ConstStringRef, ArgType, 27> lookup({{{packedLocalIds, ArgType::ArgTypePackedLocalIds},
static constexpr LookupArray<ConstStringRef, ArgType, 34> lookup({{{packedLocalIds, ArgType::ArgTypePackedLocalIds},
{localId, ArgType::ArgTypeLocalId},
{localSize, ArgType::ArgTypeLocalSize},
{groupCount, ArgType::ArgTypeGroupCount},
@@ -46,7 +48,14 @@ static constexpr LookupArray<ConstStringRef, ArgType, 27> lookup({{{packedLocalI
{flatBaseOffset, ArgType::ArgTypeImageFlatBaseOffset},
{flatWidth, ArgType::ArgTypeImageFlatWidth},
{flatHeight, ArgType::ArgTypeImageFlatHeight},
{flatPitch, ArgType::ArgTypeImageFlatPitch}}});
{flatPitch, ArgType::ArgTypeImageFlatPitch},
{snapWa, ArgType::ArgTypeSamplerSnapWa},
{normCoords, ArgType::ArgTypeSamplerNormCoords},
{addrMode, ArgType::ArgTypeSamplerAddrMode},
{blockType, ArgType::ArgTypeVmeMbBlockType},
{subpixelMode, ArgType::ArgTypeVmeSubpixelMode},
{sadAdjustMode, ArgType::ArgTypeVmeSadAdjustMode},
{searchPathType, ArgType::ArgTypeVmeSearchPathType}}});
static_assert(lookup.size() == ArgType::ArgTypeMax - 1, "Every enum field must be present");
} // namespace ArgType
namespace MemoryAddressingMode {
@@ -103,11 +112,42 @@ namespace ImageType {
using namespace Tags::Kernel::PayloadArgument::ImageType;
using ImageType = Types::Kernel::PayloadArgument::ImageType;
static constexpr ConstStringRef name = "image type";
static constexpr LookupArray<ConstStringRef, ImageType, 2> lookup({{{imageTypeMedia, ImageType::ImageTypeMedia},
{imageTypeBlock, ImageType::ImageTypeMediaBlock}}});
static constexpr LookupArray<ConstStringRef, ImageType, 16> lookup({{{imageTypeBuffer, ImageType::ImageTypeBuffer},
{imageType1D, ImageType::ImageType1D},
{imageType1DArray, ImageType::ImageType1DArray},
{imageType2D, ImageType::ImageType2D},
{imageType2DArray, ImageType::ImageType2DArray},
{imageType3D, ImageType::ImageType3D},
{imageTypeCube, ImageType::ImageTypeCube},
{imageTypeCubeArray, ImageType::ImageTypeCubeArray},
{imageType2DDepth, ImageType::ImageType2DDepth},
{imageType2DArrayDepth, ImageType::ImageType2DArrayDepth},
{imageType2DMSAA, ImageType::ImageType2DMSAA},
{imageType2DMSAADepth, ImageType::ImageType2DMSAADepth},
{imageType2DArrayMSAA, ImageType::ImageType2DArrayMSAA},
{imageType2DArrayMSAADepth, ImageType::ImageType2DArrayMSAADepth},
{imageType2DMedia, ImageType::ImageType2DMedia},
{imageType2DMediaBlock, ImageType::ImageType2DMediaBlock}}});
static_assert(lookup.size() == ImageType::ImageTypeMax - 1, "Every enum field must be present");
} // namespace ImageType
namespace SamplerType {
using namespace Tags::Kernel::PayloadArgument::SamplerType;
using SamplerType = Types::Kernel::PayloadArgument::SamplerType;
static constexpr ConstStringRef name = "sampler type";
static constexpr LookupArray<ConstStringRef, SamplerType, 12> lookup({{{samplerTypeTexture, SamplerType::SamplerTypeTexture},
{samplerType8x8, SamplerType::SamplerType8x8},
{samplerType2DConsolve8x8, SamplerType::SamplerType2DConvolve8x8},
{samplerTypeErode8x8, SamplerType::SamplerTypeErode8x8},
{samplerTypeDilate8x8, SamplerType::SamplerTypeDilate8x8},
{samplerTypeMinMaxFilter8x8, SamplerType::SamplerTypeMinMaxFilter8x8},
{samplerTypeCentroid8x8, SamplerType::SamplerTypeBoolCentroid8x8},
{samplerTypeBoolCentroid8x8, SamplerType::SamplerTypeBoolCentroid8x8},
{samplerTypeBoolSum8x8, SamplerType::SamplerTypeBoolSum8x8},
{samplerTypeVME, SamplerType::SamplerTypeVME},
{samplerTypeVE, SamplerType::SamplerTypeVE},
{samplerTypeVD, SamplerType::SamplerTypeVD}}});
static_assert(lookup.size() == SamplerType::SamplerTypeMax - 1, "Every enum field must be present");
} // namespace SamplerType
template <typename T>
struct EnumLooker {};
@@ -147,4 +187,9 @@ struct EnumLooker<Types::Kernel::PayloadArgument::ImageType> {
static constexpr ConstStringRef name = ImageType::name;
static constexpr auto members = ImageType::lookup;
};
template <>
struct EnumLooker<Types::Kernel::PayloadArgument::SamplerType> {
static constexpr ConstStringRef name = SamplerType::name;
static constexpr auto members = SamplerType::lookup;
};
} // namespace NEO::Zebin::ZeInfo::EnumLookup