mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
Cleanup includes 34
Cleaned up files: opencl/source/command_queue/cl_local_work_size.h opencl/test/unit_test/mocks/mock_buffer.h shared/source/program/kernel_info.cpp Related-To: NEO-5548 Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ba95e8b465
commit
16d5a323c7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/vec.h"
|
||||
#include "shared/source/program/kernel_info.h"
|
||||
#include "shared/source/program/work_size_info.h"
|
||||
|
||||
namespace NEO {
|
||||
class Context;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/source/helpers/pause_on_gpu_properties.h"
|
||||
#include "shared/source/helpers/vec.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/command_stream/wait_status.h"
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/helpers/array_count.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/engine_node_helper.h"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/command_queue/csr_selection_args.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/local_work_size.h"
|
||||
#include "shared/source/kernel/kernel_descriptor.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_event.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/utilities/arrayref.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/sharings/d3d/cl_d3d_api.h"
|
||||
@@ -15,6 +16,7 @@
|
||||
#include "opencl/source/sharings/d3d/d3d_texture.h"
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_d3d_objects.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/helpers/properties_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/validators.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/source/api/cl_types.h"
|
||||
#include "opencl/source/helpers/base_object.h"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
#include "shared/source/unified_memory/unified_memory.h"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "opencl/source/kernel/kernel.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
#include "shared/test/common/mocks/mock_csr.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "opencl/extensions/public/cl_ext_private.h"
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/multi_root_device_fixture.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/mem_obj/map_operations_handler.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/memory_manager/allocations_list.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
|
||||
@@ -5,8 +5,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/mocks/mock_csr.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "opencl/source/memory_manager/mem_obj_surface.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# Copyright (C) 2018-2023 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -8,6 +8,7 @@ set(IGDRCL_SRCS_tests_mocks
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_async_event_handler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_async_event_handler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_buffer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_buffer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_cl_device.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_cl_device.h
|
||||
|
||||
100
opencl/test/unit_test/mocks/mock_buffer.cpp
Normal file
100
opencl/test/unit_test/mocks/mock_buffer.cpp
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
|
||||
MockBufferStorage::MockBufferStorage(bool unaligned) : mockGfxAllocation(unaligned ? alignUp(&data, 4) : alignUp(&data, 64), sizeof(data) / 2),
|
||||
multiGfxAllocation(GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation)) {
|
||||
initDevice();
|
||||
}
|
||||
|
||||
void MockBufferStorage::initDevice() {
|
||||
VariableBackup<uint32_t> maxOsContextCountBackup(&MemoryManager::maxOsContextCount);
|
||||
device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
}
|
||||
|
||||
MockBufferStorage::~MockBufferStorage() {
|
||||
if (mockGfxAllocation.getDefaultGmm()) {
|
||||
delete mockGfxAllocation.getDefaultGmm();
|
||||
}
|
||||
}
|
||||
|
||||
void MockBuffer::setAllocationType(uint32_t rootDeviceIndex, bool compressed) {
|
||||
setAllocationType(multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex),
|
||||
device->getRootDeviceEnvironment().getGmmHelper(), compressed);
|
||||
}
|
||||
|
||||
void MockBuffer::setAllocationType(GraphicsAllocation *graphicsAllocation, GmmHelper *gmmHelper, bool compressed) {
|
||||
if (compressed && !graphicsAllocation->getDefaultGmm()) {
|
||||
graphicsAllocation->setDefaultGmm(new Gmm(gmmHelper, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, compressed, {}, true));
|
||||
}
|
||||
|
||||
if (graphicsAllocation->getDefaultGmm()) {
|
||||
graphicsAllocation->getDefaultGmm()->isCompressionEnabled = compressed;
|
||||
}
|
||||
}
|
||||
|
||||
MockBuffer::MockBuffer(Context *context, GraphicsAllocation &alloc)
|
||||
: MockBufferStorage(), Buffer(
|
||||
context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(&alloc), true, false, false),
|
||||
externalAlloc(&alloc) {
|
||||
}
|
||||
|
||||
MockBuffer::MockBuffer()
|
||||
: MockBufferStorage(), Buffer(
|
||||
nullptr, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data,
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), true, false, false) {
|
||||
}
|
||||
|
||||
void MockBuffer::setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
||||
Buffer::setSurfaceState(this->device.get(), memory, forceNonAuxMode, disableL3, getSize(), getCpuAddress(), 0, (externalAlloc != nullptr) ? externalAlloc : &mockGfxAllocation, 0, 0, false, false);
|
||||
}
|
||||
|
||||
AlignedBuffer::AlignedBuffer() : MockBufferStorage(false), Buffer(
|
||||
nullptr, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), true, false, false) {
|
||||
}
|
||||
|
||||
AlignedBuffer::AlignedBuffer(Context *context, GraphicsAllocation *gfxAllocation)
|
||||
: MockBufferStorage(), Buffer(
|
||||
context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(gfxAllocation), true, false, false),
|
||||
externalAlloc(gfxAllocation) {
|
||||
}
|
||||
|
||||
void AlignedBuffer::setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
||||
Buffer::setSurfaceState(this->device.get(), memory, forceNonAuxMode, disableL3, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0, false, false);
|
||||
}
|
||||
|
||||
UnalignedBuffer::UnalignedBuffer() : MockBufferStorage(true), Buffer(
|
||||
nullptr, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), false, false, false) {
|
||||
}
|
||||
|
||||
UnalignedBuffer::UnalignedBuffer(Context *context, GraphicsAllocation *gfxAllocation)
|
||||
: MockBufferStorage(true), Buffer(
|
||||
context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(gfxAllocation), false, false, false),
|
||||
externalAlloc(gfxAllocation) {
|
||||
}
|
||||
|
||||
void UnalignedBuffer::setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
||||
Buffer::setSurfaceState(this->device.get(), memory, forceNonAuxMode, disableL3, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0, false, false);
|
||||
}
|
||||
@@ -6,14 +6,13 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
|
||||
namespace NEO {
|
||||
class MockDevice;
|
||||
}
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
@@ -24,19 +23,9 @@ class MockBufferStorage {
|
||||
initDevice();
|
||||
}
|
||||
|
||||
MockBufferStorage(bool unaligned) : mockGfxAllocation(unaligned ? alignUp(&data, 4) : alignUp(&data, 64), sizeof(data) / 2),
|
||||
multiGfxAllocation(GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation)) {
|
||||
initDevice();
|
||||
}
|
||||
void initDevice() {
|
||||
VariableBackup<uint32_t> maxOsContextCountBackup(&MemoryManager::maxOsContextCount);
|
||||
device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
}
|
||||
~MockBufferStorage() {
|
||||
if (mockGfxAllocation.getDefaultGmm()) {
|
||||
delete mockGfxAllocation.getDefaultGmm();
|
||||
}
|
||||
}
|
||||
MockBufferStorage(bool unaligned);
|
||||
void initDevice();
|
||||
~MockBufferStorage();
|
||||
char data[128];
|
||||
MockGraphicsAllocation mockGfxAllocation;
|
||||
std::unique_ptr<MockDevice> device;
|
||||
@@ -56,37 +45,15 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
||||
using MemObj::sizeInPoolAllocator;
|
||||
using MockBufferStorage::device;
|
||||
|
||||
void setAllocationType(uint32_t rootDeviceIndex, bool compressed) {
|
||||
setAllocationType(multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex),
|
||||
device->getRootDeviceEnvironment().getGmmHelper(), compressed);
|
||||
}
|
||||
void setAllocationType(uint32_t rootDeviceIndex, bool compressed);
|
||||
|
||||
static void setAllocationType(GraphicsAllocation *graphicsAllocation, GmmHelper *gmmHelper, bool compressed) {
|
||||
if (compressed && !graphicsAllocation->getDefaultGmm()) {
|
||||
graphicsAllocation->setDefaultGmm(new Gmm(gmmHelper, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, compressed, {}, true));
|
||||
}
|
||||
|
||||
if (graphicsAllocation->getDefaultGmm()) {
|
||||
graphicsAllocation->getDefaultGmm()->isCompressionEnabled = compressed;
|
||||
}
|
||||
}
|
||||
static void setAllocationType(GraphicsAllocation *graphicsAllocation, GmmHelper *gmmHelper, bool compressed);
|
||||
|
||||
MockBuffer(GraphicsAllocation &alloc) : MockBuffer(nullptr, alloc) {}
|
||||
|
||||
MockBuffer(Context *context, GraphicsAllocation &alloc)
|
||||
: MockBufferStorage(), Buffer(
|
||||
context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, alloc.getUnderlyingBufferSize(), alloc.getUnderlyingBuffer(), alloc.getUnderlyingBuffer(),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(&alloc), true, false, false),
|
||||
externalAlloc(&alloc) {
|
||||
}
|
||||
MockBuffer(Context *context, GraphicsAllocation &alloc);
|
||||
|
||||
MockBuffer()
|
||||
: MockBufferStorage(), Buffer(
|
||||
nullptr, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data), &data, &data,
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), true, false, false) {
|
||||
}
|
||||
MockBuffer();
|
||||
|
||||
~MockBuffer() override {
|
||||
if (externalAlloc != nullptr) {
|
||||
@@ -95,9 +62,7 @@ class MockBuffer : public MockBufferStorage, public Buffer {
|
||||
}
|
||||
}
|
||||
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override {
|
||||
Buffer::setSurfaceState(this->device.get(), memory, forceNonAuxMode, disableL3, getSize(), getCpuAddress(), 0, (externalAlloc != nullptr) ? externalAlloc : &mockGfxAllocation, 0, 0, false, false);
|
||||
}
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override;
|
||||
|
||||
void transferDataToHostPtr(MemObjSizeArray ©Size, MemObjOffsetArray ©Offset) override {
|
||||
++transferDataToHostPtrCalledCount;
|
||||
@@ -128,21 +93,11 @@ class AlignedBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
using MockBufferStorage::device;
|
||||
|
||||
AlignedBuffer() : MockBufferStorage(false), Buffer(
|
||||
nullptr, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), true, false, false) {
|
||||
}
|
||||
AlignedBuffer();
|
||||
|
||||
AlignedBuffer(GraphicsAllocation *gfxAllocation) : AlignedBuffer(nullptr, gfxAllocation) {}
|
||||
|
||||
AlignedBuffer(Context *context, GraphicsAllocation *gfxAllocation)
|
||||
: MockBufferStorage(), Buffer(
|
||||
context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 64), alignUp(&data, 64),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(gfxAllocation), true, false, false),
|
||||
externalAlloc(gfxAllocation) {
|
||||
}
|
||||
AlignedBuffer(Context *context, GraphicsAllocation *gfxAllocation);
|
||||
|
||||
~AlignedBuffer() override {
|
||||
if (externalAlloc != nullptr) {
|
||||
@@ -151,9 +106,7 @@ class AlignedBuffer : public MockBufferStorage, public Buffer {
|
||||
}
|
||||
}
|
||||
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override {
|
||||
Buffer::setSurfaceState(this->device.get(), memory, forceNonAuxMode, disableL3, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0, false, false);
|
||||
}
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override;
|
||||
|
||||
GraphicsAllocation *externalAlloc = nullptr;
|
||||
};
|
||||
@@ -162,21 +115,11 @@ class UnalignedBuffer : public MockBufferStorage, public Buffer {
|
||||
public:
|
||||
using MockBufferStorage::device;
|
||||
|
||||
UnalignedBuffer() : MockBufferStorage(true), Buffer(
|
||||
nullptr, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(&mockGfxAllocation), false, false, false) {
|
||||
}
|
||||
UnalignedBuffer();
|
||||
|
||||
UnalignedBuffer(GraphicsAllocation *gfxAllocation) : UnalignedBuffer(nullptr, gfxAllocation) {}
|
||||
|
||||
UnalignedBuffer(Context *context, GraphicsAllocation *gfxAllocation)
|
||||
: MockBufferStorage(true), Buffer(
|
||||
context, ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, MockBufferStorage::device.get()),
|
||||
CL_MEM_USE_HOST_PTR, 0, sizeof(data) / 2, alignUp(&data, 4), alignUp(&data, 4),
|
||||
GraphicsAllocationHelper::toMultiGraphicsAllocation(gfxAllocation), false, false, false),
|
||||
externalAlloc(gfxAllocation) {
|
||||
}
|
||||
UnalignedBuffer(Context *context, GraphicsAllocation *gfxAllocation);
|
||||
|
||||
~UnalignedBuffer() override {
|
||||
if (externalAlloc != nullptr) {
|
||||
@@ -185,9 +128,7 @@ class UnalignedBuffer : public MockBufferStorage, public Buffer {
|
||||
}
|
||||
}
|
||||
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override {
|
||||
Buffer::setSurfaceState(this->device.get(), memory, forceNonAuxMode, disableL3, getSize(), getCpuAddress(), 0, &mockGfxAllocation, 0, 0, false, false);
|
||||
}
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override;
|
||||
|
||||
GraphicsAllocation *externalAlloc = nullptr;
|
||||
};
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/source/program/printf_handler.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
#include "shared/test/common/utilities/base_object_utils.h"
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/event/async_events_handler.h"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/sharings/va/va_surface.h"
|
||||
|
||||
Reference in New Issue
Block a user