2018-03-27 14:30:05 +02:00
|
|
|
/*
|
2019-01-25 10:41:58 +01:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-03-27 14:30:05 +02:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-03-27 14:30:05 +02:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2019-01-25 10:41:58 +01:00
|
|
|
#include "runtime/gmm_helper/gmm_helper.h"
|
2018-09-17 09:24:21 +00:00
|
|
|
#include "runtime/helpers/kernel_commands.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "runtime/mem_obj/buffer.h"
|
|
|
|
|
#include "test.h"
|
2018-03-27 14:30:05 +02:00
|
|
|
#include "unit_tests/fixtures/device_fixture.h"
|
|
|
|
|
#include "unit_tests/mocks/mock_kernel.h"
|
|
|
|
|
|
|
|
|
|
using namespace OCLRT;
|
|
|
|
|
|
|
|
|
|
using Gen9KernelTest = Test<DeviceFixture>;
|
|
|
|
|
GEN9TEST_F(Gen9KernelTest, givenKernelWhenCanTransformImagesIsCalledThenReturnsTrue) {
|
|
|
|
|
MockKernelWithInternals mockKernel(*pDevice);
|
|
|
|
|
auto retVal = mockKernel.mockKernel->Kernel::canTransformImages();
|
|
|
|
|
EXPECT_TRUE(retVal);
|
|
|
|
|
}
|
2018-09-17 09:24:21 +00:00
|
|
|
using Gen9KernelCommandsTest = testing::Test;
|
|
|
|
|
GEN9TEST_F(Gen9KernelCommandsTest, givenGen9PlatformWhenDoBindingTablePrefetchIsCalledThenReturnsTrue) {
|
|
|
|
|
EXPECT_TRUE(KernelCommandsHelper<FamilyType>::doBindingTablePrefetch());
|
|
|
|
|
}
|
2019-01-25 10:41:58 +01:00
|
|
|
|
|
|
|
|
GEN9TEST_F(Gen9KernelCommandsTest, givenBufferThatIsNotZeroCopyWhenSurfaceStateisSetThenL3IsTurnedOn) {
|
|
|
|
|
MockContext context;
|
|
|
|
|
|
|
|
|
|
auto retVal = CL_SUCCESS;
|
|
|
|
|
char ptr[16u] = {};
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<Buffer> buffer(Buffer::create(
|
|
|
|
|
&context,
|
|
|
|
|
CL_MEM_USE_HOST_PTR,
|
|
|
|
|
16u,
|
|
|
|
|
ptr,
|
|
|
|
|
retVal));
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(buffer->isMemObjZeroCopy());
|
|
|
|
|
|
|
|
|
|
using RENDER_SURFACE_STATE = typename SKLFamily::RENDER_SURFACE_STATE;
|
|
|
|
|
RENDER_SURFACE_STATE surfaceState = {};
|
|
|
|
|
|
|
|
|
|
auto gmmHelper = context.getDevice(0)->getExecutionEnvironment()->getGmmHelper();
|
|
|
|
|
gmmHelper->setSimplifiedMocsTableUsage(true);
|
|
|
|
|
|
2019-02-05 21:41:51 +01:00
|
|
|
buffer->setArgStateful(&surfaceState, false, false);
|
2019-01-25 10:41:58 +01:00
|
|
|
//make sure proper mocs is selected
|
2019-02-01 17:16:29 +01:00
|
|
|
constexpr uint32_t expectedMocs = GmmHelper::cacheEnabledIndex;
|
|
|
|
|
EXPECT_EQ(expectedMocs, surfaceState.getMemoryObjectControlStateIndexToMocsTables());
|
2019-01-25 10:41:58 +01:00
|
|
|
}
|