Prepare mechanism for returning GPU execution error on OCL API

translate task count value to OCL error

Related-To: NEO-7412
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-11-04 13:57:42 +00:00
committed by Compute-Runtime-Automation
parent ab6af4247e
commit 1c3d5c3892
22 changed files with 71 additions and 53 deletions

View File

@ -113,7 +113,7 @@ HWTEST_TEMPLATED_F(BlitAuxTranslationTests, givenGpuHangOnFlushBcsAndBlitAuxTran
auto ultBcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsCsr);
ultBcsCsr->callBaseFlushBcsTask = false;
ultBcsCsr->flushBcsTaskReturnValue = std::nullopt;
ultBcsCsr->flushBcsTaskReturnValue = CompletionStamp::gpuHang;
auto mockCmdQ = static_cast<MockCommandQueueHw<FamilyType> *>(commandQueue.get());
@ -666,7 +666,7 @@ HWTEST_TEMPLATED_F(BlitAuxTranslationTests, givenGpuHangOnFlushBcsTaskAndBlitTra
auto ultBcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsCsr);
ultBcsCsr->callBaseFlushBcsTask = false;
ultBcsCsr->flushBcsTaskReturnValue = std::nullopt;
ultBcsCsr->flushBcsTaskReturnValue = CompletionStamp::gpuHang;
UserEvent userEvent;
cl_event waitlist[] = {&userEvent};
@ -943,7 +943,7 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenDebugFlagSetWhenDis
HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenGpuHangOnFlushBcsTaskAndDebugFlagSetWhenDispatchingBlitEnqueueThenOutOfResourcesIsReturned) {
auto ultBcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsCsr);
ultBcsCsr->callBaseFlushBcsTask = false;
ultBcsCsr->flushBcsTaskReturnValue = std::nullopt;
ultBcsCsr->flushBcsTaskReturnValue = CompletionStamp::gpuHang;
buffer = createBuffer(1, false);
buffer->forceDisallowCPUCopy = true;
@ -1194,7 +1194,7 @@ HWTEST_TEMPLATED_F(BlitEnqueueFlushTests, givenGpuHangOnFlushBcsTaskAndBlockedQu
auto myUltBcsCsr = static_cast<MyUltCsr<FamilyType> *>(bcsCsr);
myUltBcsCsr->flushCounter = &flushCounter;
myUltBcsCsr->callBaseFlushBcsTask = false;
myUltBcsCsr->flushBcsTaskReturnValue = std::nullopt;
myUltBcsCsr->flushBcsTaskReturnValue = CompletionStamp::gpuHang;
UserEvent userEvent;
cl_event waitlist[] = {&userEvent};

View File

@ -128,6 +128,13 @@ INSTANTIATE_TEST_CASE_P(CommandQueue,
CommandQueueTest,
::testing::ValuesIn(AllCommandQueueProperties));
TEST(CommandQueue, WhenGettingErrorCodeFromTaskCountThenProperValueIsReturned) {
EXPECT_EQ(CL_SUCCESS, CommandQueue::getErrorCodeFromTaskCount(0));
EXPECT_EQ(CL_OUT_OF_HOST_MEMORY, CommandQueue::getErrorCodeFromTaskCount(CompletionStamp::outOfHostMemory));
EXPECT_EQ(CL_OUT_OF_RESOURCES, CommandQueue::getErrorCodeFromTaskCount(CompletionStamp::outOfDeviceMemory));
EXPECT_EQ(CL_OUT_OF_RESOURCES, CommandQueue::getErrorCodeFromTaskCount(CompletionStamp::gpuHang));
}
TEST(CommandQueue, WhenConstructingCommandQueueThenTaskLevelAndTaskCountAreZero) {
MockCommandQueue cmdQ(nullptr, nullptr, 0, false);
EXPECT_EQ(0u, cmdQ.taskLevel);

View File

@ -650,12 +650,12 @@ HWTEST_F(BcsTests, GivenNoneGpuHangWhenBlitFromHostPtrCalledThenCallWaitWithKmdF
0, 0, {1, 1, 1}, 0, 0, 0, 0);
const auto taskCount1 = flushBcsTask(myMockCsr.get(), blitProperties, false, *pDevice);
EXPECT_TRUE(taskCount1.has_value());
EXPECT_NE(CompletionStamp::gpuHang, taskCount1);
EXPECT_EQ(0u, myMockCsr->waitForTaskCountWithKmdNotifyFallbackCalled);
const auto taskCount2 = flushBcsTask(myMockCsr.get(), blitProperties, true, *pDevice);
EXPECT_TRUE(taskCount2.has_value());
EXPECT_NE(CompletionStamp::gpuHang, taskCount2);
EXPECT_EQ(1u, myMockCsr->waitForTaskCountWithKmdNotifyFallbackCalled);
EXPECT_EQ(myMockCsr->taskCount, myMockCsr->taskCountToWaitPassed);
@ -687,14 +687,14 @@ HWTEST_F(BcsTests, GivenGpuHangWhenBlitFromHostPtrCalledThenCallWaitWithKmdFallb
0, 0, {1, 1, 1}, 0, 0, 0, 0);
const auto taskCount1 = flushBcsTask(myMockCsr.get(), blitProperties, false, *pDevice);
EXPECT_TRUE(taskCount1.has_value());
EXPECT_NE(CompletionStamp::gpuHang, taskCount1);
EXPECT_EQ(0u, myMockCsr->waitForTaskCountWithKmdNotifyFallbackCalled);
myMockCsr->waitForTaskCountWithKmdNotifyFallbackReturnValue = WaitStatus::GpuHang;
const auto taskCount2 = flushBcsTask(myMockCsr.get(), blitProperties, true, *pDevice);
EXPECT_FALSE(taskCount2.has_value());
EXPECT_EQ(CompletionStamp::gpuHang, taskCount2);
EXPECT_EQ(1u, myMockCsr->waitForTaskCountWithKmdNotifyFallbackCalled);
EXPECT_EQ(myMockCsr->taskCount, myMockCsr->taskCountToWaitPassed);

View File

@ -22,7 +22,7 @@ struct BcsTests : public Test<ClDeviceFixture> {
Test<ClDeviceFixture>::TearDown();
}
std::optional<uint32_t> flushBcsTask(CommandStreamReceiver *bcsCsr, const BlitProperties &blitProperties, bool blocking, Device &device) {
uint32_t flushBcsTask(CommandStreamReceiver *bcsCsr, const BlitProperties &blitProperties, bool blocking, Device &device) {
BlitPropertiesContainer container;
container.push_back(blitProperties);

View File

@ -559,7 +559,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ContextCreateTests, givenGpuHangOnFlushBcsTaskAndLo
auto ultBcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsEngine->commandStreamReceiver);
ultBcsCsr->callBaseFlushBcsTask = false;
ultBcsCsr->flushBcsTaskReturnValue = std::nullopt;
ultBcsCsr->flushBcsTaskReturnValue = CompletionStamp::gpuHang;
EXPECT_EQ(BlitOperationResult::GpuHang, BlitHelper::blitMemoryToAllocation(buffer->getContext()->getDevice(0)->getDevice(), memory, buffer->getOffset(), hostMemory, {1, 1, 1}));
}

View File

@ -543,7 +543,7 @@ class CommandStreamReceiverMock : public CommandStreamReceiver {
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, QueueThrottle throttle) override {
return WaitStatus::Ready;
}
std::optional<uint32_t> flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override { return taskCount; };
uint32_t flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override { return taskCount; };
CompletionStamp flushTask(
LinearStream &commandStream,

View File

@ -183,7 +183,7 @@ HWTEST_F(PrintfHandlerTests, givenGpuHangOnFlushBcsStreamAndEnabledStatelessComp
auto &bcsEngine = device->getEngine(EngineHelpers::getBcsEngineType(device->getHardwareInfo(), device->getDeviceBitfield(), device->getSelectorCopyEngine(), true), EngineUsage::Regular);
auto bcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsEngine.commandStreamReceiver);
bcsCsr->callBaseFlushBcsTask = false;
bcsCsr->flushBcsTaskReturnValue = std::nullopt;
bcsCsr->flushBcsTaskReturnValue = CompletionStamp::gpuHang;
EXPECT_FALSE(printfHandler->printEnqueueOutput());
EXPECT_EQ(1u, bcsCsr->blitBufferCalled);