2020-01-12 01:25:26 +08: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 17:14:23 +08:00
|
|
|
* Copyright (C) 2020-2021 Intel Corporation
|
2020-01-12 01:25:26 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-09-30 03:10:53 +08:00
|
|
|
#include "shared/source/program/kernel_info.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/program/program_info.h"
|
2020-02-24 17:22:30 +08: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 17:14:23 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
2020-01-12 01:25:26 +08:00
|
|
|
|
|
|
|
#include "gmock/gmock.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2020-01-26 02:18:48 +08:00
|
|
|
TEST(ProgramInfoTests, WhenPrepareLinkerInputStorageGetsCalledTwiceThenLinkerInputStorageIsReused) {
|
2020-01-12 01:25:26 +08: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-26 02:18:48 +08: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) {
|
|
|
|
NEO::ProgramInfo programInfo;
|
|
|
|
programInfo.kernelInfos = {new NEO::KernelInfo(), new NEO::KernelInfo(), new NEO::KernelInfo()};
|
2021-04-08 17:05:45 +08:00
|
|
|
programInfo.kernelInfos[0]->kernelDescriptor.kernelAttributes.slmInlineSize = 16;
|
|
|
|
programInfo.kernelInfos[1]->kernelDescriptor.kernelAttributes.slmInlineSize = 64;
|
|
|
|
programInfo.kernelInfos[2]->kernelDescriptor.kernelAttributes.slmInlineSize = 32;
|
2020-01-26 02:18:48 +08: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 18:34:25 +08:00
|
|
|
programInfo.kernelInfos[1]->kernelDescriptor.payloadMappings.implicitArgs.localMemoryStatelessWindowStartAddres = 0U;
|
2020-01-26 02:18:48 +08:00
|
|
|
EXPECT_TRUE(NEO::requiresLocalMemoryWindowVA(programInfo));
|
2021-09-30 03:10:53 +08:00
|
|
|
}
|