mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Store device specific kernel members per root device
Related-To: NEO-5001 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
8d2cfd87ae
commit
aa1fc85257
@ -17,6 +17,7 @@
|
||||
#include "opencl/source/sharings/sharing.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
|
||||
#include "d3d_sharing_functions.h"
|
||||
|
||||
@ -128,6 +129,52 @@ void MockContext::initializeWithDevices(const ClDeviceVector &devices, bool noSp
|
||||
setupContextType();
|
||||
}
|
||||
|
||||
SchedulerKernel &MockContext::getSchedulerKernel() {
|
||||
if (schedulerBuiltIn->pKernel) {
|
||||
return *static_cast<SchedulerKernel *>(schedulerBuiltIn->pKernel);
|
||||
}
|
||||
|
||||
auto initializeSchedulerProgramAndKernel = [&] {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto clDevice = getDevice(0);
|
||||
auto src = SchedulerKernel::loadSchedulerKernel(&clDevice->getDevice());
|
||||
|
||||
auto program = Program::createBuiltInFromGenBinary(this,
|
||||
devices,
|
||||
src.resource.data(),
|
||||
src.resource.size(),
|
||||
&retVal);
|
||||
DEBUG_BREAK_IF(retVal != CL_SUCCESS);
|
||||
DEBUG_BREAK_IF(!program);
|
||||
|
||||
retVal = program->processGenBinary(*clDevice);
|
||||
DEBUG_BREAK_IF(retVal != CL_SUCCESS);
|
||||
|
||||
schedulerBuiltIn->pProgram = program;
|
||||
|
||||
KernelInfoContainer kernelInfos;
|
||||
kernelInfos.resize(getMaxRootDeviceIndex() + 1);
|
||||
for (auto rootDeviceIndex : rootDeviceIndices) {
|
||||
auto kernelInfo = schedulerBuiltIn->pProgram->getKernelInfo(SchedulerKernel::schedulerName, rootDeviceIndex);
|
||||
DEBUG_BREAK_IF(!kernelInfo);
|
||||
kernelInfos[rootDeviceIndex] = kernelInfo;
|
||||
}
|
||||
|
||||
schedulerBuiltIn->pKernel = Kernel::create<MockSchedulerKernel>(
|
||||
schedulerBuiltIn->pProgram,
|
||||
kernelInfos,
|
||||
&retVal);
|
||||
|
||||
UNRECOVERABLE_IF(schedulerBuiltIn->pKernel->getScratchSize(clDevice->getRootDeviceIndex()) != 0);
|
||||
|
||||
DEBUG_BREAK_IF(retVal != CL_SUCCESS);
|
||||
};
|
||||
std::call_once(schedulerBuiltIn->programIsInitialized, initializeSchedulerProgramAndKernel);
|
||||
|
||||
UNRECOVERABLE_IF(schedulerBuiltIn->pKernel == nullptr);
|
||||
return *static_cast<SchedulerKernel *>(schedulerBuiltIn->pKernel);
|
||||
}
|
||||
|
||||
MockDefaultContext::MockDefaultContext() : MockContext(nullptr, nullptr) {
|
||||
pRootDevice0 = ultClDeviceFactory.rootDevices[0];
|
||||
pRootDevice1 = ultClDeviceFactory.rootDevices[1];
|
||||
|
@ -47,6 +47,8 @@ class MockContext : public Context {
|
||||
std::unique_ptr<AsyncEventsHandler> &getAsyncEventsHandlerUniquePtr();
|
||||
void initializeWithDevices(const ClDeviceVector &devices, bool noSpecialQueue);
|
||||
|
||||
SchedulerKernel &getSchedulerKernel() override;
|
||||
|
||||
private:
|
||||
ClDevice *pDevice = nullptr;
|
||||
};
|
||||
|
@ -40,7 +40,6 @@ class MockKernel : public Kernel {
|
||||
using Kernel::kernelDeviceInfos;
|
||||
using Kernel::kernelSvmGfxAllocations;
|
||||
using Kernel::kernelUnifiedMemoryGfxAllocations;
|
||||
using Kernel::numberOfBindingTableStates;
|
||||
using Kernel::patchBufferOffset;
|
||||
using Kernel::patchWithImplicitSurface;
|
||||
using Kernel::svmAllocationsRequireCacheFlush;
|
||||
@ -595,6 +594,7 @@ class MockParentKernel : public Kernel {
|
||||
|
||||
class MockSchedulerKernel : public SchedulerKernel {
|
||||
public:
|
||||
using SchedulerKernel::kernelDeviceInfos;
|
||||
MockSchedulerKernel(Program *programArg, const KernelInfoContainer &kernelInfoArg) : SchedulerKernel(programArg, kernelInfoArg){};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user