2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-02-22 16:28:27 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/kernel/kernel.inl"
|
|
|
|
#include "opencl/source/program/printf_handler.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
MockKernel::BlockPatchValues MockKernel::ReflectionSurfaceHelperPublic::devQueue;
|
|
|
|
MockKernel::BlockPatchValues MockKernel::ReflectionSurfaceHelperPublic::defaultQueue;
|
|
|
|
MockKernel::BlockPatchValues MockKernel::ReflectionSurfaceHelperPublic::eventPool;
|
|
|
|
MockKernel::BlockPatchValues MockKernel::ReflectionSurfaceHelperPublic::printfBuffer;
|
|
|
|
|
2018-03-21 19:58:30 +08:00
|
|
|
const uint32_t MockDebugKernel::perThreadSystemThreadSurfaceSize = 0x100;
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
template <>
|
|
|
|
void Kernel::ReflectionSurfaceHelper::patchBlocksCurbe<true>(void *reflectionSurface, uint32_t blockID,
|
|
|
|
uint64_t defaultDeviceQueueCurbeOffset, uint32_t patchSizeDefaultQueue, uint64_t defaultDeviceQueueGpuAddress,
|
|
|
|
uint64_t eventPoolCurbeOffset, uint32_t patchSizeEventPool, uint64_t eventPoolGpuAddress,
|
|
|
|
uint64_t deviceQueueCurbeOffset, uint32_t patchSizeDeviceQueue, uint64_t deviceQueueGpuAddress,
|
|
|
|
uint64_t printfBufferOffset, uint32_t patchSizePrintfBuffer, uint64_t printfBufferGpuAddress,
|
|
|
|
uint64_t privateSurfaceOffset, uint32_t privateSurfaceSize, uint64_t privateSurfaceGpuAddress) {
|
|
|
|
|
|
|
|
MockKernel::ReflectionSurfaceHelperPublic::patchBlocksCurbeMock(reflectionSurface, blockID,
|
|
|
|
defaultDeviceQueueCurbeOffset, patchSizeDefaultQueue, defaultDeviceQueueGpuAddress,
|
|
|
|
eventPoolCurbeOffset, patchSizeEventPool, eventPoolGpuAddress,
|
|
|
|
deviceQueueCurbeOffset, patchSizeDeviceQueue, deviceQueueGpuAddress,
|
|
|
|
printfBufferOffset, patchSizePrintfBuffer, printfBufferGpuAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
template void Kernel::patchReflectionSurface<true>(DeviceQueue *, PrintfHandler *);
|
|
|
|
|
2020-12-03 02:19:05 +08:00
|
|
|
const KernelInfoContainer MockKernel::toKernelInfoContainer(const KernelInfo &kernelInfo, uint32_t rootDeviceIndex) {
|
|
|
|
KernelInfoContainer kernelInfos;
|
|
|
|
kernelInfos.resize(rootDeviceIndex + 1);
|
|
|
|
kernelInfos[rootDeviceIndex] = &kernelInfo;
|
|
|
|
return kernelInfos;
|
|
|
|
}
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
bool MockKernel::isPatched() const {
|
2019-11-08 01:49:46 +08:00
|
|
|
return isPatchedOverride;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2018-03-27 20:30:05 +08:00
|
|
|
bool MockKernel::canTransformImages() const {
|
|
|
|
return canKernelTransformImages;
|
|
|
|
}
|
|
|
|
|
2018-02-16 16:15:36 +08:00
|
|
|
void MockKernel::makeResident(CommandStreamReceiver &commandStreamReceiver) {
|
|
|
|
makeResidentCalls++;
|
|
|
|
Kernel::makeResident(commandStreamReceiver);
|
|
|
|
}
|
|
|
|
|
2020-11-25 00:07:54 +08:00
|
|
|
void MockKernel::getResidency(std::vector<Surface *> &dst, uint32_t rootDeviceIndex) {
|
2018-02-16 16:15:36 +08:00
|
|
|
getResidencyCalls++;
|
2020-11-25 00:07:54 +08:00
|
|
|
Kernel::getResidency(dst, rootDeviceIndex);
|
2018-02-16 16:15:36 +08:00
|
|
|
}
|
2019-02-21 23:59:10 +08:00
|
|
|
bool MockKernel::requiresCacheFlushCommand(const CommandQueue &commandQueue) const {
|
2019-07-11 21:25:20 +08:00
|
|
|
if (DebugManager.flags.EnableCacheFlushAfterWalker.get() != -1) {
|
|
|
|
return !!DebugManager.flags.EnableCacheFlushAfterWalker.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2019-02-21 23:59:10 +08:00
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|