feature: use heapless builtins for images

Related-To: NEO-12744
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2024-10-25 15:10:17 +00:00
committed by Compute-Runtime-Automation
parent bbdf1ac7b6
commit 3891e887c1
18 changed files with 659 additions and 106 deletions

View File

@@ -26,18 +26,28 @@ inline constexpr Type fillBufferStateless{8};
inline constexpr Type fillBufferStatelessHeapless{9};
inline constexpr Type copyBufferToImage3d{10};
inline constexpr Type copyBufferToImage3dStateless{11};
inline constexpr Type copyImage3dToBuffer{12};
inline constexpr Type copyImage3dToBufferStateless{13};
inline constexpr Type copyImageToImage1d{14};
inline constexpr Type copyImageToImage2d{15};
inline constexpr Type copyImageToImage3d{16};
inline constexpr Type fillImage1d{17};
inline constexpr Type fillImage2d{18};
inline constexpr Type fillImage3d{19};
inline constexpr Type queryKernelTimestamps{20};
inline constexpr Type copyBufferToImage3dHeapless{12};
inline constexpr Type copyImage3dToBuffer{13};
inline constexpr Type copyImage3dToBufferStateless{14};
inline constexpr Type copyImage3dToBufferHeapless{15};
inline constexpr Type copyImageToImage1d{16};
inline constexpr Type copyImageToImage1dHeapless{17};
inline constexpr Type copyImageToImage2d{18};
inline constexpr Type copyImageToImage2dHeapless{19};
inline constexpr Type copyImageToImage3d{20};
inline constexpr Type copyImageToImage3dHeapless{21};
inline constexpr Type fillImage1d{22};
inline constexpr Type fillImage1dHeapless{23};
inline constexpr Type fillImage2d{24};
inline constexpr Type fillImage2dHeapless{25};
inline constexpr Type fillImage3d{26};
inline constexpr Type fillImage3dHeapless{27};
inline constexpr Type queryKernelTimestamps{28};
constexpr bool isStateless(Type type) {
constexpr std::array<Type, 8> statelessBuiltins{{copyBufferToBufferStateless, copyBufferRectStateless, fillBufferStateless, copyBufferToImage3dStateless, copyImage3dToBufferStateless, copyBufferToBufferStatelessHeapless, copyBufferRectStatelessHeapless, fillBufferStatelessHeapless}};
constexpr std::array<Type, 10> statelessBuiltins{{copyBufferToBufferStateless, copyBufferRectStateless, fillBufferStateless, copyBufferToImage3dStateless,
copyImage3dToBufferStateless, copyBufferToBufferStatelessHeapless, copyBufferRectStatelessHeapless, fillBufferStatelessHeapless,
copyBufferToImage3dHeapless, copyImage3dToBufferHeapless}};
for (auto builtinType : statelessBuiltins) {
if (type == builtinType) {
return true;
@@ -47,7 +57,10 @@ constexpr bool isStateless(Type type) {
}
constexpr bool isHeapless(Type type) {
constexpr Type statelessBuiltins[] = {copyBufferToBufferStatelessHeapless, copyBufferRectStatelessHeapless, fillBufferStatelessHeapless};
constexpr Type statelessBuiltins[] = {copyBufferToBufferStatelessHeapless, copyBufferRectStatelessHeapless, fillBufferStatelessHeapless,
copyBufferToImage3dHeapless, copyImage3dToBufferHeapless, copyImageToImage1dHeapless, copyImageToImage2dHeapless, copyImageToImage3dHeapless,
fillImage1dHeapless, fillImage2dHeapless, fillImage3dHeapless};
for (auto builtinType : statelessBuiltins) {
if (type == builtinType) {
return true;
@@ -93,7 +106,9 @@ constexpr uint32_t adjustBuiltinType<fillBuffer>(const bool useStateless, const
template <>
constexpr uint32_t adjustBuiltinType<copyBufferToImage3d>(const bool useStateless, const bool useHeapless) {
if (useStateless) {
if (useHeapless) {
return copyBufferToImage3dHeapless;
} else if (useStateless) {
return copyBufferToImage3dStateless;
}
return copyBufferToImage3d;
@@ -101,13 +116,33 @@ constexpr uint32_t adjustBuiltinType<copyBufferToImage3d>(const bool useStateles
template <>
constexpr uint32_t adjustBuiltinType<copyImage3dToBuffer>(const bool useStateless, const bool useHeapless) {
if (useStateless) {
if (useHeapless) {
return copyImage3dToBufferHeapless;
} else if (useStateless) {
return copyImage3dToBufferStateless;
}
return copyImage3dToBuffer;
}
inline constexpr Type maxBaseValue{20};
template <Type builtinType>
constexpr Type adjustImageBuiltinType(const bool useHeapless) {
return builtinType;
}
#define DEFINE_ADJUST_BUILTIN_TYPE_IMAGE(type) \
template <> \
constexpr Type adjustImageBuiltinType<type>(const bool useHeapless) { \
return useHeapless ? type##Heapless : type; \
}
DEFINE_ADJUST_BUILTIN_TYPE_IMAGE(copyImageToImage1d);
DEFINE_ADJUST_BUILTIN_TYPE_IMAGE(copyImageToImage2d);
DEFINE_ADJUST_BUILTIN_TYPE_IMAGE(copyImageToImage3d);
DEFINE_ADJUST_BUILTIN_TYPE_IMAGE(fillImage1d);
DEFINE_ADJUST_BUILTIN_TYPE_IMAGE(fillImage2d);
DEFINE_ADJUST_BUILTIN_TYPE_IMAGE(fillImage3d);
inline constexpr Type maxBaseValue{28};
inline constexpr Type count{64};
} // namespace EBuiltInOps
} // namespace NEO

View File

@@ -46,22 +46,30 @@ const char *getBuiltinAsString(EBuiltInOps::Type builtin) {
case EBuiltInOps::copyBufferToImage3d:
return "copy_buffer_to_image3d.builtin_kernel";
case EBuiltInOps::copyBufferToImage3dStateless:
case EBuiltInOps::copyBufferToImage3dHeapless:
return "copy_buffer_to_image3d_stateless.builtin_kernel";
case EBuiltInOps::copyImage3dToBuffer:
return "copy_image3d_to_buffer.builtin_kernel";
case EBuiltInOps::copyImage3dToBufferStateless:
case EBuiltInOps::copyImage3dToBufferHeapless:
return "copy_image3d_to_buffer_stateless.builtin_kernel";
case EBuiltInOps::copyImageToImage1d:
case EBuiltInOps::copyImageToImage1dHeapless:
return "copy_image_to_image1d.builtin_kernel";
case EBuiltInOps::copyImageToImage2d:
case EBuiltInOps::copyImageToImage2dHeapless:
return "copy_image_to_image2d.builtin_kernel";
case EBuiltInOps::copyImageToImage3d:
case EBuiltInOps::copyImageToImage3dHeapless:
return "copy_image_to_image3d.builtin_kernel";
case EBuiltInOps::fillImage1d:
case EBuiltInOps::fillImage1dHeapless:
return "fill_image1d.builtin_kernel";
case EBuiltInOps::fillImage2d:
case EBuiltInOps::fillImage2dHeapless:
return "fill_image2d.builtin_kernel";
case EBuiltInOps::fillImage3d:
case EBuiltInOps::fillImage3dHeapless:
return "fill_image3d.builtin_kernel";
case EBuiltInOps::queryKernelTimestamps:
return "copy_kernel_timestamps.builtin_kernel";