feature: zeDriverGetLastErrorDescription error messages (cmdlist)

When there is a PRINT_DEBUG_STRING message in cmdlist that is applicable
to the user, it is now also set to
Driver::zeDriverGetLastErrorDescription.

Related-To: LOCI-4652

Signed-off-by: Zhang, Winston <winston.zhang@intel.com>
This commit is contained in:
Zhang, Winston
2023-07-27 22:16:58 +00:00
committed by Compute-Runtime-Automation
parent 8962c95000
commit 998e0a5833
4 changed files with 26 additions and 1 deletions

View File

@@ -42,6 +42,7 @@
#include "level_zero/core/source/cmdqueue/cmdqueue_imp.h"
#include "level_zero/core/source/device/device.h"
#include "level_zero/core/source/device/device_imp.h"
#include "level_zero/core/source/driver/driver_handle.h"
#include "level_zero/core/source/driver/driver_handle_imp.h"
#include "level_zero/core/source/event/event.h"
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
@@ -646,6 +647,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemory(ze_i
}
if (pDstRegion->width % groupSizeX || pDstRegion->height % groupSizeY || pDstRegion->depth % groupSizeZ) {
driverHandle->setErrorDescription("Invalid group size {%d, %d, %d} specified\n",
groupSizeX, groupSizeY, groupSizeZ);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
groupSizeX, groupSizeY, groupSizeZ);
DEBUG_BREAK_IF(true);
@@ -740,6 +743,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemory(void *
switch (bytesPerPixel) {
default:
driverHandle->setErrorDescription("invalid bytesPerPixel of size: %u\n", bytesPerPixel);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "invalid bytesPerPixel of size: %u\n", bytesPerPixel);
UNRECOVERABLE_IF(true);
break;
@@ -797,6 +801,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemory(void *
}
if (pSrcRegion->width % groupSizeX || pSrcRegion->height % groupSizeY || pSrcRegion->depth % groupSizeZ) {
driverHandle->setErrorDescription("Invalid group size {%d, %d, %d} specified\n",
groupSizeX, groupSizeY, groupSizeZ);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
groupSizeX, groupSizeY, groupSizeZ);
DEBUG_BREAK_IF(true);
@@ -939,6 +945,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(ze_image
}
if (srcRegion.width % groupSizeX || srcRegion.height % groupSizeY || srcRegion.depth % groupSizeZ) {
driverHandle->setErrorDescription("Invalid group size {%d, %d, %d} specified\n",
groupSizeX, groupSizeY, groupSizeZ);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
groupSizeX, groupSizeY, groupSizeZ);
DEBUG_BREAK_IF(true);
@@ -1520,6 +1528,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel3d(Align
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
auto lock = device->getBuiltinFunctionsLib()->obtainUniqueOwnership();
const auto driverHandle = static_cast<DriverHandleImp *>(device->getDriverHandle());
auto builtinKernel = device->getBuiltinFunctionsLib()->getFunction(builtin);
@@ -1541,6 +1550,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel3d(Align
}
if (srcRegion->width % groupSizeX || srcRegion->height % groupSizeY || srcRegion->depth % groupSizeZ) {
driverHandle->setErrorDescription("Invalid group size {%d, %d, %d} specified\n",
groupSizeX, groupSizeY, groupSizeZ);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d, %d} specified\n",
groupSizeX, groupSizeY, groupSizeZ);
DEBUG_BREAK_IF(true);
@@ -1587,6 +1598,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel2d(Align
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
auto lock = device->getBuiltinFunctionsLib()->obtainUniqueOwnership();
const auto driverHandle = static_cast<DriverHandleImp *>(device->getDriverHandle());
auto builtinKernel = device->getBuiltinFunctionsLib()->getFunction(builtin);
@@ -1608,6 +1620,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel2d(Align
}
if (srcRegion->width % groupSizeX || srcRegion->height % groupSizeY) {
driverHandle->setErrorDescription("Invalid group size {%d, %d}\n",
groupSizeX, groupSizeY);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Invalid group size {%d, %d}\n",
groupSizeX, groupSizeY);
DEBUG_BREAK_IF(true);
@@ -2016,9 +2030,10 @@ template <GFXCORE_FAMILY gfxCoreFamily>
inline uint64_t CommandListCoreFamily<gfxCoreFamily>::getInputBufferSize(NEO::ImageType imageType,
uint64_t bytesPerPixel,
const ze_image_region_t *region) {
const auto driverHandle = static_cast<DriverHandleImp *>(device->getDriverHandle());
switch (imageType) {
default:
driverHandle->setErrorDescription("invalid imageType: %d\n", imageType);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "invalid imageType: %d\n", imageType);
UNRECOVERABLE_IF(true);
break;

View File

@@ -20,6 +20,7 @@
#include "shared/source/unified_memory/unified_memory.h"
#include "shared/source/utilities/software_tags_manager.h"
#include "level_zero/core/source/driver/driver_handle_imp.h"
#include "level_zero/core/source/kernel/kernel_imp.h"
#include "encode_surface_state_args.h"
@@ -44,6 +45,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
Event *event,
const CmdListKernelLaunchParams &launchParams) {
UNRECOVERABLE_IF(kernel == nullptr);
const auto driverHandle = static_cast<DriverHandleImp *>(device->getDriverHandle());
const auto &kernelDescriptor = kernel->getKernelDescriptor();
if (kernelDescriptor.kernelAttributes.flags.isInvalid) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
@@ -142,6 +144,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
auto localMemSize = static_cast<uint32_t>(neoDevice->getDeviceInfo().localMemSize);
auto slmTotalSize = kernelImp->getSlmTotalSize();
if (slmTotalSize > 0 && localMemSize < slmTotalSize) {
driverHandle->setErrorDescription("Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize);
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
}

View File

@@ -24,6 +24,7 @@
#include "shared/source/xe_hp_core/hw_info.h"
#include "level_zero/core/source/cmdlist/cmdlist_hw.h"
#include "level_zero/core/source/driver/driver_handle_imp.h"
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
#include "level_zero/core/source/kernel/kernel_imp.h"
#include "level_zero/core/source/module/module.h"
@@ -85,6 +86,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
NEO::MemorySynchronizationCommands<GfxFamily>::addSingleBarrier(*commandContainer.getCommandStream(), args);
}
NEO::Device *neoDevice = device->getNEODevice();
const auto deviceHandle = static_cast<DriverHandleImp *>(device->getDriverHandle());
UNRECOVERABLE_IF(kernel == nullptr);
const auto kernelImmutableData = kernel->getImmutableData();
@@ -249,6 +251,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
auto localMemSize = static_cast<uint32_t>(neoDevice->getDeviceInfo().localMemSize);
auto slmTotalSize = kernelImp->getSlmTotalSize();
if (slmTotalSize > 0 && localMemSize < slmTotalSize) {
deviceHandle->setErrorDescription("Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%u) larger than available (%u)\n", slmTotalSize, localMemSize);
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
}

View File

@@ -1362,6 +1362,10 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelWithSlmSizeExceedingLocalMem
::testing::internal::CaptureStderr();
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, nullptr, launchParams);
const char *pStr = nullptr;
std::string emptyString = "";
zeDriverGetLastErrorDescription(device->getDriverHandle(), &pStr);
EXPECT_NE(0, strcmp(pStr, emptyString.c_str()));
EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY, result);
output = testing::internal::GetCapturedStderr();