2020-01-11 18:25:26 +01:00
|
|
|
/*
|
Remove PatchTokens from KernelInfo
Use KernelDescriptor instead of patchTokens stored in KernelInfo's
patchInfo.
Removed: SPatchMediaInterfaceDescriptorLoad, SPatchAllocateLocalSurface,
SPatchMediaVFEState(slot 0), SPatchMediaVFEState(slot 1),
SPatchInterfaceDescriptorData, SPatchSamplerStateArray,
SPatchBindingTableState, SPatchDataParameterBuffer,
SPatchDataParameterStream, SPatchThreadPayload,
SPatchKernelAttributesInfo, SPatchAllocateStatelessPrivateSurface,
SPatchAllocateSyncBuffer,
SPatchAllocateStatelessConstantMemorySurfaceWithInitialization,
SPatchAllocateStatelessGlobalMemorySurfaceWithInitialization,
SPatchAllocateSystemThreadSurface.
Related-To: NEO-4729
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
2021-03-04 10:14:23 +01:00
|
|
|
* Copyright (C) 2020-2021 Intel Corporation
|
2020-01-11 18:25:26 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/program/program_info.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2020-02-22 22:50:57 +01:00
|
|
|
#include "opencl/source/program/kernel_info.h"
|
Remove PatchTokens from KernelInfo
Use KernelDescriptor instead of patchTokens stored in KernelInfo's
patchInfo.
Removed: SPatchMediaInterfaceDescriptorLoad, SPatchAllocateLocalSurface,
SPatchMediaVFEState(slot 0), SPatchMediaVFEState(slot 1),
SPatchInterfaceDescriptorData, SPatchSamplerStateArray,
SPatchBindingTableState, SPatchDataParameterBuffer,
SPatchDataParameterStream, SPatchThreadPayload,
SPatchKernelAttributesInfo, SPatchAllocateStatelessPrivateSurface,
SPatchAllocateSyncBuffer,
SPatchAllocateStatelessConstantMemorySurfaceWithInitialization,
SPatchAllocateStatelessGlobalMemorySurfaceWithInitialization,
SPatchAllocateSystemThreadSurface.
Related-To: NEO-4729
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
2021-03-04 10:14:23 +01:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
2020-01-11 18:25:26 +01:00
|
|
|
|
|
|
|
|
#include "gmock/gmock.h"
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
2020-01-25 19:18:48 +01:00
|
|
|
TEST(ProgramInfoTests, WhenPrepareLinkerInputStorageGetsCalledTwiceThenLinkerInputStorageIsReused) {
|
2020-01-11 18:25:26 +01:00
|
|
|
NEO::ProgramInfo programInfo;
|
|
|
|
|
EXPECT_EQ(nullptr, programInfo.linkerInput);
|
|
|
|
|
programInfo.prepareLinkerInputStorage();
|
|
|
|
|
EXPECT_NE(nullptr, programInfo.linkerInput);
|
|
|
|
|
auto prevLinkerInput = programInfo.linkerInput.get();
|
|
|
|
|
programInfo.prepareLinkerInputStorage();
|
|
|
|
|
EXPECT_EQ(prevLinkerInput, programInfo.linkerInput.get());
|
|
|
|
|
}
|
2020-01-25 19:18:48 +01:00
|
|
|
|
|
|
|
|
TEST(GetMaxInlineSlmNeeded, GivenProgramWithoutKernelsThenReturn0) {
|
|
|
|
|
NEO::ProgramInfo programInfo;
|
|
|
|
|
EXPECT_EQ(0U, NEO::getMaxInlineSlmNeeded(programInfo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(GetMaxInlineSlmNeeded, GivenProgramWithKernelsNotRequirignSlmThenReturn0) {
|
|
|
|
|
NEO::ProgramInfo programInfo;
|
|
|
|
|
programInfo.kernelInfos = {new NEO::KernelInfo(), new NEO::KernelInfo(), new NEO::KernelInfo()};
|
|
|
|
|
EXPECT_EQ(0U, NEO::getMaxInlineSlmNeeded(programInfo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(GetMaxInlineSlmNeeded, GivenProgramWithKernelsThenReturnMaxOfInlineSlmNeededByKernels) {
|
|
|
|
|
iOpenCL::SPatchAllocateLocalSurface slmTokens[3] = {};
|
|
|
|
|
slmTokens[0].TotalInlineLocalMemorySize = 16;
|
|
|
|
|
slmTokens[1].TotalInlineLocalMemorySize = 64;
|
|
|
|
|
slmTokens[2].TotalInlineLocalMemorySize = 32;
|
|
|
|
|
NEO::ProgramInfo programInfo;
|
|
|
|
|
programInfo.kernelInfos = {new NEO::KernelInfo(), new NEO::KernelInfo(), new NEO::KernelInfo()};
|
Remove PatchTokens from KernelInfo
Use KernelDescriptor instead of patchTokens stored in KernelInfo's
patchInfo.
Removed: SPatchMediaInterfaceDescriptorLoad, SPatchAllocateLocalSurface,
SPatchMediaVFEState(slot 0), SPatchMediaVFEState(slot 1),
SPatchInterfaceDescriptorData, SPatchSamplerStateArray,
SPatchBindingTableState, SPatchDataParameterBuffer,
SPatchDataParameterStream, SPatchThreadPayload,
SPatchKernelAttributesInfo, SPatchAllocateStatelessPrivateSurface,
SPatchAllocateSyncBuffer,
SPatchAllocateStatelessConstantMemorySurfaceWithInitialization,
SPatchAllocateStatelessGlobalMemorySurfaceWithInitialization,
SPatchAllocateSystemThreadSurface.
Related-To: NEO-4729
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
2021-03-04 10:14:23 +01:00
|
|
|
populateKernelDescriptor(programInfo.kernelInfos[0]->kernelDescriptor, slmTokens[0]);
|
|
|
|
|
populateKernelDescriptor(programInfo.kernelInfos[1]->kernelDescriptor, slmTokens[1]);
|
|
|
|
|
populateKernelDescriptor(programInfo.kernelInfos[2]->kernelDescriptor, slmTokens[2]);
|
2020-01-25 19:18:48 +01:00
|
|
|
EXPECT_EQ(64U, NEO::getMaxInlineSlmNeeded(programInfo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(RequiresLocalMemoryWindowVA, GivenProgramWithoutKernelsThenReturnFalse) {
|
|
|
|
|
NEO::ProgramInfo programInfo;
|
|
|
|
|
EXPECT_FALSE(NEO::requiresLocalMemoryWindowVA(programInfo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(RequiresLocalMemoryWindowVA, GivenProgramWithKernelsNotLocalMemoryWindowVAThenReturnFalse) {
|
|
|
|
|
NEO::ProgramInfo programInfo;
|
|
|
|
|
programInfo.kernelInfos = {new NEO::KernelInfo(), new NEO::KernelInfo(), new NEO::KernelInfo()};
|
|
|
|
|
EXPECT_FALSE(NEO::requiresLocalMemoryWindowVA(programInfo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(RequiresLocalMemoryWindowVA, GivenProgramWithKernelsWhenSomeOfKernelRequireLocalMemoryWidnowVAThenReturnTrue) {
|
|
|
|
|
NEO::ProgramInfo programInfo;
|
|
|
|
|
programInfo.kernelInfos = {new NEO::KernelInfo(), new NEO::KernelInfo(), new NEO::KernelInfo()};
|
2021-03-29 12:34:25 +02:00
|
|
|
programInfo.kernelInfos[1]->kernelDescriptor.payloadMappings.implicitArgs.localMemoryStatelessWindowStartAddres = 0U;
|
2020-01-25 19:18:48 +01:00
|
|
|
EXPECT_TRUE(NEO::requiresLocalMemoryWindowVA(programInfo));
|
|
|
|
|
}
|