mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
Cleanup MockGmm
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
42115e4a1d
commit
8f81f2ae8d
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_resource_info.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
@@ -16,7 +17,6 @@
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/image_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
@@ -441,10 +441,10 @@ HWTEST_P(AubSurfaceDumpTests, givenGraphicsAllocationWhenGetDumpSurfaceIsCalledA
|
||||
}
|
||||
|
||||
if (AubAllocDump::isImageDumpFormat(dumpFormat)) {
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 512;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageWidth = 512;
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo);
|
||||
AllocationData allocationData;
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.h"
|
||||
#include "opencl/test/unit_test/command_queue/command_enqueue_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
#include <memory>
|
||||
@@ -86,7 +86,8 @@ HWTEST_F(AUBCreateImageArray, Given1DImageArrayThenExpectationsMet) {
|
||||
imageDesc.image_height = 1;
|
||||
cl_mem_flags flags = CL_MEM_COPY_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
auto imageDescriptor = Image::convertDescriptor(imageDesc);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
|
||||
imgInfo.linearStorage = !hwHelper.tilingAllowed(false, Image::isImage1d(imageDesc), false);
|
||||
auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo);
|
||||
|
||||
@@ -164,7 +165,8 @@ HWTEST_F(AUBCreateImageArray, Given2DImageArrayThenExpectationsMet) {
|
||||
|
||||
cl_mem_flags flags = CL_MEM_COPY_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
auto imageDescriptor = Image::convertDescriptor(imageDesc);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
|
||||
imgInfo.linearStorage = !hwHelper.tilingAllowed(false, Image::isImage1d(imageDesc), false);
|
||||
auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo);
|
||||
|
||||
@@ -285,7 +287,8 @@ INSTANTIATE_TEST_CASE_P(
|
||||
|
||||
HWTEST_P(CopyHostPtrTest, GivenImageWithDoubledRowPitchWhenCreatedWithCopyHostPtrFlagThenHasProperRowPitchSet) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
auto imageDescriptor = Image::convertDescriptor(imageDesc);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
|
||||
|
||||
MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo);
|
||||
auto lineWidth = imageDesc.image_width * elementSize;
|
||||
@@ -355,7 +358,8 @@ HWTEST_P(UseHostPtrTest, GivenImageWithRowPitchWhenCreatedWithUseHostPtrFlagThen
|
||||
imageDesc.image_width = 546;
|
||||
imageDesc.image_height = 1;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
auto imageDescriptor = Image::convertDescriptor(imageDesc);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
|
||||
MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo);
|
||||
auto passedRowPitch = imgInfo.rowPitch + 32;
|
||||
imageDesc.image_row_pitch = passedRowPitch;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/test/unit_test/command_queue/command_queue_fixture.h"
|
||||
#include "opencl/test/unit_test/command_queue/enqueue_map_buffer_fixture.h"
|
||||
@@ -16,7 +17,6 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.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_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "test.h"
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/mocks/mock_csr.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/sharings/gl/gl_buffer.h"
|
||||
#include "opencl/test/unit_test/command_queue/enqueue_fixture.h"
|
||||
@@ -18,7 +19,6 @@
|
||||
#include "opencl/test/unit_test/fixtures/memory_management_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_submissions_aggregator.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/source/event/user_event.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "shared/test/common/mocks/mock_aub_center.h"
|
||||
#include "shared/test/common/mocks/mock_aub_manager.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
||||
|
||||
@@ -22,7 +23,6 @@
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_aub_csr.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_aub_subcapture_manager.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_mdi.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_os_context.h"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "shared/test/common/mocks/mock_aub_manager.h"
|
||||
#include "shared/test/common/mocks/mock_csr.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
||||
@@ -28,7 +29,6 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_aub_csr.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_aub_subcapture_manager.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_mdi.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_os_context.h"
|
||||
@@ -579,10 +579,10 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh
|
||||
aubCsr->setupContext(osContext);
|
||||
aubCsr->initializeEngine();
|
||||
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 512;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageWidth = 512;
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/mocks/mock_aub_manager.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_csr_simulated_common_hw.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_os_context.h"
|
||||
#include "test.h"
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include "driver_diagnostics_tests.h"
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
|
||||
#include <tuple>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/api/api.h"
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
@@ -18,7 +19,6 @@
|
||||
#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_d3d_objects.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "test.h"
|
||||
|
||||
@@ -77,11 +77,11 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test {
|
||||
typedef typename D3D9::D3DTexture2d D3DTexture2d;
|
||||
|
||||
void setupMockGmm() {
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_height = 10;
|
||||
imgDesc.image_width = 10;
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageHeight = 10;
|
||||
imgDesc.imageWidth = 10;
|
||||
imgDesc.imageDepth = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
gmm = MockGmm::queryImgParams(pPlatform->getClDevice(0)->getGmmClientContext(), imgInfo).release();
|
||||
mockGmmResInfo = reinterpret_cast<NiceMock<MockGmmResourceInfo> *>(gmm->gmmResourceInfo.get());
|
||||
@@ -1145,11 +1145,11 @@ TEST_P(D3D9ImageFormatTests, WhenGettingImageFormatThenValidFormatDetailsAreRetu
|
||||
using D3D9MultiRootDeviceTest = MultiRootDeviceFixture;
|
||||
|
||||
TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNullWhenCreatingSharedSurfaceAndRootDeviceIndexIsSpecifiedThenAllocationHasCorrectRootDeviceIndex) {
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_height = 10;
|
||||
imgDesc.image_width = 10;
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageHeight = 10;
|
||||
imgDesc.imageWidth = 10;
|
||||
imgDesc.imageDepth = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
auto gmm = MockGmm::queryImgParams(device1->getGmmClientContext(), imgInfo).release();
|
||||
|
||||
@@ -1178,11 +1178,11 @@ TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNullWhenCreatingSharedSurfaceAnd
|
||||
}
|
||||
|
||||
TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNotNullWhenCreatingSharedSurfaceAndRootDeviceIndexIsSpecifiedThenAllocationHasCorrectRootDeviceIndex) {
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_height = 10;
|
||||
imgDesc.image_width = 10;
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageHeight = 10;
|
||||
imgDesc.imageWidth = 10;
|
||||
imgDesc.imageDepth = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
auto gmm = MockGmm::queryImgParams(device1->getGmmClientContext(), imgInfo).release();
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.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_d3d_objects.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -80,11 +80,11 @@ class D3DTests : public PlatformFixture, public ::testing::Test {
|
||||
};
|
||||
|
||||
void setupMockGmm() {
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_height = 4;
|
||||
imgDesc.image_width = 4;
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageHeight = 4;
|
||||
imgDesc.imageWidth = 4;
|
||||
imgDesc.imageDepth = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
gmm = MockGmm::queryImgParams(pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), imgInfo).release();
|
||||
mockGmmResInfo = reinterpret_cast<NiceMock<MockGmmResourceInfo> *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
#include "shared/source/image/image_surface_state.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/fixtures/image_fixture.h"
|
||||
#include "opencl/test/unit_test/gen12lp/special_ult_helper_gen12lp.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
@@ -20,13 +20,14 @@
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_client_context.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "opencl/source/helpers/gmm_types_converter.h"
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "GL/gl.h"
|
||||
@@ -148,7 +149,8 @@ TEST_F(GmmTests, givenGmmCreatedFromExistingGmmThenHelperDoesNotReleaseParentGmm
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, GivenInvalidImageSizeWhenQueryingImgParamsThenImageInfoReturnsSizeZero) {
|
||||
cl_image_desc imgDesc = {CL_MEM_OBJECT_IMAGE2D};
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image1D;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
@@ -157,9 +159,9 @@ TEST_F(GmmTests, GivenInvalidImageSizeWhenQueryingImgParamsThenImageInfoReturnsS
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, GivenInvalidImageTypeWhenQueryingImgParamsThenExceptionIsThrown) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_width = 10;
|
||||
imgDesc.image_type = 0; // invalid
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageWidth = 10;
|
||||
imgDesc.imageType = ImageType::Invalid;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
EXPECT_THROW(MockGmm::queryImgParams(getGmmClientContext(), imgInfo), std::exception);
|
||||
@@ -167,13 +169,13 @@ TEST_F(GmmTests, GivenInvalidImageTypeWhenQueryingImgParamsThenExceptionIsThrown
|
||||
|
||||
TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) {
|
||||
const HardwareInfo *hwinfo = defaultHwInfo.get();
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
imgDesc.image_width = 17;
|
||||
imgDesc.image_height = 17;
|
||||
imgDesc.image_depth = 17;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image3D;
|
||||
imgDesc.imageWidth = 17;
|
||||
imgDesc.imageHeight = 17;
|
||||
imgDesc.imageDepth = 17;
|
||||
size_t pixelSize = 4;
|
||||
size_t minSize = imgDesc.image_width * imgDesc.image_height * imgDesc.image_depth * pixelSize;
|
||||
size_t minSize = imgDesc.imageWidth * imgDesc.imageHeight * imgDesc.imageDepth * pixelSize;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
@@ -226,55 +228,55 @@ TEST_F(GmmTests, givenPtrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet)
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedThenItHasDesiredPitchAndSize) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 329;
|
||||
imgDesc.image_height = 349;
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_row_pitch = 5312;
|
||||
imgDesc.buffer = (cl_mem)0x1000;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 329;
|
||||
imgDesc.imageHeight = 349;
|
||||
imgDesc.imageDepth = 1;
|
||||
imgDesc.imageRowPitch = 5312;
|
||||
imgDesc.fromParent = true;
|
||||
|
||||
ClSurfaceFormatInfo surfaceFormat = {{CL_RGBA, CL_FLOAT}, {GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, (GFX3DSTATE_SURFACEFORMAT)0, 0, 4, 4, 16}};
|
||||
SurfaceFormatInfo surfaceFormat = {GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, (GFX3DSTATE_SURFACEFORMAT)0, 0, 4, 4, 16};
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat);
|
||||
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation();
|
||||
|
||||
size_t expectedSize = imgDesc.image_row_pitch * imgDesc.image_height;
|
||||
size_t expectedSize = imgDesc.imageRowPitch * imgDesc.imageHeight;
|
||||
EXPECT_GE(renderSize, expectedSize);
|
||||
EXPECT_EQ(imgDesc.image_row_pitch, queryGmm->gmmResourceInfo->getRenderPitch());
|
||||
EXPECT_EQ(imgDesc.imageRowPitch, queryGmm->gmmResourceInfo->getRenderPitch());
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedAndPitchIsOverridenThenItHasDesiredPitchAndSize) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 329;
|
||||
imgDesc.image_height = 349;
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_row_pitch = 5376;
|
||||
imgDesc.buffer = (cl_mem)0x1000;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 329;
|
||||
imgDesc.imageHeight = 349;
|
||||
imgDesc.imageDepth = 1;
|
||||
imgDesc.imageRowPitch = 5376;
|
||||
imgDesc.fromParent = true;
|
||||
|
||||
ClSurfaceFormatInfo surfaceFormat = {{CL_RGBA, CL_FLOAT}, {GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, (GFX3DSTATE_SURFACEFORMAT)0, 0, 4, 4, 16}};
|
||||
SurfaceFormatInfo surfaceFormat = {GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, (GFX3DSTATE_SURFACEFORMAT)0, 0, 4, 4, 16};
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat);
|
||||
EXPECT_EQ(imgInfo.imgDesc.imageRowPitch, imgDesc.image_row_pitch);
|
||||
EXPECT_EQ(imgInfo.imgDesc.imageRowPitch, imgDesc.imageRowPitch);
|
||||
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation();
|
||||
|
||||
size_t expectedSize = imgDesc.image_row_pitch * imgDesc.image_height;
|
||||
size_t expectedSize = imgDesc.imageRowPitch * imgDesc.imageHeight;
|
||||
EXPECT_GE(renderSize, expectedSize);
|
||||
EXPECT_EQ(imgDesc.image_row_pitch, queryGmm->gmmResourceInfo->getRenderPitch());
|
||||
EXPECT_EQ(imgDesc.imageRowPitch, queryGmm->gmmResourceInfo->getRenderPitch());
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenPlanarFormatsWhenQueryingImageParamsThenUvOffsetIsQueried) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 4;
|
||||
imgDesc.image_height = 4;
|
||||
imgDesc.image_depth = 1;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageHeight = 4;
|
||||
imgDesc.imageWidth = 4;
|
||||
imgDesc.imageDepth = 1;
|
||||
|
||||
ClSurfaceFormatInfo surfaceFormatNV12 = {{CL_NV12_INTEL, CL_UNORM_INT8}, {GMM_FORMAT_NV12, GFX3DSTATE_SURFACEFORMAT_PLANAR_420_8, 0, 1, 1, 1}};
|
||||
ClSurfaceFormatInfo surfaceFormatP010 = {{CL_R, CL_UNORM_INT16}, {GMM_FORMAT_P010, GFX3DSTATE_SURFACEFORMAT_PLANAR_420_8, 0, 1, 2, 2}};
|
||||
SurfaceFormatInfo surfaceFormatNV12 = {GMM_FORMAT_NV12, GFX3DSTATE_SURFACEFORMAT_PLANAR_420_8, 0, 1, 1, 1};
|
||||
SurfaceFormatInfo surfaceFormatP010 = {GMM_FORMAT_P010, GFX3DSTATE_SURFACEFORMAT_PLANAR_420_8, 0, 1, 2, 2};
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormatNV12);
|
||||
imgInfo.yOffsetForUVPlane = 0;
|
||||
@@ -290,11 +292,11 @@ TEST_F(GmmTests, givenPlanarFormatsWhenQueryingImageParamsThenUvOffsetIsQueried)
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenTilingModeSetToTileYWhenHwSupportsTilingThenTileYFlagIsSet) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 4;
|
||||
imgDesc.image_height = 4;
|
||||
imgDesc.image_depth = 1;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 4;
|
||||
imgDesc.imageHeight = 4;
|
||||
imgDesc.imageDepth = 1;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
imgInfo.linearStorage = false;
|
||||
@@ -305,11 +307,11 @@ TEST_F(GmmTests, givenTilingModeSetToTileYWhenHwSupportsTilingThenTileYFlagIsSet
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenTilingModeSetToNonTiledWhenCreatingGmmThenLinearFlagIsSet) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 4;
|
||||
imgDesc.image_height = 4;
|
||||
imgDesc.image_depth = 1;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 4;
|
||||
imgDesc.imageHeight = 4;
|
||||
imgDesc.imageDepth = 1;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
imgInfo.linearStorage = true;
|
||||
@@ -322,14 +324,14 @@ TEST_F(GmmTests, givenTilingModeSetToNonTiledWhenCreatingGmmThenLinearFlagIsSet)
|
||||
TEST_F(GmmTests, givenZeroRowPitchWhenQueryImgFromBufferParamsThenCalculate) {
|
||||
MockGraphicsAllocation bufferAllocation(nullptr, 4096);
|
||||
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
imgDesc.image_row_pitch = 0;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 5;
|
||||
imgDesc.imageHeight = 5;
|
||||
imgDesc.imageRowPitch = 0;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
size_t expectedRowPitch = imgDesc.image_width * imgInfo.surfaceFormat->ImageElementSizeInBytes;
|
||||
size_t expectedRowPitch = imgDesc.imageWidth * imgInfo.surfaceFormat->ImageElementSizeInBytes;
|
||||
GmmTypesConverter::queryImgFromBufferParams(imgInfo, &bufferAllocation);
|
||||
|
||||
EXPECT_EQ(imgInfo.rowPitch, expectedRowPitch);
|
||||
@@ -338,12 +340,12 @@ TEST_F(GmmTests, givenZeroRowPitchWhenQueryImgFromBufferParamsThenCalculate) {
|
||||
TEST_F(GmmTests, givenNonZeroRowPitchWhenQueryImgFromBufferParamsThenUseUserValue) {
|
||||
MockGraphicsAllocation bufferAllocation(nullptr, 4096);
|
||||
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
imgDesc.image_row_pitch = 123;
|
||||
size_t expectedRowPitch = imgDesc.image_row_pitch;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 5;
|
||||
imgDesc.imageHeight = 5;
|
||||
imgDesc.imageRowPitch = 123;
|
||||
size_t expectedRowPitch = imgDesc.imageRowPitch;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
GmmTypesConverter::queryImgFromBufferParams(imgInfo, &bufferAllocation);
|
||||
@@ -400,11 +402,11 @@ TEST_F(GmmCanonizeTests, WhenDecanonizingThenCorrectAddressIsReturned) {
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenMipmapedInputWhenAskedForHalingThenNonDefaultValueIsReturned) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 60;
|
||||
imgDesc.image_height = 40;
|
||||
imgDesc.image_depth = 1;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 60;
|
||||
imgDesc.imageHeight = 40;
|
||||
imgDesc.imageDepth = 1;
|
||||
int mipLevel = 5;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, mipLevel, nullptr);
|
||||
@@ -515,26 +517,26 @@ TEST_P(GmmImgTest, WhenUpdatingImgInfoAndDescThenInformationIsCorrect) {
|
||||
expectedReqInfo[1].ReqRender = 1;
|
||||
expectedReqInfo[1].Plane = updateImgInfo.plane;
|
||||
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = GetParam();
|
||||
imgDesc.image_width = 60;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_array_size = 1;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = Image::convertType(GetParam());
|
||||
imgDesc.imageWidth = 60;
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageDepth = 1;
|
||||
imgDesc.imageArraySize = 1;
|
||||
cl_uint arrayIndex = 0;
|
||||
|
||||
if (imgDesc.image_type == CL_MEM_OBJECT_IMAGE2D || imgDesc.image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY || imgDesc.image_type == CL_MEM_OBJECT_IMAGE3D) {
|
||||
imgDesc.image_height = 40;
|
||||
if (imgDesc.imageType == ImageType::Image2D || imgDesc.imageType == ImageType::Image2DArray || imgDesc.imageType == ImageType::Image3D) {
|
||||
imgDesc.imageHeight = 40;
|
||||
}
|
||||
if (imgDesc.image_type == CL_MEM_OBJECT_IMAGE3D) {
|
||||
imgDesc.image_depth = 5;
|
||||
if (imgDesc.imageType == ImageType::Image3D) {
|
||||
imgDesc.imageDepth = 5;
|
||||
expectCalls = 2u;
|
||||
expectedReqInfo[0].Slice = 1;
|
||||
}
|
||||
|
||||
if (imgDesc.image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY ||
|
||||
imgDesc.image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY) {
|
||||
imgDesc.image_array_size = 5;
|
||||
if (imgDesc.imageType == ImageType::Image2DArray ||
|
||||
imgDesc.imageType == ImageType::Image1DArray) {
|
||||
imgDesc.imageArraySize = 5;
|
||||
expectCalls = 2u;
|
||||
arrayIndex = 2;
|
||||
expectedReqInfo[0].ArrayIndex = 1;
|
||||
@@ -550,10 +552,10 @@ TEST_P(GmmImgTest, WhenUpdatingImgInfoAndDescThenInformationIsCorrect) {
|
||||
queryGmm->updateImgInfoAndDesc(updateImgInfo, arrayIndex);
|
||||
EXPECT_EQ(expectCalls, mockResInfo->getOffsetCalled);
|
||||
|
||||
EXPECT_EQ(imgDesc.image_width, updateImgInfo.imgDesc.imageWidth);
|
||||
EXPECT_EQ(imgDesc.image_height, updateImgInfo.imgDesc.imageHeight);
|
||||
EXPECT_EQ(imgDesc.image_depth, updateImgInfo.imgDesc.imageDepth);
|
||||
EXPECT_EQ(imgDesc.image_array_size, updateImgInfo.imgDesc.imageArraySize);
|
||||
EXPECT_EQ(imgDesc.imageWidth, updateImgInfo.imgDesc.imageWidth);
|
||||
EXPECT_EQ(imgDesc.imageHeight, updateImgInfo.imgDesc.imageHeight);
|
||||
EXPECT_EQ(imgDesc.imageDepth, updateImgInfo.imgDesc.imageDepth);
|
||||
EXPECT_EQ(imgDesc.imageArraySize, updateImgInfo.imgDesc.imageArraySize);
|
||||
EXPECT_GT(updateImgInfo.imgDesc.imageRowPitch, 0u);
|
||||
EXPECT_GT(updateImgInfo.imgDesc.imageSlicePitch, 0u);
|
||||
|
||||
@@ -598,12 +600,12 @@ TEST_F(GmmImgTest, givenImgInfoWhenUpdatingOffsetsThenGmmIsCalledToGetOffsets) {
|
||||
uint32_t gmmGetBitsPerPixelOutput;
|
||||
};
|
||||
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
||||
imgDesc.image_width = 60;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_array_size = 10;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2DArray;
|
||||
imgDesc.imageWidth = 60;
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageDepth = 1;
|
||||
imgDesc.imageArraySize = 10;
|
||||
|
||||
ImageInfo imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
std::unique_ptr<Gmm> gmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
@@ -622,11 +624,11 @@ TEST_F(GmmImgTest, givenImgInfoWhenUpdatingOffsetsThenGmmIsCalledToGetOffsets) {
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, GivenPlaneWhenCopyingResourceBltThenResourceIsCopiedCorrectly) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
imgDesc.image_width = 17;
|
||||
imgDesc.image_height = 17;
|
||||
imgDesc.image_depth = 17;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image3D;
|
||||
imgDesc.imageWidth = 17;
|
||||
imgDesc.imageHeight = 17;
|
||||
imgDesc.imageDepth = 17;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
@@ -881,20 +883,19 @@ struct GmmCompressionTests : public MockExecutionEnvironmentGmmFixtureTest {
|
||||
}
|
||||
|
||||
void setupImgInfo() {
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 2;
|
||||
imgDesc.image_height = 2;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 2;
|
||||
imgDesc.imageHeight = 2;
|
||||
imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
imgInfo.preferRenderCompression = true;
|
||||
imgInfo.useLocalMemory = true;
|
||||
|
||||
// allowed for render compression:
|
||||
imgInfo.surfaceFormat = &SurfaceFormats::readWrite()[0].surfaceFormat;
|
||||
imgInfo.plane = GMM_YUV_PLANE::GMM_NO_PLANE;
|
||||
}
|
||||
|
||||
HardwareInfo *localPlatformDevice = nullptr;
|
||||
cl_image_desc imgDesc = {};
|
||||
ImageDescriptor imgDesc = {};
|
||||
ImageInfo imgInfo = {};
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_hw_helper.h"
|
||||
@@ -27,7 +28,6 @@
|
||||
#include "opencl/source/mem_obj/image.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_gmm.h"
|
||||
|
||||
#include "pipe_control_args.h"
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/helpers/mipmap.h"
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_image.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "shared/test/common/helpers/test_files.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.inl"
|
||||
#include "shared/test/common/libult/global_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_client_context.h"
|
||||
#include "shared/test/common/mocks/mock_sip.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
@@ -25,7 +26,6 @@
|
||||
|
||||
#include "opencl/source/os_interface/ocl_reg_path.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
#include "opencl/test/unit_test/ult_config_listener.h"
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/matchers.h"
|
||||
|
||||
@@ -25,7 +26,6 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
#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_gmm.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/buffer.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_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "test.h"
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/buffer_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device_info_map.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
@@ -16,7 +17,6 @@
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/raii_hw_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
|
||||
#include "test.h"
|
||||
|
||||
@@ -338,7 +338,8 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag
|
||||
|
||||
EXPECT_EQ(this->size, bufferGraphicsAllocation->getUnderlyingBufferSize());
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, &imageFromBuffer->getSurfaceFormatInfo());
|
||||
auto imageDescriptor = Image::convertDescriptor(imageDesc);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &imageFromBuffer->getSurfaceFormatInfo().surfaceFormat);
|
||||
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_TRUE(queryGmm->gmmResourceInfo->getSizeAllocation() >= this->size);
|
||||
@@ -369,7 +370,8 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag
|
||||
|
||||
EXPECT_EQ(this->size, bufferGraphicsAllocation->getUnderlyingBufferSize());
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, &imageFromBuffer->getSurfaceFormatInfo());
|
||||
auto imageDescriptor = Image::convertDescriptor(imageDesc);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &imageFromBuffer->getSurfaceFormatInfo().surfaceFormat);
|
||||
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_TRUE(queryGmm->gmmResourceInfo->getSizeAllocation() >= this->size);
|
||||
@@ -408,7 +410,8 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag
|
||||
|
||||
EXPECT_EQ(bufferSize, bufferGraphicsAllocation->getUnderlyingBufferSize());
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, &imageFromBuffer->getSurfaceFormatInfo());
|
||||
auto imageDescriptor = Image::convertDescriptor(imageDesc);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &imageFromBuffer->getSurfaceFormatInfo().surfaceFormat);
|
||||
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_GT(queryGmm->gmmResourceInfo->getSizeAllocation(), bufferSize);
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
@@ -91,7 +91,8 @@ HWTEST_F(CreateImage3DTest, GivenTiledOrForcedLinearWhenCreatingImageThenPropert
|
||||
bool defaultTiling = DebugManager.flags.ForceLinearImages.get();
|
||||
imageDesc.image_height = 1;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
auto imageDescriptor = Image::convertDescriptor(imageDesc);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
|
||||
MockGmm::queryImgParams(context->getDevice(0)->getGmmClientContext(), imgInfo);
|
||||
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, &context->getDevice(0)->getDevice());
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/source/memory_manager/surface.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_resource_info.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
@@ -21,7 +22,6 @@
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/image_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
#include "test.h"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/kernel_binary_helper.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
@@ -27,7 +28,6 @@
|
||||
#include "opencl/test/unit_test/mem_obj/image_compression_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "test.h"
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_client_context.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/image_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "test.h"
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
@@ -14,7 +15,6 @@
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/image_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
|
||||
#include "shared/source/aub/aub_helper.h"
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
|
||||
@@ -18,7 +20,6 @@
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/ult_cl_device_factory.h"
|
||||
#include "test.h"
|
||||
|
||||
|
||||
@@ -7,11 +7,13 @@
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
@@ -19,7 +21,6 @@
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_os_context.h"
|
||||
#include "test.h"
|
||||
|
||||
@@ -1026,10 +1027,10 @@ TEST(MemoryManagerTest, givenEnabledLocalMemoryWhenAllocatingSharedResourceCopyT
|
||||
|
||||
MockMemoryManager memoryManager(false, true, *executionEnvironment);
|
||||
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 512;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageWidth = 512;
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, deviceFactory.rootDevices[0]);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gfx_partition.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_page_table_mngr.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
@@ -46,7 +47,6 @@
|
||||
#include "opencl/test/unit_test/helpers/raii_hw_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_mdi.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_os_context.h"
|
||||
@@ -758,10 +758,10 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAskedForNon32BitAllocationWh
|
||||
TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenAllocateGraphicsMemoryForImageIsCalledThenGraphicsAllocationIsReturned) {
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
MockMemoryManager memoryManager(*executionEnvironment);
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 512;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageWidth = 512;
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
AllocationData allocationData;
|
||||
@@ -795,10 +795,10 @@ TEST(OsAgnosticMemoryManager, givenDestroyedTagAllocationWhenWaitForCompletiionT
|
||||
TEST(OsAgnosticMemoryManager, givenEnabledLocalMemoryWhenAllocateGraphicsMemoryForImageIsCalledThenUseLocalMemoryIsNotSet) {
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
MockMemoryManager memoryManager(false, true, *executionEnvironment);
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 1;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageWidth = 1;
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
AllocationData allocationData;
|
||||
@@ -814,25 +814,25 @@ TEST(OsAgnosticMemoryManager, givenHostPointerNotRequiringCopyWhenAllocateGraphi
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
MockMemoryManager memoryManager(false, false, *executionEnvironment);
|
||||
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 4;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageWidth = 4;
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageType = ImageType::Image1D;
|
||||
|
||||
cl_image_format imageFormat = {};
|
||||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
imageFormat.image_channel_order = CL_RGBA;
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, defaultHwInfo->capabilityTable.supportsOcl21Features);
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, defaultHwInfo->capabilityTable.supportsOcl21Features)->surfaceFormat;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, surfaceFormat);
|
||||
imgInfo.rowPitch = imgDesc.image_width * 4;
|
||||
imgInfo.slicePitch = imgInfo.rowPitch * imgDesc.image_height;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat);
|
||||
imgInfo.rowPitch = imgDesc.imageWidth * 4;
|
||||
imgInfo.slicePitch = imgInfo.rowPitch * imgDesc.imageHeight;
|
||||
imgInfo.size = imgInfo.slicePitch;
|
||||
imgInfo.linearStorage = true;
|
||||
|
||||
auto hostPtr = alignedMalloc(imgDesc.image_width * imgDesc.image_height * 4, MemoryConstants::pageSize);
|
||||
auto hostPtr = alignedMalloc(imgDesc.imageWidth * imgDesc.imageHeight * 4, MemoryConstants::pageSize);
|
||||
|
||||
bool copyRequired = MockMemoryManager::isCopyRequired(imgInfo, hostPtr);
|
||||
EXPECT_FALSE(copyRequired);
|
||||
@@ -854,10 +854,10 @@ TEST(OsAgnosticMemoryManager, givenHostPointerRequiringCopyWhenAllocateGraphicsM
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
MockMemoryManager memoryManager(false, false, *executionEnvironment);
|
||||
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 4;
|
||||
imgDesc.image_height = 4;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageHeight = 4;
|
||||
imgDesc.imageWidth = 4;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
|
||||
cl_image_format imageFormat = {};
|
||||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
@@ -866,12 +866,12 @@ TEST(OsAgnosticMemoryManager, givenHostPointerRequiringCopyWhenAllocateGraphicsM
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, defaultHwInfo->capabilityTable.supportsOcl21Features);
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, surfaceFormat);
|
||||
imgInfo.rowPitch = imgDesc.image_width * 4;
|
||||
imgInfo.slicePitch = imgInfo.rowPitch * imgDesc.image_height;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat->surfaceFormat);
|
||||
imgInfo.rowPitch = imgDesc.imageWidth * 4;
|
||||
imgInfo.slicePitch = imgInfo.rowPitch * imgDesc.imageHeight;
|
||||
imgInfo.size = imgInfo.slicePitch;
|
||||
|
||||
auto hostPtr = alignedMalloc(imgDesc.image_width * imgDesc.image_height * 4, MemoryConstants::pageSize);
|
||||
auto hostPtr = alignedMalloc(imgDesc.imageWidth * imgDesc.imageHeight * 4, MemoryConstants::pageSize);
|
||||
|
||||
bool copyRequired = MockMemoryManager::isCopyRequired(imgInfo, hostPtr);
|
||||
EXPECT_TRUE(copyRequired);
|
||||
@@ -890,10 +890,10 @@ TEST(OsAgnosticMemoryManager, givenEnabledCrossRootDeviceAccessFlagWhenAllocateG
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
MockMemoryManager memoryManager(false, false, *executionEnvironment);
|
||||
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 4;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageWidth = 4;
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageType = ImageType::Image1D;
|
||||
|
||||
cl_image_format imageFormat = {};
|
||||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
@@ -902,13 +902,13 @@ TEST(OsAgnosticMemoryManager, givenEnabledCrossRootDeviceAccessFlagWhenAllocateG
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, defaultHwInfo->capabilityTable.supportsOcl21Features);
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, surfaceFormat);
|
||||
imgInfo.rowPitch = imgDesc.image_width * 4;
|
||||
imgInfo.slicePitch = imgInfo.rowPitch * imgDesc.image_height;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat->surfaceFormat);
|
||||
imgInfo.rowPitch = imgDesc.imageWidth * 4;
|
||||
imgInfo.slicePitch = imgInfo.rowPitch * imgDesc.imageHeight;
|
||||
imgInfo.size = imgInfo.slicePitch;
|
||||
imgInfo.linearStorage = true;
|
||||
|
||||
auto hostPtr = alignedMalloc(imgDesc.image_width * imgDesc.image_height * 4, MemoryConstants::pageSize);
|
||||
auto hostPtr = alignedMalloc(imgDesc.imageWidth * imgDesc.imageHeight * 4, MemoryConstants::pageSize);
|
||||
|
||||
AllocationData allocationData;
|
||||
allocationData.imgInfo = &imgInfo;
|
||||
@@ -1641,10 +1641,10 @@ TEST(OsAgnosticMemoryManager, givenOsAgnosticMemoryManagerWithFlagEnable64kbpage
|
||||
TEST(MemoryManager, givenSharedResourceCopyWhenAllocatingGraphicsMemoryThenAllocateGraphicsMemoryForImageIsCalled) {
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
MockMemoryManager memoryManager(false, true, *executionEnvironment);
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 1;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageWidth = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
AllocationData allocationData;
|
||||
@@ -1661,10 +1661,10 @@ TEST(MemoryManager, givenImageAndLimitedGPUWhenAllocatingGraphicsMemoryThenAlloc
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
MockMemoryManager memoryManager(false, true, *executionEnvironment);
|
||||
memoryManager.limitedGPU = true;
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = 1;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageHeight = 1;
|
||||
imgDesc.imageWidth = 1;
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
AllocationData allocationData;
|
||||
|
||||
@@ -25,7 +25,6 @@ set(IGDRCL_SRCS_tests_mocks
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_csr_simulated_common_hw.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_device_queue.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_event.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_resource_info_ocl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_image.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_internal_allocation_storage.h
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_resource_info.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/source/helpers/surface_formats.h"
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
|
||||
namespace NEO {
|
||||
namespace MockGmmParams {
|
||||
static ClSurfaceFormatInfo mockSurfaceFormat;
|
||||
}
|
||||
|
||||
class MockGmm : public Gmm {
|
||||
public:
|
||||
using Gmm::Gmm;
|
||||
using Gmm::setupImageResourceParams;
|
||||
|
||||
MockGmm(GmmClientContext *clientContext) : Gmm(clientContext, nullptr, 1, 0, false){};
|
||||
|
||||
static std::unique_ptr<Gmm> queryImgParams(GmmClientContext *clientContext, ImageInfo &imgInfo) {
|
||||
return std::unique_ptr<Gmm>(new Gmm(clientContext, imgInfo, {}));
|
||||
}
|
||||
|
||||
static ImageInfo initImgInfo(cl_image_desc &imgDesc, int baseMipLevel, const ClSurfaceFormatInfo *surfaceFormat) {
|
||||
ImageInfo imgInfo = {};
|
||||
imgInfo.baseMipLevel = baseMipLevel;
|
||||
imgInfo.imgDesc = Image::convertDescriptor(imgDesc);
|
||||
if (!surfaceFormat) {
|
||||
ArrayRef<const ClSurfaceFormatInfo> readWriteSurfaceFormats = SurfaceFormats::readWrite();
|
||||
MockGmmParams::mockSurfaceFormat = readWriteSurfaceFormats[0]; // any valid format
|
||||
imgInfo.surfaceFormat = &MockGmmParams::mockSurfaceFormat.surfaceFormat;
|
||||
} else {
|
||||
imgInfo.surfaceFormat = &surfaceFormat->surfaceFormat;
|
||||
}
|
||||
return imgInfo;
|
||||
}
|
||||
|
||||
static GraphicsAllocation *allocateImage2d(MemoryManager &memoryManager) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
return memoryManager.allocateGraphicsMemoryWithProperties({mockRootDeviceIndex, true, imgInfo, GraphicsAllocation::AllocationType::IMAGE, mockDeviceBitfield});
|
||||
}
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/dispatch_flags_helper.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_page_table_mngr.h"
|
||||
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
|
||||
|
||||
@@ -33,7 +34,6 @@
|
||||
#include "opencl/test/unit_test/mocks/linux/mock_drm_command_stream_receiver.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_submissions_aggregator.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_command_stream_fixture.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/dispatch_flags_helper.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_page_table_mngr.h"
|
||||
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
|
||||
|
||||
@@ -32,7 +33,6 @@
|
||||
#include "opencl/test/unit_test/mocks/linux/mock_drm_command_stream_receiver.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_submissions_aggregator.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_command_stream_fixture.h"
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests_exp.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_exp.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_memory_info.h"
|
||||
@@ -585,7 +585,10 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenSupportedTypeWhenAllocatingInDevice
|
||||
allocData.size = MemoryConstants::pageSize;
|
||||
allocData.flags.allocateMemory = true;
|
||||
allocData.rootDeviceIndex = rootDeviceIndex;
|
||||
cl_image_desc imgDesc = {CL_MEM_OBJECT_IMAGE2D, MemoryConstants::pageSize, MemoryConstants::pageSize, 0, 0, 0, 0, 0, 0, {nullptr}};
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = MemoryConstants::pageSize;
|
||||
imgDesc.imageHeight = MemoryConstants::pageSize;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
bool resource48Bit[] = {true, false};
|
||||
@@ -934,9 +937,9 @@ TEST_F(DrmMemoryManagerTestExp, givenDrmMemoryManagerWhenGetLocalMemorySizeIsCal
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerLocalMemoryTest, givenGraphicsAllocationInDevicePoolIsAllocatedForImage1DWhenTheSizeReturnedFromGmmIsUnalignedThenCreateBufferObjectWithSizeAlignedTo64KB) {
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
||||
imgDesc.image_width = 100;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image1D;
|
||||
imgDesc.imageWidth = 100;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_gfx_partition.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/test_macros/matchers.h"
|
||||
|
||||
#include "opencl/source/event/event.h"
|
||||
@@ -40,7 +41,6 @@
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_cache_info.h"
|
||||
#include "test.h"
|
||||
@@ -1533,12 +1533,11 @@ TEST_F(DrmMemoryManagerTest, GivenMemoryManagerWhenAllocateGraphicsMemoryForImag
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D; // tiled
|
||||
imgDesc.image_width = 512;
|
||||
imgDesc.image_height = 512;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D; // tiled
|
||||
imgDesc.imageWidth = 512;
|
||||
imgDesc.imageHeight = 512;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
imgInfo.imgDesc = Image::convertDescriptor(imgDesc);
|
||||
imgInfo.size = 4096u;
|
||||
imgInfo.rowPitch = 512u;
|
||||
|
||||
@@ -1950,10 +1949,10 @@ TEST_F(DrmMemoryManagerTest, givenHostPointerNotRequiringCopyWhenAllocateGraphic
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_width = MemoryConstants::pageSize;
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image1D;
|
||||
imgDesc.imageWidth = MemoryConstants::pageSize;
|
||||
imgDesc.imageHeight = 1;
|
||||
|
||||
cl_image_format imageFormat = {};
|
||||
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
@@ -1961,15 +1960,15 @@ TEST_F(DrmMemoryManagerTest, givenHostPointerNotRequiringCopyWhenAllocateGraphic
|
||||
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR;
|
||||
MockContext context(device);
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
auto surfaceFormat = &Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features)->surfaceFormat;
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, surfaceFormat);
|
||||
imgInfo.rowPitch = imgDesc.image_width * surfaceFormat->surfaceFormat.ImageElementSizeInBytes;
|
||||
imgInfo.slicePitch = imgInfo.rowPitch * imgDesc.image_height;
|
||||
imgInfo.rowPitch = imgDesc.imageWidth * surfaceFormat->ImageElementSizeInBytes;
|
||||
imgInfo.slicePitch = imgInfo.rowPitch * imgDesc.imageHeight;
|
||||
imgInfo.size = imgInfo.slicePitch;
|
||||
imgInfo.linearStorage = true;
|
||||
|
||||
auto hostPtr = alignedMalloc(imgDesc.image_width * imgDesc.image_height * 4, MemoryConstants::pageSize);
|
||||
auto hostPtr = alignedMalloc(imgDesc.imageWidth * imgDesc.imageHeight * 4, MemoryConstants::pageSize);
|
||||
bool copyRequired = MockMemoryManager::isCopyRequired(imgInfo, hostPtr);
|
||||
EXPECT_FALSE(copyRequired);
|
||||
|
||||
@@ -2462,12 +2461,11 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 512;
|
||||
imgDesc.image_height = 512;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 512;
|
||||
imgDesc.imageHeight = 512;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
imgInfo.imgDesc = Image::convertDescriptor(imgDesc);
|
||||
imgInfo.size = 4096u;
|
||||
imgInfo.rowPitch = 512u;
|
||||
|
||||
@@ -5229,10 +5227,10 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenNotSetUs
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenNotSetUseSystemMemoryWhenGraphicsAllocationInDevicePoolIsAllocatedForImageThenLocalMemoryAllocationIsReturnedFromStandard64KbHeap) {
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imgDesc.image_width = 512;
|
||||
imgDesc.image_height = 512;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image2D;
|
||||
imgDesc.imageWidth = 512;
|
||||
imgDesc.imageHeight = 512;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
MemoryManager::AllocationStatus status = MemoryManager::AllocationStatus::Success;
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#pragma once
|
||||
#include "shared/source/os_interface/windows/wddm_allocation.h"
|
||||
#include "shared/test/common/mock_gdi/mock_gdi.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
|
||||
@@ -1491,8 +1491,8 @@ TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenWddmWhenAsyncDeleterIsDisable
|
||||
|
||||
TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithAsyncDeleterWhenCannotAllocateMemoryForTiledImageThenDrainIsCalledAndCreateAllocationIsCalledTwice) {
|
||||
UltDeviceFactory deviceFactory{1, 0};
|
||||
cl_image_desc imgDesc = {};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
ImageDescriptor imgDesc = {};
|
||||
imgDesc.imageType = ImageType::Image3D;
|
||||
ImageInfo imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
wddm->createAllocationStatus = STATUS_GRAPHICS_NO_VIDEO_MEMORY;
|
||||
@@ -1509,8 +1509,8 @@ TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithAsyncDeleter
|
||||
|
||||
TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithAsyncDeleterWhenCanAllocateMemoryForTiledImageThenDrainIsNotCalledAndCreateAllocationIsCalledOnce) {
|
||||
UltDeviceFactory deviceFactory{1, 0};
|
||||
cl_image_desc imgDesc;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
ImageDescriptor imgDesc;
|
||||
imgDesc.imageType = ImageType::Image3D;
|
||||
ImageInfo imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
wddm->createAllocationStatus = STATUS_SUCCESS;
|
||||
@@ -1533,8 +1533,8 @@ TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithAsyncDeleter
|
||||
TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithoutAsyncDeleterWhenCannotAllocateMemoryForTiledImageThenCreateAllocationIsCalledOnce) {
|
||||
UltDeviceFactory deviceFactory{1, 0};
|
||||
memoryManager->setDeferredDeleter(nullptr);
|
||||
cl_image_desc imgDesc;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE3D;
|
||||
ImageDescriptor imgDesc;
|
||||
imgDesc.imageType = ImageType::Image3D;
|
||||
ImageInfo imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
wddm->createAllocationStatus = STATUS_GRAPHICS_NO_VIDEO_MEMORY;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/os_interface/windows/os_environment_win.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_page_table_mngr.h"
|
||||
#include "shared/test/common/mocks/mock_wddm_residency_allocations_container.h"
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
@@ -18,7 +19,6 @@
|
||||
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_memory_manager.h"
|
||||
#include "test.h"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/mem_obj/mem_obj.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/helpers/get_info.h"
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/helpers/gmm_types_converter.h"
|
||||
@@ -15,7 +16,6 @@
|
||||
#include "opencl/source/sharings/gl/gl_texture.h"
|
||||
#include "opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
@@ -64,18 +64,18 @@ class CreateFromGlTexture : public ::testing::Test {
|
||||
tempMM.forceGmm = gmm.get();
|
||||
|
||||
if (glSharing->m_textureInfoOutput.globalShareHandleMCS != 0) {
|
||||
cl_image_desc mcsImgDesc = {};
|
||||
mcsImgDesc.image_height = 128;
|
||||
mcsImgDesc.image_row_pitch = 256;
|
||||
mcsImgDesc.image_width = 128;
|
||||
mcsImgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
ImageDescriptor mcsImgDesc = {};
|
||||
mcsImgDesc.imageHeight = 128;
|
||||
mcsImgDesc.imageRowPitch = 256;
|
||||
mcsImgDesc.imageWidth = 128;
|
||||
mcsImgDesc.imageType = ImageType::Image2D;
|
||||
auto mcsImgInfo = MockGmm::initImgInfo(mcsImgDesc, 0, nullptr);
|
||||
mcsGmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmClientContext(), mcsImgInfo);
|
||||
tempMM.forceMcsGmm = mcsGmm.get();
|
||||
}
|
||||
}
|
||||
|
||||
cl_image_desc imgDesc;
|
||||
ImageDescriptor imgDesc;
|
||||
ImageInfo imgInfo = {};
|
||||
std::unique_ptr<Gmm> gmm;
|
||||
std::unique_ptr<Gmm> mcsGmm;
|
||||
@@ -101,20 +101,20 @@ INSTANTIATE_TEST_CASE_P(
|
||||
TEST_P(CreateFromGlTextureTestsWithParams, givenAllTextureSpecificParamsWhenCreateIsCalledThenFillImageDescription) {
|
||||
unsigned int target = GetParam();
|
||||
unsigned int baseTarget = GlTexture::getBaseTargetType(target);
|
||||
imgDesc.image_type = GlTexture::getClMemObjectType(target);
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.imageType = Image::convertType(GlTexture::getClMemObjectType(target));
|
||||
imgDesc.imageWidth = 5;
|
||||
if (target == GL_TEXTURE_1D_ARRAY || target == GL_TEXTURE_2D_ARRAY || target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
|
||||
imgDesc.image_array_size = 5;
|
||||
imgDesc.imageArraySize = 5;
|
||||
}
|
||||
if (target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE ||
|
||||
target == GL_TEXTURE_2D_ARRAY || target == GL_TEXTURE_3D ||
|
||||
target == GL_RENDERBUFFER_EXT || baseTarget == GL_TEXTURE_CUBE_MAP_ARB ||
|
||||
target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
|
||||
imgDesc.image_height = 5;
|
||||
imgDesc.imageHeight = 5;
|
||||
}
|
||||
|
||||
if (target == GL_TEXTURE_3D) {
|
||||
imgDesc.image_depth = 5;
|
||||
imgDesc.imageDepth = 5;
|
||||
}
|
||||
|
||||
if (target == GL_TEXTURE_BUFFER) {
|
||||
@@ -125,7 +125,7 @@ TEST_P(CreateFromGlTextureTestsWithParams, givenAllTextureSpecificParamsWhenCrea
|
||||
}
|
||||
|
||||
if (target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
|
||||
imgDesc.num_samples = 16;
|
||||
imgDesc.numSamples = 16;
|
||||
glSharing->m_textureInfoOutput.numberOfSamples = 16;
|
||||
glSharing->m_textureInfoOutput.globalShareHandleMCS = CreateFromGlTexture::mcsHandle;
|
||||
glSharing->uploadDataToTextureInfo();
|
||||
@@ -147,7 +147,7 @@ TEST_P(CreateFromGlTextureTestsWithParams, givenAllTextureSpecificParamsWhenCrea
|
||||
auto glTexture = reinterpret_cast<GlTexture *>(glImage->peekSharingHandler());
|
||||
EXPECT_EQ(glTexture->getTarget(), target);
|
||||
|
||||
EXPECT_EQ(glImage->getImageDesc().image_type, imgDesc.image_type);
|
||||
EXPECT_EQ(glImage->getImageDesc().image_type, Image::convertType(imgDesc.imageType));
|
||||
if (target == GL_TEXTURE_BUFFER) {
|
||||
EXPECT_EQ(glImage->getImageDesc().image_width,
|
||||
static_cast<size_t>(glTexture->getTextureInfo()->textureBufferWidth));
|
||||
@@ -190,10 +190,10 @@ TEST_P(CreateFromGlTextureTestsWithParams, givenAllTextureSpecificParamsWhenCrea
|
||||
EXPECT_EQ(glImage->getImageDesc().image_depth, 0u);
|
||||
}
|
||||
|
||||
if (imgDesc.image_array_size > 1 || imgDesc.image_depth > 1) {
|
||||
if (imgDesc.imageArraySize > 1 || imgDesc.imageDepth > 1) {
|
||||
GMM_REQ_OFFSET_INFO GMMReqInfo = {};
|
||||
GMMReqInfo.ArrayIndex = imgDesc.image_array_size > 1 ? 1 : 0;
|
||||
GMMReqInfo.Slice = imgDesc.image_depth > 1 ? 1 : 0;
|
||||
GMMReqInfo.ArrayIndex = imgDesc.imageArraySize > 1 ? 1 : 0;
|
||||
GMMReqInfo.Slice = imgDesc.imageDepth > 1 ? 1 : 0;
|
||||
GMMReqInfo.ReqLock = 1;
|
||||
gmm->gmmResourceInfo->getOffset(GMMReqInfo);
|
||||
size_t expectedSlicePitch = GMMReqInfo.Lock.Offset;
|
||||
@@ -227,12 +227,12 @@ TEST_P(CreateFromGlTextureTestsWithParams, givenArrayTextureTargetAndArraySizeEq
|
||||
// only array targets
|
||||
if (target == GL_TEXTURE_1D_ARRAY ||
|
||||
target == GL_TEXTURE_2D_ARRAY) {
|
||||
imgDesc.image_type = GlTexture::getClMemObjectType(target);
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.imageType = Image::convertType(GlTexture::getClMemObjectType(target));
|
||||
imgDesc.imageWidth = 5;
|
||||
if (target == GL_TEXTURE_2D_ARRAY) {
|
||||
imgDesc.image_height = 5;
|
||||
imgDesc.imageHeight = 5;
|
||||
}
|
||||
imgDesc.image_array_size = 1;
|
||||
imgDesc.imageArraySize = 1;
|
||||
|
||||
updateImgInfoAndForceGmm();
|
||||
|
||||
@@ -248,17 +248,17 @@ TEST_P(CreateFromGlTextureTestsWithParams, givenArrayTextureTargetAndArraySizeEq
|
||||
TEST_P(CreateFromGlTextureTestsWithParams, givenZeroRowPitchFromGmmWhenCreatingTextureThenComputeIt) {
|
||||
unsigned int target = GL_TEXTURE_2D;
|
||||
|
||||
imgDesc.image_type = GlTexture::getClMemObjectType(target);
|
||||
imgDesc.image_width = 5;
|
||||
imgDesc.image_height = 5;
|
||||
imgDesc.image_array_size = 1;
|
||||
imgDesc.imageType = Image::convertType(GlTexture::getClMemObjectType(target));
|
||||
imgDesc.imageWidth = 5;
|
||||
imgDesc.imageHeight = 5;
|
||||
imgDesc.imageArraySize = 1;
|
||||
|
||||
updateImgInfoAndForceGmm();
|
||||
|
||||
auto mockResInfo = reinterpret_cast<::testing::NiceMock<MockGmmResourceInfo> *>(gmm->gmmResourceInfo.get());
|
||||
mockResInfo->overrideReturnedRenderPitch(0u);
|
||||
|
||||
auto alignedWidth = alignUp(imgDesc.image_width, gmm->gmmResourceInfo->getHAlign());
|
||||
auto alignedWidth = alignUp(imgDesc.imageWidth, gmm->gmmResourceInfo->getHAlign());
|
||||
auto expectedRowPitch = alignedWidth * (gmm->gmmResourceInfo->getBitsPerPixel() >> 3);
|
||||
|
||||
auto glImage = std::unique_ptr<Image>(GlTexture::createSharedGlTexture(&clContext, (cl_mem_flags)0, target, 0, 0, &retVal));
|
||||
@@ -272,10 +272,10 @@ TEST_F(CreateFromGlTextureTests, GivenGlTextureTargetAndMipLevelNegativeWhenCrea
|
||||
unsigned int target = GL_TEXTURE_3D;
|
||||
cl_GLint miplevel = -1;
|
||||
|
||||
imgDesc.image_type = GlTexture::getClMemObjectType(target);
|
||||
imgDesc.image_height = 13;
|
||||
imgDesc.image_width = 15;
|
||||
imgDesc.image_depth = 7;
|
||||
imgDesc.imageType = Image::convertType(GlTexture::getClMemObjectType(target));
|
||||
imgDesc.imageHeight = 13;
|
||||
imgDesc.imageWidth = 15;
|
||||
imgDesc.imageDepth = 7;
|
||||
|
||||
updateImgInfoAndForceGmm();
|
||||
|
||||
@@ -301,10 +301,10 @@ TEST_F(CreateFromGlTextureTests, GivenGlTextureTargetAndMipLevelNonNegativeWhenC
|
||||
unsigned int target = GL_TEXTURE_3D;
|
||||
cl_GLint miplevel = 2;
|
||||
|
||||
imgDesc.image_type = GlTexture::getClMemObjectType(target);
|
||||
imgDesc.image_height = 13;
|
||||
imgDesc.image_width = 15;
|
||||
imgDesc.image_depth = 7;
|
||||
imgDesc.imageType = Image::convertType(GlTexture::getClMemObjectType(target));
|
||||
imgDesc.imageHeight = 13;
|
||||
imgDesc.imageWidth = 15;
|
||||
imgDesc.imageDepth = 7;
|
||||
|
||||
updateImgInfoAndForceGmm();
|
||||
|
||||
@@ -330,10 +330,10 @@ TEST_F(CreateFromGlTextureTests, GivenGlTextureWhenCreateIsCalledThenAllocationT
|
||||
unsigned int target = GL_TEXTURE_3D;
|
||||
cl_GLint miplevel = 2;
|
||||
|
||||
imgDesc.image_type = GlTexture::getClMemObjectType(target);
|
||||
imgDesc.image_height = 13;
|
||||
imgDesc.image_width = 15;
|
||||
imgDesc.image_depth = 7;
|
||||
imgDesc.imageType = Image::convertType(GlTexture::getClMemObjectType(target));
|
||||
imgDesc.imageHeight = 13;
|
||||
imgDesc.imageWidth = 15;
|
||||
imgDesc.imageDepth = 7;
|
||||
|
||||
updateImgInfoAndForceGmm();
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_resource_info.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
@@ -34,7 +35,6 @@
|
||||
#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"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "gl_types.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "opencl/source/helpers/gmm_types_converter.h"
|
||||
@@ -16,7 +17,6 @@
|
||||
#include "opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
@@ -55,8 +55,8 @@ class GlSharingTextureTests : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
imgDesc = {};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
|
||||
imgDesc.image_width = 10;
|
||||
imgDesc.imageType = ImageType::Image1D;
|
||||
imgDesc.imageWidth = 10;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
tempMM = new TempMM(*executionEnvironment);
|
||||
@@ -80,7 +80,7 @@ class GlSharingTextureTests : public ::testing::Test {
|
||||
}
|
||||
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
cl_image_desc imgDesc;
|
||||
ImageDescriptor imgDesc;
|
||||
TempMM *tempMM;
|
||||
std::unique_ptr<MockClDevice> device;
|
||||
std::unique_ptr<MockContext> clContext;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/source/sharings/unified/unified_buffer.h"
|
||||
#include "opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h"
|
||||
#include "opencl/test/unit_test/sharings/unified/unified_sharing_mocks.h"
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "opencl/source/sharings/unified/unified_sharing_types.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/source/sharings/unified/enable_unified.h"
|
||||
#include "opencl/source/sharings/unified/unified_buffer.h"
|
||||
#include "opencl/source/sharings/unified/unified_sharing.h"
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/unit_test/utilities/base_object_utils.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
Reference in New Issue
Block a user