mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
OCL: optimize creating printf buffer
Dont create printf buffer when kernel doesnt require it Related-To: HSD-18023825570 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
48824acab2
commit
23eff82d0a
@@ -408,7 +408,7 @@ void CommandQueueHw<GfxFamily>::processDispatchForKernels(const MultiDispatchInf
|
||||
TagNodeBase *hwPerfCounter = nullptr;
|
||||
getClFileLogger().dumpKernelArgs(&multiDispatchInfo);
|
||||
|
||||
printfHandler.reset(PrintfHandler::create(multiDispatchInfo, *device));
|
||||
printfHandler.reset(PrintfHandler::create(multiDispatchInfo, device->getDevice()));
|
||||
if (printfHandler) {
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "printf_handler.h"
|
||||
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/blit_commands_helper.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
@@ -15,15 +16,13 @@
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/program/print_formatter.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/helpers/dispatch_info.h"
|
||||
#include "opencl/source/kernel/kernel.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
PrintfHandler::PrintfHandler(ClDevice &deviceArg) : device(deviceArg) {
|
||||
PrintfHandler::PrintfHandler(Device &deviceArg) : device(deviceArg) {
|
||||
printfSurfaceInitialDataSizePtr = std::make_unique<uint32_t>();
|
||||
*printfSurfaceInitialDataSizePtr = sizeof(uint32_t);
|
||||
}
|
||||
@@ -32,21 +31,15 @@ PrintfHandler::~PrintfHandler() {
|
||||
device.getMemoryManager()->freeGraphicsMemory(printfSurface);
|
||||
}
|
||||
|
||||
PrintfHandler *PrintfHandler::create(const MultiDispatchInfo &multiDispatchInfo, ClDevice &device) {
|
||||
PrintfHandler *PrintfHandler::create(const MultiDispatchInfo &multiDispatchInfo, Device &device) {
|
||||
if (multiDispatchInfo.usesStatelessPrintfSurface()) {
|
||||
return new PrintfHandler(device);
|
||||
}
|
||||
auto mainKernel = multiDispatchInfo.peekMainKernel();
|
||||
if (mainKernel != nullptr) {
|
||||
if (mainKernel->getImplicitArgs()) {
|
||||
return new PrintfHandler(device);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo) {
|
||||
auto printfSurfaceSize = device.getSharedDeviceInfo().printfBufferSize;
|
||||
auto printfSurfaceSize = device.getDeviceInfo().printfBufferSize;
|
||||
if (printfSurfaceSize == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -58,22 +51,19 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo)
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
|
||||
MemoryTransferHelper::transferMemoryToAllocation(hwInfoConfig.isBlitCopyRequiredForLocalMemory(hwInfo, *printfSurface),
|
||||
device.getDevice(), printfSurface, 0, printfSurfaceInitialDataSizePtr.get(),
|
||||
device, printfSurface, 0, printfSurfaceInitialDataSizePtr.get(),
|
||||
sizeof(*printfSurfaceInitialDataSizePtr.get()));
|
||||
|
||||
if (kernel->getKernelInfo().kernelDescriptor.kernelAttributes.flags.usesPrintf) {
|
||||
|
||||
const auto &printfSurfaceArg = kernel->getKernelInfo().kernelDescriptor.payloadMappings.implicitArgs.printfSurfaceAddress;
|
||||
auto printfPatchAddress = ptrOffset(reinterpret_cast<uintptr_t *>(kernel->getCrossThreadData()), printfSurfaceArg.stateless);
|
||||
patchWithRequiredSize(printfPatchAddress, printfSurfaceArg.pointerSize, (uintptr_t)printfSurface->getGpuAddressToPatch());
|
||||
if (isValidOffset(printfSurfaceArg.bindful)) {
|
||||
auto surfaceState = ptrOffset(reinterpret_cast<uintptr_t *>(kernel->getSurfaceStateHeap()), printfSurfaceArg.bindful);
|
||||
void *addressToPatch = printfSurface->getUnderlyingBuffer();
|
||||
size_t sizeToPatch = printfSurface->getUnderlyingBufferSize();
|
||||
Buffer::setSurfaceState(&device.getDevice(), surfaceState, false, false, sizeToPatch, addressToPatch, 0, printfSurface, 0, 0,
|
||||
kernel->getKernelInfo().kernelDescriptor.kernelAttributes.flags.useGlobalAtomics,
|
||||
kernel->areMultipleSubDevicesInContext());
|
||||
}
|
||||
const auto &printfSurfaceArg = kernel->getKernelInfo().kernelDescriptor.payloadMappings.implicitArgs.printfSurfaceAddress;
|
||||
auto printfPatchAddress = ptrOffset(reinterpret_cast<uintptr_t *>(kernel->getCrossThreadData()), printfSurfaceArg.stateless);
|
||||
patchWithRequiredSize(printfPatchAddress, printfSurfaceArg.pointerSize, (uintptr_t)printfSurface->getGpuAddressToPatch());
|
||||
if (isValidOffset(printfSurfaceArg.bindful)) {
|
||||
auto surfaceState = ptrOffset(reinterpret_cast<uintptr_t *>(kernel->getSurfaceStateHeap()), printfSurfaceArg.bindful);
|
||||
void *addressToPatch = printfSurface->getUnderlyingBuffer();
|
||||
size_t sizeToPatch = printfSurface->getUnderlyingBufferSize();
|
||||
Buffer::setSurfaceState(&device, surfaceState, false, false, sizeToPatch, addressToPatch, 0, printfSurface, 0, 0,
|
||||
kernel->getKernelInfo().kernelDescriptor.kernelAttributes.flags.useGlobalAtomics,
|
||||
kernel->areMultipleSubDevicesInContext());
|
||||
}
|
||||
auto pImplicitArgs = kernel->getImplicitArgs();
|
||||
if (pImplicitArgs) {
|
||||
@@ -107,7 +97,7 @@ bool PrintfHandler::printEnqueueOutput() {
|
||||
printfSurface->getGpuAddress(),
|
||||
0, 0, 0, Vec3<size_t>(printfOutputSize, 0, 0), 0, 0, 0, 0));
|
||||
|
||||
const auto newTaskCount = bcsEngine.commandStreamReceiver->flushBcsTask(blitPropertiesContainer, true, false, device.getDevice());
|
||||
const auto newTaskCount = bcsEngine.commandStreamReceiver->flushBcsTask(blitPropertiesContainer, true, false, device);
|
||||
if (!newTaskCount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -7,18 +7,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
|
||||
#include "opencl/source/kernel/kernel.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class ClDevice;
|
||||
class CommandStreamReceiver;
|
||||
class Kernel;
|
||||
class GraphicsAllocation;
|
||||
class Device;
|
||||
struct MultiDispatchInfo;
|
||||
|
||||
class PrintfHandler {
|
||||
public:
|
||||
static PrintfHandler *create(const MultiDispatchInfo &multiDispatchInfo, ClDevice &deviceArg);
|
||||
static PrintfHandler *create(const MultiDispatchInfo &multiDispatchInfo, Device &deviceArg);
|
||||
|
||||
MOCKABLE_VIRTUAL ~PrintfHandler();
|
||||
|
||||
@@ -31,10 +33,10 @@ class PrintfHandler {
|
||||
}
|
||||
|
||||
protected:
|
||||
PrintfHandler(ClDevice &device);
|
||||
PrintfHandler(Device &device);
|
||||
|
||||
std::unique_ptr<uint32_t> printfSurfaceInitialDataSizePtr;
|
||||
ClDevice &device;
|
||||
Device &device;
|
||||
Kernel *kernel = nullptr;
|
||||
GraphicsAllocation *printfSurface = nullptr;
|
||||
};
|
||||
|
||||
@@ -435,7 +435,7 @@ HWTEST_F(DispatchFlagsTests, givenMockKernelWhenSettingAdditionalKernelExecInfoT
|
||||
auto pKernel = mockKernelWithInternals.mockKernel;
|
||||
MockMultiDispatchInfo multiDispatchInfo(device.get(), pKernel);
|
||||
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device.get()));
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, device->getDevice()));
|
||||
IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::Type::DYNAMIC_STATE, 4096u, dsh);
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::Type::INDIRECT_OBJECT, 4096u, ioh);
|
||||
|
||||
@@ -44,7 +44,7 @@ HWTEST2_F(DispatchFlagsTests, whenSubmittingKernelWithAdditionalKernelExecInfoTh
|
||||
auto pKernel = mockKernelWithInternals.mockKernel;
|
||||
MockMultiDispatchInfo multiDispatchInfo(device.get(), pKernel);
|
||||
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device.get()));
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, device->getDevice()));
|
||||
IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::Type::DYNAMIC_STATE, 4096u, dsh);
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::Type::INDIRECT_OBJECT, 4096u, ioh);
|
||||
|
||||
@@ -630,13 +630,11 @@ HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfBlockedByEventWhenEventUn
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
std::string testString = "test";
|
||||
mockKernel.kernelInfo.addToPrintfStringsMap(0, testString);
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.flags.usesPrintf = false;
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.flags.usesPrintf = true;
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.flags.usesStringMapForPrintf = true;
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::Patchtokens;
|
||||
UnitTestHelper<FamilyType>::adjustKernelDescriptorForImplicitArgs(mockKernel.kernelInfo.kernelDescriptor);
|
||||
mockKernel.mockKernel->pImplicitArgs = std::make_unique<ImplicitArgs>();
|
||||
*mockKernel.mockKernel->pImplicitArgs = {};
|
||||
|
||||
mockKernel.kernelInfo.setBufferAddressingMode(KernelDescriptor::Stateless);
|
||||
mockKernel.kernelInfo.setPrintfSurface(sizeof(uintptr_t), 8);
|
||||
cl_uint workDim = 1;
|
||||
size_t globalWorkOffset[3] = {0, 0, 0};
|
||||
|
||||
@@ -671,7 +669,7 @@ HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfBlockedByEventWhenEventUn
|
||||
EXPECT_STREQ("test", output.c_str());
|
||||
}
|
||||
|
||||
HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfWithStringMapDisbaledAndImplicitArgsBlockedByEventWhenEventUnblockedThenOutputPrinted) {
|
||||
HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfWithStringMapDisbaledAndImplicitArgsBlockedByEventWhenEventUnblockedThenNoOutputPrinted) {
|
||||
auto userEvent = makeReleaseable<UserEvent>(context);
|
||||
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
@@ -705,9 +703,7 @@ HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfWithStringMapDisbaledAndI
|
||||
|
||||
auto pOutEvent = castToObject<Event>(outEvent);
|
||||
|
||||
auto printfAllocation = reinterpret_cast<uint32_t *>(static_cast<CommandComputeKernel *>(pOutEvent->peekCommand())->peekPrintfHandler()->getSurface()->getUnderlyingBuffer());
|
||||
printfAllocation[0] = 8;
|
||||
printfAllocation[1] = 0;
|
||||
EXPECT_EQ(nullptr, static_cast<CommandComputeKernel *>(pOutEvent->peekCommand())->peekPrintfHandler());
|
||||
|
||||
pOutEvent->release();
|
||||
|
||||
@@ -715,7 +711,7 @@ HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfWithStringMapDisbaledAndI
|
||||
userEvent->setStatus(CL_COMPLETE);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_STREQ("test", output.c_str());
|
||||
EXPECT_STREQ("", output.c_str());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(EnqueueKernel,
|
||||
|
||||
@@ -1138,7 +1138,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenGpuHangOnPrintEnqueueOutputWh
|
||||
|
||||
const auto blockedQueue{false};
|
||||
const auto cleanTemporaryAllocationsList{false};
|
||||
MockPrintfHandler printfHandler(*pClDevice);
|
||||
MockPrintfHandler printfHandler(*pDevice);
|
||||
|
||||
const auto waitStatus = commandQueue.waitForAllEngines(blockedQueue, &printfHandler, cleanTemporaryAllocationsList);
|
||||
EXPECT_EQ(WaitStatus::GpuHang, waitStatus);
|
||||
|
||||
@@ -567,7 +567,7 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut
|
||||
pKernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel);
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *pClDevice));
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *pDevice));
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
auto surface = printfHandler->getSurface();
|
||||
|
||||
@@ -619,7 +619,7 @@ TEST_F(InternalsEventTest, givenGpuHangOnCmdQueueWaitFunctionAndBlockedKernelWit
|
||||
pKernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel);
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *pClDevice));
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *pDevice));
|
||||
printfHandler.get()->prepareDispatch(multiDispatchInfo);
|
||||
auto surface = printfHandler.get()->getSurface();
|
||||
|
||||
@@ -668,7 +668,7 @@ TEST_F(InternalsEventTest, givenGpuHangOnPrintingEnqueueOutputAndBlockedKernelWi
|
||||
pKernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(pClDevice, pKernel);
|
||||
std::unique_ptr<MockPrintfHandler> printfHandler(new MockPrintfHandler(*pClDevice));
|
||||
std::unique_ptr<MockPrintfHandler> printfHandler(new MockPrintfHandler(*pDevice));
|
||||
printfHandler.get()->prepareDispatch(multiDispatchInfo);
|
||||
auto surface = printfHandler.get()->getSurface();
|
||||
|
||||
|
||||
@@ -514,13 +514,6 @@ TEST_F(MemoryAllocatorTest, givenAllocationWithoutFragmentsWhenCallingFreeGraphi
|
||||
EXPECT_EQ(1u, memoryManager->handleFenceCompletionCalled);
|
||||
}
|
||||
|
||||
class MockPrintfHandler : public PrintfHandler {
|
||||
public:
|
||||
static MockPrintfHandler *create(const MultiDispatchInfo &multiDispatchInfo, ClDevice &deviceArg) {
|
||||
return (MockPrintfHandler *)PrintfHandler::create(multiDispatchInfo, deviceArg);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCreatedThenPrintfSurfaceIsPatchedWithBaseAddressOffset) {
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
MockKernelWithInternals kernel(*device);
|
||||
@@ -529,7 +522,7 @@ TEST_F(MemoryAllocatorTest, givenStatelessKernelWithPrintfWhenPrintfSurfaceIsCre
|
||||
kernel.kernelInfo.setBufferAddressingMode(KernelDescriptor::Stateless);
|
||||
kernel.kernelInfo.setPrintfSurface(sizeof(uintptr_t), 8);
|
||||
|
||||
auto printfHandler = MockPrintfHandler::create(multiDispatchInfo, *device.get());
|
||||
auto printfHandler = PrintfHandler::create(multiDispatchInfo, device->getDevice());
|
||||
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
|
||||
@@ -552,7 +545,7 @@ HWTEST_F(MemoryAllocatorTest, givenStatefulKernelWithPrintfWhenPrintfSurfaceIsCr
|
||||
|
||||
kernel.kernelInfo.setPrintfSurface(sizeof(uintptr_t), 8, 16);
|
||||
|
||||
auto printfHandler = MockPrintfHandler::create(multiDispatchInfo, *device.get());
|
||||
auto printfHandler = PrintfHandler::create(multiDispatchInfo, device->getDevice());
|
||||
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
|
||||
@@ -586,7 +579,7 @@ TEST_F(MemoryAllocatorTest, given32BitDeviceWhenPrintfSurfaceIsCreatedThen32BitA
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel.mockKernel);
|
||||
|
||||
auto printfHandler = MockPrintfHandler::create(multiDispatchInfo, *device.get());
|
||||
auto printfHandler = PrintfHandler::create(multiDispatchInfo, device->getDevice());
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
|
||||
uint32_t *ptr32Bit = (uint32_t *)kernel.mockKernel->mockCrossThreadData.data();
|
||||
|
||||
@@ -13,10 +13,19 @@ using namespace NEO;
|
||||
|
||||
class MockPrintfHandler : public PrintfHandler {
|
||||
public:
|
||||
MockPrintfHandler(ClDevice &device) : PrintfHandler{device} {}
|
||||
using PrintfHandler::PrintfHandler;
|
||||
using PrintfHandler::printfSurface;
|
||||
using PrintfHandler::printfSurfaceInitialDataSizePtr;
|
||||
MockPrintfHandler(Device &device) : PrintfHandler{device} {}
|
||||
~MockPrintfHandler() override = default;
|
||||
|
||||
bool printEnqueueOutput() override {
|
||||
return false;
|
||||
if (callBasePrintEnqueueOutput) {
|
||||
return PrintfHandler::printEnqueueOutput();
|
||||
}
|
||||
return printEnqueueOutputReturnValue;
|
||||
}
|
||||
};
|
||||
|
||||
bool callBasePrintEnqueueOutput = false;
|
||||
bool printEnqueueOutputReturnValue = false;
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_mdi.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_printf_handler.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
|
||||
using namespace NEO;
|
||||
@@ -29,14 +30,7 @@ using namespace NEO;
|
||||
using PrintfHandlerTests = ::testing::Test;
|
||||
|
||||
TEST_F(PrintfHandlerTests, givenPrintfHandlerWhenBeingConstructedThenStorePrintfSurfaceInitialDataSize) {
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
struct MockPrintfHandler : public PrintfHandler {
|
||||
using PrintfHandler::PrintfHandler;
|
||||
using PrintfHandler::printfSurfaceInitialDataSizePtr;
|
||||
|
||||
MockPrintfHandler(ClDevice &device) : PrintfHandler(device) {}
|
||||
};
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
MockPrintfHandler printfHandler(*device);
|
||||
|
||||
@@ -55,7 +49,7 @@ TEST_F(PrintfHandlerTests, givenNotPreparedPrintfHandlerWhenGetSurfaceIsCalledTh
|
||||
MockKernel *pKernel = new MockKernel(pProgram, *pKernelInfo, *device);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(device, pKernel);
|
||||
PrintfHandler *printfHandler = PrintfHandler::create(multiDispatchInfo, *device);
|
||||
PrintfHandler *printfHandler = PrintfHandler::create(multiDispatchInfo, device->getDevice());
|
||||
|
||||
EXPECT_EQ(nullptr, printfHandler->getSurface());
|
||||
|
||||
@@ -80,7 +74,7 @@ TEST_F(PrintfHandlerTests, givenPreparedPrintfHandlerWithUndefinedSshOffsetWhenG
|
||||
pKernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(device, pKernel);
|
||||
PrintfHandler *printfHandler = PrintfHandler::create(multiDispatchInfo, *device);
|
||||
PrintfHandler *printfHandler = PrintfHandler::create(multiDispatchInfo, device->getDevice());
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
EXPECT_NE(nullptr, printfHandler->getSurface());
|
||||
|
||||
@@ -108,7 +102,7 @@ TEST_F(PrintfHandlerTests, givenKernelWithImplicitArgsWhenPreparingPrintfHandler
|
||||
kernel.initialize();
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(device.get(), &kernel);
|
||||
auto printfHandler = std::unique_ptr<PrintfHandler>(PrintfHandler::create(multiDispatchInfo, *device));
|
||||
auto printfHandler = std::unique_ptr<PrintfHandler>(PrintfHandler::create(multiDispatchInfo, device->getDevice()));
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
|
||||
auto printfSurface = printfHandler->getSurface();
|
||||
@@ -143,7 +137,7 @@ HWTEST_F(PrintfHandlerTests, givenEnabledStatelessCompressionWhenPrintEnqueueOut
|
||||
kernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel.get());
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device));
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, device->getDevice()));
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
EXPECT_NE(nullptr, printfHandler->getSurface());
|
||||
|
||||
@@ -182,7 +176,7 @@ HWTEST_F(PrintfHandlerTests, givenGpuHangOnFlushBcsStreamAndEnabledStatelessComp
|
||||
kernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel.get());
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device));
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, device->getDevice()));
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
EXPECT_NE(nullptr, printfHandler->getSurface());
|
||||
|
||||
@@ -201,14 +195,6 @@ HWTEST_F(PrintfHandlerTests, givenDisallowedLocalMemoryCpuAccessWhenPrintEnqueue
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
REQUIRE_BLITTER_OR_SKIP(&hwInfo);
|
||||
|
||||
class MockPrintfHandler : public PrintfHandler {
|
||||
public:
|
||||
using PrintfHandler::PrintfHandler;
|
||||
using PrintfHandler::printfSurface;
|
||||
|
||||
MockPrintfHandler(ClDevice &device) : PrintfHandler(device) {}
|
||||
};
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::CpuAccessDisallowed));
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
@@ -226,8 +212,9 @@ HWTEST_F(PrintfHandlerTests, givenDisallowedLocalMemoryCpuAccessWhenPrintEnqueue
|
||||
kernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(device.get(), kernel.get());
|
||||
auto printfHandler = std::make_unique<MockPrintfHandler>(*device);
|
||||
auto printfHandler = std::make_unique<MockPrintfHandler>(device->getDevice());
|
||||
|
||||
printfHandler->callBasePrintEnqueueOutput = true;
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
EXPECT_NE(nullptr, printfHandler->getSurface());
|
||||
|
||||
@@ -321,7 +308,7 @@ TEST_F(PrintfHandlerTests, givenMultiDispatchInfoWithMultipleKernelsWhenCreating
|
||||
multiDispatchInfo.push(mainDispatchInfo);
|
||||
multiDispatchInfo.push(dispatchInfo2);
|
||||
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device));
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, device->getDevice()));
|
||||
ASSERT_NE(nullptr, printfHandler.get());
|
||||
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
@@ -335,7 +322,7 @@ TEST_F(PrintfHandlerTests, GivenEmptyMultiDispatchInfoWhenCreatingPrintfHandlerT
|
||||
multiDispatchInfo.dispatchInfos.resize(0);
|
||||
EXPECT_EQ(nullptr, multiDispatchInfo.peekMainKernel());
|
||||
|
||||
auto printfHandler = PrintfHandler::create(multiDispatchInfo, device);
|
||||
auto printfHandler = PrintfHandler::create(multiDispatchInfo, device.getDevice());
|
||||
EXPECT_EQ(nullptr, printfHandler);
|
||||
}
|
||||
|
||||
@@ -378,7 +365,7 @@ TEST_F(PrintfHandlerTests, GivenAllocationInLocalMemoryWhichRequiresBlitterWhenP
|
||||
kernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(pClDevice.get(), kernel.get());
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *pClDevice));
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, pClDevice->getDevice()));
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
|
||||
if (printfHandler->getSurface()->isAllocatedInLocalMemoryPool() &&
|
||||
@@ -403,7 +390,7 @@ TEST_F(PrintfHandlerMultiRootDeviceTests, GivenPrintfSurfaceThenItHasCorrectRoot
|
||||
kernel->setCrossThreadData(&crossThread, sizeof(uint64_t) * 8);
|
||||
|
||||
MockMultiDispatchInfo multiDispatchInfo(device1, kernel.get());
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, *device1));
|
||||
std::unique_ptr<PrintfHandler> printfHandler(PrintfHandler::create(multiDispatchInfo, device1->getDevice()));
|
||||
printfHandler->prepareDispatch(multiDispatchInfo);
|
||||
auto surface = printfHandler->getSurface();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user