Files
compute-runtime/unit_tests/gen9/kernel_tests_gen9.cpp
Filip Hazubski 8b57d28116 clang-format: enable sorting includes
Include files are now grouped and sorted in following order:
1. Header file of the class the current file implements
2. Project files
3. Third party files
4. Standard library

Change-Id: If31af05652184169f7fee1d7ad08f1b2ed602cf0
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
2019-02-27 11:50:07 +01:00

54 lines
1.7 KiB
C++

/*
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/gmm_helper/gmm_helper.h"
#include "runtime/helpers/kernel_commands.h"
#include "runtime/mem_obj/buffer.h"
#include "test.h"
#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);
}
using Gen9KernelCommandsTest = testing::Test;
GEN9TEST_F(Gen9KernelCommandsTest, givenGen9PlatformWhenDoBindingTablePrefetchIsCalledThenReturnsTrue) {
EXPECT_TRUE(KernelCommandsHelper<FamilyType>::doBindingTablePrefetch());
}
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);
buffer->setArgStateful(&surfaceState, false, false);
//make sure proper mocs is selected
constexpr uint32_t expectedMocs = GmmHelper::cacheEnabledIndex;
EXPECT_EQ(expectedMocs, surfaceState.getMemoryObjectControlStateIndexToMocsTables());
}