mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-28 00:03:14 +08:00
refactor: multicontext aub fixture api agnostic + improve createModuleFromFile
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
9468915768
commit
a83f3f7bc1
@@ -23,41 +23,16 @@ namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
struct L0BindlessAub : Test<AUBFixtureL0> {
|
||||
|
||||
void SetUp() override {
|
||||
debugManager.flags.UseBindlessMode.set(1);
|
||||
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
|
||||
AUBFixtureL0::setUp();
|
||||
}
|
||||
void TearDown() override {
|
||||
|
||||
module->destroy();
|
||||
AUBFixtureL0::tearDown();
|
||||
}
|
||||
|
||||
void createModuleFromFile(const std::string &fileName, ze_context_handle_t context, L0::Device *device) {
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilenameApiSpecific(testFile, fileName + "_", ".bin");
|
||||
|
||||
size_t size = 0;
|
||||
auto src = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
size);
|
||||
|
||||
ASSERT_NE(0u, size);
|
||||
ASSERT_NE(nullptr, src);
|
||||
|
||||
ze_module_desc_t moduleDesc = {ZE_STRUCTURE_TYPE_MODULE_DESC};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
|
||||
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.get());
|
||||
moduleDesc.inputSize = size;
|
||||
moduleDesc.pBuildFlags = "";
|
||||
|
||||
module = new ModuleImp(device, nullptr, ModuleType::user);
|
||||
ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
|
||||
result = module->initialize(&moduleDesc, device->getNEODevice());
|
||||
ASSERT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
ModuleImp *module = nullptr;
|
||||
};
|
||||
@@ -91,7 +66,7 @@ HWTEST_F(L0BindlessAub, DISABLED_GivenBindlessKernelWhenExecutedThenOutputIsCorr
|
||||
dispatchTraits.groupCountY = groupCount[1];
|
||||
dispatchTraits.groupCountZ = groupCount[2];
|
||||
|
||||
createModuleFromFile("bindless_stateful_copy_buffer", context, device);
|
||||
createModuleFromFile("bindless_stateful_copy_buffer", context, device, "");
|
||||
|
||||
ze_kernel_handle_t kernel;
|
||||
ze_kernel_desc_t kernelDesc = {ZE_STRUCTURE_TYPE_KERNEL_DESC};
|
||||
|
||||
@@ -19,35 +19,8 @@
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
struct AUBAppendKernelIndirectL0 : Test<AUBFixtureL0> {
|
||||
using AUBAppendKernelIndirectL0 = Test<AUBFixtureL0>;
|
||||
|
||||
static ze_module_handle_t createModuleFromFile(const std::string &fileName, ze_context_handle_t context, ze_device_handle_t device) {
|
||||
ze_module_handle_t moduleHandle;
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilenameApiSpecific(testFile, fileName + "_", ".bin");
|
||||
|
||||
size_t size = 0;
|
||||
auto src = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
size);
|
||||
|
||||
EXPECT_NE(0u, size);
|
||||
EXPECT_NE(nullptr, src);
|
||||
|
||||
if (!src || size == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ze_module_desc_t moduleDesc = {ZE_STRUCTURE_TYPE_MODULE_DESC};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
|
||||
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.get());
|
||||
moduleDesc.inputSize = size;
|
||||
moduleDesc.pBuildFlags = "";
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zeModuleCreate(context, device, &moduleDesc, &moduleHandle, nullptr));
|
||||
return moduleHandle;
|
||||
}
|
||||
};
|
||||
TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGlobalWorkSizeIsProperlyProgrammed) {
|
||||
const uint32_t groupSize[] = {1, 2, 3};
|
||||
const uint32_t groupCount[] = {4, 3, 1};
|
||||
@@ -72,7 +45,7 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGlobalWorkSizeIsPr
|
||||
dispatchTraits.groupCountY = groupCount[1];
|
||||
dispatchTraits.groupCountZ = groupCount[2];
|
||||
|
||||
ze_module_handle_t moduleHandle = createModuleFromFile("test_kernel", context, device);
|
||||
ze_module_handle_t moduleHandle = createModuleFromFile("test_kernel", context, device, "");
|
||||
ASSERT_NE(nullptr, moduleHandle);
|
||||
ze_kernel_handle_t kernel;
|
||||
|
||||
@@ -117,7 +90,7 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGroupCountIsProper
|
||||
dispatchTraits.groupCountY = groupCount[1];
|
||||
dispatchTraits.groupCountZ = groupCount[2];
|
||||
|
||||
ze_module_handle_t moduleHandle = createModuleFromFile("test_kernel", context, device);
|
||||
ze_module_handle_t moduleHandle = createModuleFromFile("test_kernel", context, device, "");
|
||||
ASSERT_NE(nullptr, moduleHandle);
|
||||
ze_kernel_handle_t kernel;
|
||||
|
||||
@@ -172,7 +145,7 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendMultipleKernelsIndirectThenGroupCoun
|
||||
dispatchTraits[1].groupCountY = groupCount2[1];
|
||||
dispatchTraits[1].groupCountZ = groupCount2[2];
|
||||
|
||||
ze_module_handle_t moduleHandle = createModuleFromFile("test_kernel", context, device);
|
||||
ze_module_handle_t moduleHandle = createModuleFromFile("test_kernel", context, device, "");
|
||||
ASSERT_NE(nullptr, moduleHandle);
|
||||
ze_kernel_handle_t kernels[2];
|
||||
|
||||
@@ -230,7 +203,7 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenWorkDimIsProperlyP
|
||||
{{1, 1, 2}, {1, 1, 2}, 3}};
|
||||
|
||||
ze_command_list_handle_t cmdListHandle = commandList->toHandle();
|
||||
ze_module_handle_t moduleHandle = createModuleFromFile("test_kernel", context, device);
|
||||
ze_module_handle_t moduleHandle = createModuleFromFile("test_kernel", context, device, "");
|
||||
ASSERT_NE(nullptr, moduleHandle);
|
||||
ze_kernel_handle_t kernel;
|
||||
|
||||
|
||||
@@ -35,39 +35,10 @@ struct DebuggerAubFixture : AUBFixtureL0 {
|
||||
AUBFixtureL0::setUp(NEO::defaultHwInfo.get(), true);
|
||||
}
|
||||
void tearDown() {
|
||||
|
||||
module->destroy();
|
||||
AUBFixtureL0::tearDown();
|
||||
}
|
||||
|
||||
void createModuleFromFile(const std::string &fileName, ze_context_handle_t context, L0::Device *device) {
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilenameApiSpecific(testFile, fileName + "_", ".bin");
|
||||
|
||||
size_t size = 0;
|
||||
auto src = loadDataFromFile(
|
||||
testFile.c_str(),
|
||||
size);
|
||||
|
||||
ASSERT_NE(0u, size);
|
||||
ASSERT_NE(nullptr, src);
|
||||
|
||||
ze_module_desc_t moduleDesc = {ZE_STRUCTURE_TYPE_MODULE_DESC};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
|
||||
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.get());
|
||||
moduleDesc.inputSize = size;
|
||||
moduleDesc.pBuildFlags = "";
|
||||
|
||||
module = new ModuleImp(device, nullptr, ModuleType::user);
|
||||
ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
|
||||
result = module->initialize(&moduleDesc, device->getNEODevice());
|
||||
ASSERT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
|
||||
memoryManager = neoDevice->getMemoryManager();
|
||||
gmmHelper = neoDevice->getGmmHelper();
|
||||
rootDeviceIndex = neoDevice->getRootDeviceIndex();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
ModuleImp *module = nullptr;
|
||||
@@ -96,6 +67,10 @@ HWTEST2_F(DebuggerSingleAddressSpaceAub, GivenSingleAddressSpaceWhenCmdListIsExe
|
||||
const uint32_t groupCount[] = {bufferSize / 32, 1, 1};
|
||||
const uint32_t expectedSizes[] = {bufferSize, 1, 1};
|
||||
|
||||
memoryManager = neoDevice->getMemoryManager();
|
||||
gmmHelper = neoDevice->getGmmHelper();
|
||||
rootDeviceIndex = neoDevice->getRootDeviceIndex();
|
||||
|
||||
NEO::debugManager.flags.UpdateCrossThreadDataSize.set(true);
|
||||
|
||||
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory,
|
||||
@@ -116,7 +91,7 @@ HWTEST2_F(DebuggerSingleAddressSpaceAub, GivenSingleAddressSpaceWhenCmdListIsExe
|
||||
dispatchTraits.groupCountY = groupCount[1];
|
||||
dispatchTraits.groupCountZ = groupCount[2];
|
||||
|
||||
createModuleFromFile("test_kernel", context, device);
|
||||
module = static_cast<L0::ModuleImp *>(Module::fromHandle(createModuleFromFile("test_kernel", context, device, "")));
|
||||
|
||||
ze_kernel_handle_t kernel;
|
||||
ze_kernel_desc_t kernelDesc = {ZE_STRUCTURE_TYPE_KERNEL_DESC};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -10,13 +10,17 @@
|
||||
#include "shared/source/command_stream/aub_command_stream_receiver.h"
|
||||
#include "shared/source/command_stream/tbx_command_stream_receiver_hw.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/file_io.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/test/common/helpers/test_files.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/tests_configuration.h"
|
||||
|
||||
#include "level_zero/core/source/cmdqueue/cmdqueue.h"
|
||||
#include "level_zero/core/source/context/context_imp.h"
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/core/source/module/module_imp.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_driver_handle.h"
|
||||
|
||||
@@ -89,4 +93,28 @@ void AUBFixtureL0::tearDown() {
|
||||
pCmdq->destroy();
|
||||
}
|
||||
|
||||
ze_module_handle_t AUBFixtureL0::createModuleFromFile(const std::string &fileName, ze_context_handle_t context, ze_device_handle_t device, const std::string &buildFlags) {
|
||||
ze_module_handle_t moduleHandle;
|
||||
std::string testFile;
|
||||
retrieveBinaryKernelFilenameApiSpecific(testFile, fileName + "_", ".bin");
|
||||
|
||||
size_t size = 0;
|
||||
auto src = loadDataFromFile(testFile.c_str(), size);
|
||||
|
||||
EXPECT_NE(0u, size);
|
||||
EXPECT_NE(nullptr, src);
|
||||
|
||||
if (!src || size == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ze_module_desc_t moduleDesc = {ZE_STRUCTURE_TYPE_MODULE_DESC};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
|
||||
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.get());
|
||||
moduleDesc.inputSize = size;
|
||||
moduleDesc.pBuildFlags = buildFlags.data();
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zeModuleCreate(context, device, &moduleDesc, &moduleHandle, nullptr));
|
||||
return moduleHandle;
|
||||
}
|
||||
} // namespace L0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/mock.h"
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#include "test_mode.h"
|
||||
|
||||
@@ -100,6 +101,8 @@ class AUBFixtureL0 {
|
||||
}
|
||||
}
|
||||
|
||||
ze_module_handle_t createModuleFromFile(const std::string &fileName, ze_context_handle_t context, ze_device_handle_t device, const std::string &buildFlags);
|
||||
|
||||
std::string aubFileName;
|
||||
std::unique_ptr<VariableBackup<NEO::UltHwConfig>> backupUltConfig;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/simple_arg_kernel_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
@@ -29,14 +29,14 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
template <uint32_t numberOfTiles, MulticontextAubFixture::EnabledCommandStreamers enabledCommandStreamers>
|
||||
struct MultitileMulticontextTests : public MulticontextAubFixture, public ::testing::Test {
|
||||
template <uint32_t numberOfTiles, MulticontextOclAubFixture::EnabledCommandStreamers enabledCommandStreamers>
|
||||
struct MultitileMulticontextTests : public MulticontextOclAubFixture, public ::testing::Test {
|
||||
void SetUp() override {
|
||||
debugManager.flags.ExperimentalSmallBufferPoolAllocator.set(0);
|
||||
MulticontextAubFixture::setUp(numberOfTiles, enabledCommandStreamers, false);
|
||||
MulticontextOclAubFixture::setUp(numberOfTiles, enabledCommandStreamers, false);
|
||||
}
|
||||
void TearDown() override {
|
||||
MulticontextAubFixture::tearDown();
|
||||
MulticontextOclAubFixture::tearDown();
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
@@ -210,17 +210,17 @@ struct MultitileMulticontextTests : public MulticontextAubFixture, public ::test
|
||||
};
|
||||
|
||||
// 4 Tiles
|
||||
using FourTilesAllContextsTest = MultitileMulticontextTests<4, MulticontextAubFixture::EnabledCommandStreamers::all>;
|
||||
using FourTilesAllContextsTest = MultitileMulticontextTests<4, MulticontextOclAubFixture::EnabledCommandStreamers::all>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, FourTilesAllContextsTest, GENERATEONLY_givenFourTilesAndAllContextsWhenSubmittingThenDataIsValid) {
|
||||
runAubTest<FamilyType>();
|
||||
}
|
||||
|
||||
using FourTilesDualContextTest = MultitileMulticontextTests<4, MulticontextAubFixture::EnabledCommandStreamers::dual>;
|
||||
using FourTilesDualContextTest = MultitileMulticontextTests<4, MulticontextOclAubFixture::EnabledCommandStreamers::dual>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, FourTilesDualContextTest, HEAVY_givenFourTilesAndDualContextWhenSubmittingThenDataIsValid) {
|
||||
runAubTest<FamilyType>();
|
||||
}
|
||||
|
||||
using FourTilesSingleContextTest = MultitileMulticontextTests<4, MulticontextAubFixture::EnabledCommandStreamers::single>;
|
||||
using FourTilesSingleContextTest = MultitileMulticontextTests<4, MulticontextOclAubFixture::EnabledCommandStreamers::single>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, FourTilesSingleContextTest, givenFourTilesAndSingleContextWhenSubmittingThenDataIsValid) {
|
||||
runAubTest<FamilyType>();
|
||||
}
|
||||
@@ -523,28 +523,28 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, StaticWalkerPartitionFourTilesTests, whenNoPreWalke
|
||||
}
|
||||
|
||||
// 2 Tiles
|
||||
using TwoTilesAllContextsTest = MultitileMulticontextTests<2, MulticontextAubFixture::EnabledCommandStreamers::all>;
|
||||
using TwoTilesAllContextsTest = MultitileMulticontextTests<2, MulticontextOclAubFixture::EnabledCommandStreamers::all>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, TwoTilesAllContextsTest, HEAVY_givenTwoTilesAndAllContextsWhenSubmittingThenDataIsValid) {
|
||||
runAubTest<FamilyType>();
|
||||
}
|
||||
|
||||
using TwoTilesDualContextTest = MultitileMulticontextTests<2, MulticontextAubFixture::EnabledCommandStreamers::dual>;
|
||||
using TwoTilesDualContextTest = MultitileMulticontextTests<2, MulticontextOclAubFixture::EnabledCommandStreamers::dual>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, TwoTilesDualContextTest, givenTwoTilesAndDualContextWhenSubmittingThenDataIsValid) {
|
||||
runAubTest<FamilyType>();
|
||||
}
|
||||
|
||||
using TwoTilesSingleContextTest = MultitileMulticontextTests<2, MulticontextAubFixture::EnabledCommandStreamers::single>;
|
||||
using TwoTilesSingleContextTest = MultitileMulticontextTests<2, MulticontextOclAubFixture::EnabledCommandStreamers::single>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, TwoTilesSingleContextTest, givenTwoTilesAndSingleContextWhenSubmittingThenDataIsValid) {
|
||||
runAubTest<FamilyType>();
|
||||
}
|
||||
|
||||
// 1 Tile
|
||||
using SingleTileAllContextsTest = MultitileMulticontextTests<1, MulticontextAubFixture::EnabledCommandStreamers::all>;
|
||||
using SingleTileAllContextsTest = MultitileMulticontextTests<1, MulticontextOclAubFixture::EnabledCommandStreamers::all>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, SingleTileAllContextsTest, GENERATEONLY_givenSingleTileAndAllContextsWhenSubmittingThenDataIsValid) {
|
||||
runAubTest<FamilyType>();
|
||||
}
|
||||
|
||||
using SingleTileDualContextTest = MultitileMulticontextTests<1, MulticontextAubFixture::EnabledCommandStreamers::dual>;
|
||||
using SingleTileDualContextTest = MultitileMulticontextTests<1, MulticontextOclAubFixture::EnabledCommandStreamers::dual>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, SingleTileDualContextTest, givenSingleTileAndDualContextWhenSubmittingThenDataIsValid) {
|
||||
runAubTest<FamilyType>();
|
||||
}
|
||||
@@ -580,44 +580,44 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, SingleTileDualContextTest, givenSingleAllocationWhe
|
||||
}
|
||||
|
||||
// 1 Tile
|
||||
using SingleTileDualContextTest = MultitileMulticontextTests<1, MulticontextAubFixture::EnabledCommandStreamers::dual>;
|
||||
using SingleTileDualContextTest = MultitileMulticontextTests<1, MulticontextOclAubFixture::EnabledCommandStreamers::dual>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, SingleTileDualContextTest, givenSingleTileAndDualContextWhenWritingImageThenDataIsValid) {
|
||||
runAubWriteImageTest<FamilyType>();
|
||||
}
|
||||
|
||||
using SingleTileAllContextsTest = MultitileMulticontextTests<1, MulticontextAubFixture::EnabledCommandStreamers::all>;
|
||||
using SingleTileAllContextsTest = MultitileMulticontextTests<1, MulticontextOclAubFixture::EnabledCommandStreamers::all>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, SingleTileAllContextsTest, HEAVY_givenSingleTileAndAllContextsWhenWritingImageThenDataIsValid) {
|
||||
runAubWriteImageTest<FamilyType>();
|
||||
}
|
||||
|
||||
// 2 Tiles
|
||||
using TwoTilesSingleContextTest = MultitileMulticontextTests<2, MulticontextAubFixture::EnabledCommandStreamers::single>;
|
||||
using TwoTilesSingleContextTest = MultitileMulticontextTests<2, MulticontextOclAubFixture::EnabledCommandStreamers::single>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, TwoTilesSingleContextTest, givenTwoTilesAndSingleContextWhenWritingImageThenDataIsValid) {
|
||||
runAubWriteImageTest<FamilyType>();
|
||||
}
|
||||
|
||||
using TwoTilesDualContextTest = MultitileMulticontextTests<2, MulticontextAubFixture::EnabledCommandStreamers::dual>;
|
||||
using TwoTilesDualContextTest = MultitileMulticontextTests<2, MulticontextOclAubFixture::EnabledCommandStreamers::dual>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, TwoTilesDualContextTest, givenTwoTilesAndDualContextWhenWritingImageThenDataIsValid) {
|
||||
runAubWriteImageTest<FamilyType>();
|
||||
}
|
||||
|
||||
using TwoTilesAllContextsTest = MultitileMulticontextTests<2, MulticontextAubFixture::EnabledCommandStreamers::all>;
|
||||
using TwoTilesAllContextsTest = MultitileMulticontextTests<2, MulticontextOclAubFixture::EnabledCommandStreamers::all>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, TwoTilesAllContextsTest, GENERATEONLY_givenTwoTilesAndAllContextsWhenWritingImageThenDataIsValid) {
|
||||
runAubWriteImageTest<FamilyType>();
|
||||
}
|
||||
|
||||
// 4 Tiles
|
||||
using FourTilesSingleContextTest = MultitileMulticontextTests<4, MulticontextAubFixture::EnabledCommandStreamers::single>;
|
||||
using FourTilesSingleContextTest = MultitileMulticontextTests<4, MulticontextOclAubFixture::EnabledCommandStreamers::single>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, FourTilesSingleContextTest, givenFourTilesAndSingleContextWhenWritingImageThenDataIsValid) {
|
||||
runAubWriteImageTest<FamilyType>();
|
||||
}
|
||||
|
||||
using FourTilesDualContextTest = MultitileMulticontextTests<4, MulticontextAubFixture::EnabledCommandStreamers::dual>;
|
||||
using FourTilesDualContextTest = MultitileMulticontextTests<4, MulticontextOclAubFixture::EnabledCommandStreamers::dual>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, FourTilesDualContextTest, GENERATEONLY_givenFourTilesAndDualContextWhenWritingImageThenDataIsValid) {
|
||||
runAubWriteImageTest<FamilyType>();
|
||||
}
|
||||
|
||||
using FourTilesAllContextsTest = MultitileMulticontextTests<4, MulticontextAubFixture::EnabledCommandStreamers::all>;
|
||||
using FourTilesAllContextsTest = MultitileMulticontextTests<4, MulticontextOclAubFixture::EnabledCommandStreamers::all>;
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, FourTilesAllContextsTest, GENERATEONLY_givenFourTilesAndAllContextsWhenWritingImageThenDataIsValid) {
|
||||
runAubWriteImageTest<FamilyType>();
|
||||
}
|
||||
|
||||
@@ -10,18 +10,19 @@
|
||||
#include "shared/test/common/utilities/base_object_utils.h"
|
||||
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct OneVAFourPhysicalStoragesTest : public MulticontextAubFixture, public ::testing::Test {
|
||||
struct OneVAFourPhysicalStoragesTest : public MulticontextOclAubFixture, public ::testing::Test {
|
||||
static const uint32_t numTiles = 4;
|
||||
void SetUp() override {
|
||||
MulticontextAubFixture::setUp(numTiles, MulticontextAubFixture::EnabledCommandStreamers::single, false);
|
||||
MulticontextOclAubFixture::setUp(numTiles, MulticontextOclAubFixture::EnabledCommandStreamers::single, false);
|
||||
}
|
||||
void TearDown() override {
|
||||
MulticontextAubFixture::tearDown();
|
||||
MulticontextOclAubFixture::tearDown();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,18 +11,18 @@
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
struct MultiTileBuffersXeHPAndLater : public MulticontextAubFixture, public ::testing::Test {
|
||||
struct MultiTileBuffersXeHPAndLater : public MulticontextOclAubFixture, public ::testing::Test {
|
||||
static constexpr uint32_t numTiles = 2;
|
||||
|
||||
void SetUp() override {
|
||||
MulticontextAubFixture::setUp(numTiles, EnabledCommandStreamers::single, false);
|
||||
MulticontextOclAubFixture::setUp(numTiles, EnabledCommandStreamers::single, false);
|
||||
}
|
||||
void TearDown() override {
|
||||
MulticontextAubFixture::tearDown();
|
||||
MulticontextOclAubFixture::tearDown();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "opencl/extensions/public/cl_ext_private.h"
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
using namespace NEO;
|
||||
|
||||
template <uint32_t numTiles, bool useLocalMemory = true>
|
||||
struct CopyEngineXeHPAndLater : public MulticontextAubFixture, public ::testing::Test {
|
||||
using MulticontextAubFixture::expectMemory;
|
||||
struct CopyEngineXeHPAndLater : public MulticontextOclAubFixture, public ::testing::Test {
|
||||
using MulticontextOclAubFixture::expectMemory;
|
||||
|
||||
void SetUp() override {
|
||||
if (is32bit) {
|
||||
@@ -56,7 +56,7 @@ struct CopyEngineXeHPAndLater : public MulticontextAubFixture, public ::testing:
|
||||
debugManager.flags.RenderCompressedImagesEnabled.set(true);
|
||||
debugManager.flags.EnableFreeMemory.set(false);
|
||||
|
||||
MulticontextAubFixture::setUp(numTiles, EnabledCommandStreamers::single, true);
|
||||
MulticontextOclAubFixture::setUp(numTiles, EnabledCommandStreamers::single, true);
|
||||
|
||||
defaultCommandQueue = commandQueues[0][0].get();
|
||||
bcsCsr = tileDevices[0]->getNearestGenericSubDevice(0)->getEngine(bcsEngineType, EngineUsage::regular).commandStreamReceiver;
|
||||
@@ -75,7 +75,7 @@ struct CopyEngineXeHPAndLater : public MulticontextAubFixture, public ::testing:
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
MulticontextAubFixture::tearDown();
|
||||
MulticontextOclAubFixture::tearDown();
|
||||
}
|
||||
|
||||
virtual bool compressionSupported() const {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2023 Intel Corporation
|
||||
# Copyright (C) 2018-2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -10,9 +10,8 @@ target_sources(igdrcl_aub_tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hello_world_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image_aub_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/multicontext_aub_fixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}multicontext_aub_fixture_extended.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/multicontext_aub_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/multicontext_ocl_aub_fixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/multicontext_ocl_aub_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/run_kernel_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simple_arg_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/unified_memory_fixture.cpp
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.h"
|
||||
|
||||
#include "shared/source/command_stream/aub_command_stream_receiver.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/common/tests_configuration.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/platform/platform.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_platform.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
void MulticontextOclAubFixture::setUp(uint32_t numberOfTiles, EnabledCommandStreamers enabledCommandStreamers, bool enableCompression) {
|
||||
MulticontextAubFixture::setUp(numberOfTiles, enabledCommandStreamers, enableCompression);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
||||
auto createCommandQueueForEngine = [&](uint32_t tileNumber, size_t engineFamily, size_t engineIndex) {
|
||||
cl_queue_properties properties[] = {CL_QUEUE_FAMILY_INTEL, engineFamily, CL_QUEUE_INDEX_INTEL, engineIndex, 0};
|
||||
auto clQueue = clCreateCommandQueueWithProperties(context.get(), tileDevices[tileNumber], properties, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
return std::unique_ptr<CommandQueue>(castToObject<CommandQueue>(clQueue));
|
||||
};
|
||||
|
||||
{
|
||||
cl_device_id deviceId = rootDevice.get();
|
||||
ClDeviceVector clDeviceVector{&deviceId, 1};
|
||||
if (numberOfTiles > 1) {
|
||||
for (uint32_t i = 0; i < numberOfTiles; i++) {
|
||||
clDeviceVector.push_back(rootDevice->getNearestGenericSubDevice(i));
|
||||
}
|
||||
}
|
||||
context.reset(MockContext::create<MockContext>(nullptr, clDeviceVector, nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
commandQueues.resize(numberOfTiles);
|
||||
for (uint32_t tile = 0; tile < numberOfTiles; tile++) {
|
||||
EXPECT_NE(nullptr, tileDevices[tile]);
|
||||
if (EnabledCommandStreamers::single == enabledCommandStreamers) {
|
||||
auto engineGroupType = isRenderEngineSupported ? EngineGroupType::renderCompute : EngineGroupType::compute;
|
||||
auto familyQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(engineGroupType);
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, familyQueue, 0));
|
||||
} else if (EnabledCommandStreamers::dual == enabledCommandStreamers) {
|
||||
auto ccsQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(EngineGroupType::compute);
|
||||
if (isRenderEngineSupported) {
|
||||
auto rcsQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(EngineGroupType::renderCompute);
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, rcsQueue, 0));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
} else if (isCcs1Supported) {
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 1));
|
||||
} else {
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
}
|
||||
} else if (EnabledCommandStreamers::all == enabledCommandStreamers) {
|
||||
if (isRenderEngineSupported) {
|
||||
auto rcsQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(EngineGroupType::renderCompute);
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, rcsQueue, 0));
|
||||
}
|
||||
auto ccsQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(EngineGroupType::compute);
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 1));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 2));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 3));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_device_id deviceId = rootDevice.get();
|
||||
multiTileDefaultContext.reset(MockContext::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
}
|
||||
|
||||
CommandStreamReceiver *MulticontextOclAubFixture::getGpgpuCsr(uint32_t tile, uint32_t engine) {
|
||||
return &(commandQueues[tile][engine]->getGpgpuCommandStreamReceiver());
|
||||
}
|
||||
|
||||
void MulticontextOclAubFixture::createDevices(const HardwareInfo &hwInfo, uint32_t numTiles) {
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useHwCsr = true;
|
||||
|
||||
rootDevice = std::make_unique<MockClDevice>(MockClDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, rootDeviceIndex));
|
||||
|
||||
EXPECT_EQ(rootDeviceIndex, rootDevice->getRootDeviceIndex());
|
||||
|
||||
for (uint32_t tile = 0; tile < numTiles; tile++) {
|
||||
tileDevices.push_back(rootDevice->getNearestGenericSubDevice(tile));
|
||||
EXPECT_NE(nullptr, tileDevices[tile]);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class MockClDevice;
|
||||
class ClDevice;
|
||||
class MockContext;
|
||||
class CommandQueue;
|
||||
|
||||
struct MulticontextOclAubFixture : public MulticontextAubFixture {
|
||||
void setUp(uint32_t numberOfTiles, EnabledCommandStreamers enabledCommandStreamers, bool enableCompression);
|
||||
|
||||
CommandStreamReceiver *getGpgpuCsr(uint32_t tile, uint32_t engine) override;
|
||||
void createDevices(const HardwareInfo &hwInfo, uint32_t numTiles) override;
|
||||
|
||||
std::vector<ClDevice *> tileDevices;
|
||||
std::unique_ptr<MockClDevice> rootDevice;
|
||||
std::unique_ptr<MockContext> context;
|
||||
std::unique_ptr<MockContext> multiTileDefaultContext;
|
||||
std::vector<std::vector<std::unique_ptr<CommandQueue>>> commandQueues;
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "opencl/source/api/api.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/program_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
|
||||
@@ -111,7 +111,7 @@ XE_HPC_CORETEST_F(SystemMemFenceViaComputeWalker, givenSystemMemFenceWhenPostSyn
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
class SystemMemFenceWithBlitter : public MulticontextAubFixture,
|
||||
class SystemMemFenceWithBlitter : public MulticontextOclAubFixture,
|
||||
public ::testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
@@ -122,10 +122,10 @@ class SystemMemFenceWithBlitter : public MulticontextAubFixture,
|
||||
debugManager.flags.EnableBlitterOperationsSupport.set(1);
|
||||
debugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
|
||||
MulticontextAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
MulticontextOclAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
}
|
||||
void TearDown() override {
|
||||
MulticontextAubFixture::tearDown();
|
||||
MulticontextOclAubFixture::tearDown();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
@@ -162,7 +162,7 @@ XE_HPC_CORETEST_F(SystemMemFenceWithBlitter, givenSystemMemFenceWhenGeneratedAsM
|
||||
}
|
||||
|
||||
class SystemMemFenceViaKernel : public ProgramFixture,
|
||||
public MulticontextAubFixture,
|
||||
public MulticontextOclAubFixture,
|
||||
public ::testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
@@ -171,10 +171,10 @@ class SystemMemFenceViaKernel : public ProgramFixture,
|
||||
debugManager.flags.ProgramGlobalFenceAsKernelInstructionInEUKernel.set(1);
|
||||
|
||||
ProgramFixture::setUp();
|
||||
MulticontextAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
MulticontextOclAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
}
|
||||
void TearDown() override {
|
||||
MulticontextAubFixture::tearDown();
|
||||
MulticontextOclAubFixture::tearDown();
|
||||
ProgramFixture::tearDown();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "opencl/source/api/api.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/program_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
|
||||
@@ -73,7 +73,7 @@ INSTANTIATE_TEST_CASE_P(,
|
||||
UmStatelessCompression,
|
||||
::testing::Bool());
|
||||
|
||||
class UmStatelessCompressionWithBlitter : public MulticontextAubFixture,
|
||||
class UmStatelessCompressionWithBlitter : public MulticontextOclAubFixture,
|
||||
public ::testing::Test,
|
||||
public ::testing::WithParamInterface<bool /*compareCompressedMemory*/> {
|
||||
public:
|
||||
@@ -83,10 +83,10 @@ class UmStatelessCompressionWithBlitter : public MulticontextAubFixture,
|
||||
debugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
compareCompressedMemory = GetParam();
|
||||
|
||||
MulticontextAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
MulticontextOclAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
}
|
||||
void TearDown() override {
|
||||
MulticontextAubFixture::tearDown();
|
||||
MulticontextOclAubFixture::tearDown();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
@@ -132,7 +132,7 @@ INSTANTIATE_TEST_CASE_P(,
|
||||
::testing::Bool());
|
||||
|
||||
class UmStatelessCompressionWithStatefulAccess : public ProgramFixture,
|
||||
public MulticontextAubFixture,
|
||||
public MulticontextOclAubFixture,
|
||||
public ::testing::Test,
|
||||
public ::testing::WithParamInterface<bool /*compareCompressedMemory*/> {
|
||||
public:
|
||||
@@ -144,10 +144,10 @@ class UmStatelessCompressionWithStatefulAccess : public ProgramFixture,
|
||||
compareCompressedMemory = GetParam();
|
||||
|
||||
ProgramFixture::setUp();
|
||||
MulticontextAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
MulticontextOclAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
}
|
||||
void TearDown() override {
|
||||
MulticontextAubFixture::tearDown();
|
||||
MulticontextOclAubFixture::tearDown();
|
||||
ProgramFixture::tearDown();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "opencl/extensions/public/cl_ext_private.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/simple_arg_kernel_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
|
||||
@@ -480,14 +480,14 @@ INSTANTIATE_TEST_CASE_P(,
|
||||
::testing::Values(aub_stream::ENGINE_RCS,
|
||||
aub_stream::ENGINE_CCS));
|
||||
|
||||
struct XeHpgCoreStatelessCompressionInSBAWithBCS : public MulticontextAubFixture,
|
||||
struct XeHpgCoreStatelessCompressionInSBAWithBCS : public MulticontextOclAubFixture,
|
||||
public StatelessCopyKernelFixture,
|
||||
public ::testing::Test {
|
||||
void SetUp() override {
|
||||
debugManager.flags.EnableStatelessCompression.set(1);
|
||||
debugManager.flags.ForceAuxTranslationMode.set(static_cast<int32_t>(AuxTranslationMode::blit));
|
||||
debugManager.flags.EnableBlitterOperationsSupport.set(true);
|
||||
MulticontextAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
MulticontextOclAubFixture::setUp(1, EnabledCommandStreamers::single, true);
|
||||
StatelessCopyKernelFixture::setUp(tileDevices[0], context.get());
|
||||
if (!tileDevices[0]->getHardwareInfo().featureTable.flags.ftrLocalMemory) {
|
||||
GTEST_SKIP();
|
||||
@@ -495,7 +495,7 @@ struct XeHpgCoreStatelessCompressionInSBAWithBCS : public MulticontextAubFixture
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
MulticontextAubFixture::tearDown();
|
||||
MulticontextOclAubFixture::tearDown();
|
||||
StatelessCopyKernelFixture::tearDown();
|
||||
}
|
||||
|
||||
|
||||
14
shared/test/common/fixtures/aub_fixtures/CMakeLists.txt
Normal file
14
shared/test/common/fixtures/aub_fixtures/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
target_sources(neo_libult_common PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/multicontext_aub_fixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/multicontext_aub_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}multicontext_aub_fixture_extended.cpp
|
||||
)
|
||||
|
||||
add_subdirectories()
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.h"
|
||||
#include "shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.h"
|
||||
|
||||
#include "shared/source/command_stream/aub_command_stream_receiver.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
@@ -15,25 +15,13 @@
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/common/tests_configuration.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/platform/platform.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_platform.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
MulticontextAubFixture::MulticontextAubFixture() = default;
|
||||
MulticontextAubFixture::~MulticontextAubFixture() = default;
|
||||
|
||||
void MulticontextAubFixture::setUp(uint32_t numberOfTiles, EnabledCommandStreamers enabledCommandStreamers, bool enableCompression) {
|
||||
this->numberOfEnabledTiles = numberOfTiles;
|
||||
const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
debugManager.flags.CsrDispatchMode.set(static_cast<int32_t>(DispatchMode::batchedDispatch));
|
||||
debugManager.flags.CreateMultipleSubDevices.set(numberOfTiles);
|
||||
|
||||
@@ -54,12 +42,12 @@ void MulticontextAubFixture::setUp(uint32_t numberOfTiles, EnabledCommandStreame
|
||||
debugManager.flags.RenderCompressedImagesEnabled.set(enableCompression);
|
||||
debugManager.flags.EnableBlitterForEnqueueOperations.set(false);
|
||||
|
||||
auto executionEnvironment = std::unique_ptr<ExecutionEnvironment>(MockClDevice::prepareExecutionEnvironment(&localHwInfo, rootDeviceIndex));
|
||||
auto executionEnvironment = std::unique_ptr<ExecutionEnvironment>(MockDevice::prepareExecutionEnvironment(&localHwInfo, rootDeviceIndex));
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setRcsExposure();
|
||||
localHwInfo = *executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
||||
auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getHelper<GfxCoreHelper>();
|
||||
auto renderEngine = aub_stream::NUM_ENGINES;
|
||||
bool isCcs1Supported = false;
|
||||
isCcs1Supported = false;
|
||||
for (auto &engine : gfxCoreHelper.getGpgpuEngineInstances(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex])) {
|
||||
if (!EngineHelpers::isCcs(engine.first)) {
|
||||
renderEngine = engine.first;
|
||||
@@ -68,7 +56,7 @@ void MulticontextAubFixture::setUp(uint32_t numberOfTiles, EnabledCommandStreame
|
||||
isCcs1Supported = true;
|
||||
}
|
||||
}
|
||||
bool isRenderEngineSupported = (renderEngine != aub_stream::NUM_ENGINES);
|
||||
isRenderEngineSupported = (renderEngine != aub_stream::NUM_ENGINES);
|
||||
auto firstEngine = isRenderEngineSupported ? renderEngine : aub_stream::ENGINE_CCS;
|
||||
|
||||
std::stringstream strfilename;
|
||||
@@ -108,71 +96,7 @@ void MulticontextAubFixture::setUp(uint32_t numberOfTiles, EnabledCommandStreame
|
||||
localHwInfo.capabilityTable.blitterOperationsSupported = !!debugManager.flags.EnableBlitterOperationsSupport.get();
|
||||
}
|
||||
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useHwCsr = true;
|
||||
|
||||
rootDevice = std::make_unique<MockClDevice>(MockClDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo, rootDeviceIndex));
|
||||
|
||||
auto createCommandQueueForEngine = [&](uint32_t tileNumber, size_t engineFamily, size_t engineIndex) {
|
||||
cl_queue_properties properties[] = {CL_QUEUE_FAMILY_INTEL, engineFamily, CL_QUEUE_INDEX_INTEL, engineIndex, 0};
|
||||
auto clQueue = clCreateCommandQueueWithProperties(context.get(), tileDevices[tileNumber], properties, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
return std::unique_ptr<CommandQueue>(castToObject<CommandQueue>(clQueue));
|
||||
};
|
||||
|
||||
EXPECT_EQ(rootDeviceIndex, rootDevice->getRootDeviceIndex());
|
||||
{
|
||||
cl_device_id deviceId = rootDevice.get();
|
||||
ClDeviceVector clDeviceVector{&deviceId, 1};
|
||||
if (numberOfTiles > 1) {
|
||||
for (uint32_t i = 0; i < numberOfTiles; i++) {
|
||||
clDeviceVector.push_back(rootDevice->getNearestGenericSubDevice(i));
|
||||
}
|
||||
}
|
||||
context.reset(MockContext::create<MockContext>(nullptr, clDeviceVector, nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
commandQueues.resize(numberOfTiles);
|
||||
for (uint32_t tile = 0; tile < numberOfTiles; tile++) {
|
||||
tileDevices.push_back(rootDevice->getNearestGenericSubDevice(tile));
|
||||
EXPECT_NE(nullptr, tileDevices[tile]);
|
||||
if (EnabledCommandStreamers::single == enabledCommandStreamers) {
|
||||
auto engineGroupType = isRenderEngineSupported ? EngineGroupType::renderCompute : EngineGroupType::compute;
|
||||
auto familyQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(engineGroupType);
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, familyQueue, 0));
|
||||
} else if (EnabledCommandStreamers::dual == enabledCommandStreamers) {
|
||||
auto ccsQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(EngineGroupType::compute);
|
||||
if (isRenderEngineSupported) {
|
||||
auto rcsQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(EngineGroupType::renderCompute);
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, rcsQueue, 0));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
} else if (isCcs1Supported) {
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 1));
|
||||
} else {
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
}
|
||||
} else if (EnabledCommandStreamers::all == enabledCommandStreamers) {
|
||||
if (isRenderEngineSupported) {
|
||||
auto rcsQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(EngineGroupType::renderCompute);
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, rcsQueue, 0));
|
||||
}
|
||||
auto ccsQueue = tileDevices[tile]->getDevice().getEngineGroupIndexFromEngineGroupType(EngineGroupType::compute);
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 0));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 1));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 2));
|
||||
commandQueues[tile].push_back(createCommandQueueForEngine(tile, ccsQueue, 3));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_device_id deviceId = rootDevice.get();
|
||||
multiTileDefaultContext.reset(MockContext::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
createDevices(localHwInfo, numberOfTiles);
|
||||
}
|
||||
|
||||
void MulticontextAubFixture::overridePlatformConfigForAllEnginesSupport(HardwareInfo &localHwInfo) {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,16 +11,14 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/tests_configuration.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class MockClDevice;
|
||||
class MockContext;
|
||||
class Device;
|
||||
class MockDevice;
|
||||
|
||||
struct MulticontextAubFixture {
|
||||
enum class EnabledCommandStreamers {
|
||||
@@ -29,23 +27,30 @@ struct MulticontextAubFixture {
|
||||
all, // RCS + CCS0-3
|
||||
};
|
||||
|
||||
MulticontextAubFixture();
|
||||
~MulticontextAubFixture();
|
||||
MulticontextAubFixture() = default;
|
||||
virtual ~MulticontextAubFixture() = default;
|
||||
|
||||
void setUp(uint32_t numberOfTiles, EnabledCommandStreamers enabledCommandStreamers, bool enableCompression);
|
||||
|
||||
virtual void createDevices(const HardwareInfo &hwInfo, uint32_t numTiles) = 0;
|
||||
|
||||
void tearDown() {}
|
||||
|
||||
virtual CommandStreamReceiver *getGpgpuCsr(uint32_t tile, uint32_t engine) = 0;
|
||||
|
||||
template <typename FamilyType>
|
||||
CommandStreamReceiverSimulatedCommonHw<FamilyType> *getSimulatedCsr(uint32_t tile, uint32_t engine) {
|
||||
using CsrWithAubDump = CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>>;
|
||||
using SimulatedCsr = CommandStreamReceiverSimulatedCommonHw<FamilyType>;
|
||||
SimulatedCsr *simulatedCsr = nullptr;
|
||||
|
||||
auto csr = getGpgpuCsr(tile, engine);
|
||||
|
||||
if (testMode == TestMode::aubTestsWithTbx) {
|
||||
auto csrWithAubDump = static_cast<CsrWithAubDump *>(&commandQueues[tile][engine]->getGpgpuCommandStreamReceiver());
|
||||
auto csrWithAubDump = static_cast<CsrWithAubDump *>(csr);
|
||||
simulatedCsr = static_cast<SimulatedCsr *>(csrWithAubDump);
|
||||
} else {
|
||||
simulatedCsr = static_cast<SimulatedCsr *>(&commandQueues[tile][engine]->getGpgpuCommandStreamReceiver());
|
||||
simulatedCsr = static_cast<SimulatedCsr *>(csr);
|
||||
}
|
||||
|
||||
return simulatedCsr;
|
||||
@@ -105,10 +110,7 @@ struct MulticontextAubFixture {
|
||||
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
uint32_t numberOfEnabledTiles = 0;
|
||||
std::vector<ClDevice *> tileDevices;
|
||||
std::unique_ptr<MockClDevice> rootDevice;
|
||||
std::unique_ptr<MockContext> context;
|
||||
std::unique_ptr<MockContext> multiTileDefaultContext;
|
||||
std::vector<std::vector<std::unique_ptr<CommandQueue>>> commandQueues;
|
||||
bool isCcs1Supported = false;
|
||||
bool isRenderEngineSupported = true;
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.h"
|
||||
#include "shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
Reference in New Issue
Block a user