mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 14:33:04 +08:00
Partial support for XE_HP_SDV
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e0a50d3143
commit
96d14967ac
@@ -108,4 +108,9 @@ TEST(KernelDescriptorAttributesSupportsBuffersBiggerThan4Gb, GivenStatefulBuffer
|
||||
EXPECT_FALSE(desc.kernelAttributes.supportsBuffersBiggerThan4Gb());
|
||||
desc.kernelAttributes.bufferAddressingMode = NEO::KernelDescriptor::BindlessAndStateless;
|
||||
EXPECT_FALSE(desc.kernelAttributes.supportsBuffersBiggerThan4Gb());
|
||||
}
|
||||
|
||||
TEST(KernelDescriptorTest, givenExtendedInfoWhenAskingForSpecialPipelineSelectModeThenReturnFalse) {
|
||||
NEO::ExtendedInfoBase extendedInfo;
|
||||
EXPECT_FALSE(extendedInfo.specialPipelineSelectModeRequired());
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
set(NEO_CORE_OS_INTERFACE_TESTS_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/app_resource_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/drm_query_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_special_heap_test.cpp
|
||||
)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/app_resource_helper.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(AppResourceLinuxTests, givenGraphicsAllocationTypeWhenCreatingStorageInfoFromPropertiesThenResourceTagAlwaysEmpty) {
|
||||
MockMemoryManager mockMemoryManager;
|
||||
const DeviceBitfield singleTileMask{static_cast<uint32_t>(1u << 2)};
|
||||
|
||||
auto allocationType = GraphicsAllocation::AllocationType::BUFFER;
|
||||
AllocationProperties properties{mockRootDeviceIndex, false, 1u, allocationType, false, singleTileMask};
|
||||
|
||||
auto tag = AppResourceHelper::getResourceTagStr(properties.allocationType);
|
||||
EXPECT_STREQ("", tag);
|
||||
|
||||
auto storageInfo = mockMemoryManager.createStorageInfoFromProperties(properties);
|
||||
EXPECT_STREQ(tag, storageInfo.resourceTag);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ set(NEO_CORE_OS_INTERFACE_TESTS_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/adapter_info_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/adapter_info_tests.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_app_resource_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper_tests_win.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gdi_interface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gdi_interface.h
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/app_resource_defines.h"
|
||||
#include "shared/source/helpers/app_resource_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/mock_execution_environment_gmm_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "test.h"
|
||||
|
||||
using MockExecutionEnvironmentGmmTest = Test<NEO::MockExecutionEnvironmentGmmFixture>;
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct GmmAppResourceWinTests : public MockExecutionEnvironmentGmmTest {
|
||||
void SetUp() override {
|
||||
MockExecutionEnvironmentGmmFixture::SetUp();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
localPlatformDevice = rootDeviceEnvironment->getMutableHardwareInfo();
|
||||
}
|
||||
|
||||
template <typename TGMM_RESCREATE_PARAMS>
|
||||
static auto getResourceTagGMM(TGMM_RESCREATE_PARAMS &src) {
|
||||
if constexpr (AppResourceDefines::has_ResourceTag<std::decay_t<decltype(src)>>) {
|
||||
return &src.ResourceTag;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
HardwareInfo *localPlatformDevice = nullptr;
|
||||
const DeviceBitfield singleTileMask{static_cast<uint32_t>(1u << 2)};
|
||||
};
|
||||
|
||||
TEST_F(GmmAppResourceWinTests, givenIncorrectGraphicsAllocationTypeWhenGettingResourceTagThenNOTFOUNDIsReturned) {
|
||||
auto tag = AppResourceHelper::getResourceTagStr(static_cast<GraphicsAllocation::AllocationType>(999));
|
||||
EXPECT_STREQ(tag, "NOTFOUND");
|
||||
}
|
||||
|
||||
TEST_F(GmmAppResourceWinTests, givenGraphicsAllocationTypeWhenGettingResourceTagThenForEveryDefinedTypeProperTagExist) {
|
||||
auto firstTypeIdx = static_cast<int>(GraphicsAllocation::AllocationType::UNKNOWN);
|
||||
auto lastTypeIdx = static_cast<int>(GraphicsAllocation::AllocationType::COUNT);
|
||||
|
||||
for (int typeIdx = firstTypeIdx; typeIdx < lastTypeIdx; typeIdx++) {
|
||||
auto allocationType = static_cast<GraphicsAllocation::AllocationType>(typeIdx);
|
||||
auto tag = AppResourceHelper::getResourceTagStr(allocationType);
|
||||
|
||||
EXPECT_LE(strlen(tag), AppResourceDefines::maxStrLen);
|
||||
EXPECT_STRNE(tag, "NOTFOUND");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(GmmAppResourceWinTests, givenStorageInfoCreatedFromPropertiesWhenEnableResourceTagsThenGmmResourceTagIsSet) {
|
||||
if (!AppResourceDefines::resourceTagSupport) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
MockMemoryManager mockMemoryManager(*executionEnvironment);
|
||||
|
||||
auto firstTypeIdx = static_cast<int>(GraphicsAllocation::AllocationType::UNKNOWN);
|
||||
auto lastTypeIdx = static_cast<int>(GraphicsAllocation::AllocationType::COUNT);
|
||||
DebugManager.flags.EnableResourceTags.set(true);
|
||||
|
||||
for (int typeIdx = firstTypeIdx; typeIdx != lastTypeIdx; typeIdx++) {
|
||||
auto allocationType = static_cast<GraphicsAllocation::AllocationType>(typeIdx);
|
||||
|
||||
AllocationProperties properties{mockRootDeviceIndex, false, 1u, allocationType, false, singleTileMask};
|
||||
auto storageInfo = mockMemoryManager.createStorageInfoFromProperties(properties);
|
||||
auto expectedSize = (AppResourceDefines::maxStrLen + 1) * sizeof(char);
|
||||
|
||||
EXPECT_EQ(expectedSize, sizeof(storageInfo.resourceTag));
|
||||
auto tag = AppResourceHelper::getResourceTagStr(properties.allocationType);
|
||||
EXPECT_STREQ(storageInfo.resourceTag, tag);
|
||||
}
|
||||
}
|
||||
|
||||
struct AllocationTypeTagTestCase {
|
||||
GraphicsAllocation::AllocationType type;
|
||||
const char *str;
|
||||
};
|
||||
|
||||
AllocationTypeTagTestCase allocationTypeTagValues[static_cast<int>(GraphicsAllocation::AllocationType::COUNT)] = {
|
||||
{GraphicsAllocation::AllocationType::BUFFER, "BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, "BFCMPRSD"},
|
||||
{GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, "BFHSTMEM"},
|
||||
{GraphicsAllocation::AllocationType::COMMAND_BUFFER, "CMNDBUFF"},
|
||||
{GraphicsAllocation::AllocationType::CONSTANT_SURFACE, "CSNTSRFC"},
|
||||
{GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, "DEVQUEBF"},
|
||||
{GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, "EXHSTPTR"},
|
||||
{GraphicsAllocation::AllocationType::FILL_PATTERN, "FILPATRN"},
|
||||
{GraphicsAllocation::AllocationType::GLOBAL_SURFACE, "GLBLSRFC"},
|
||||
{GraphicsAllocation::AllocationType::IMAGE, "IMAGE"},
|
||||
{GraphicsAllocation::AllocationType::INDIRECT_OBJECT_HEAP, "INOBHEAP"},
|
||||
{GraphicsAllocation::AllocationType::INSTRUCTION_HEAP, "INSTHEAP"},
|
||||
{GraphicsAllocation::AllocationType::INTERNAL_HEAP, "INTLHEAP"},
|
||||
{GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, "INHSTMEM"},
|
||||
{GraphicsAllocation::AllocationType::KERNEL_ISA, "KERNLISA"},
|
||||
{GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL, "KRLISAIN"},
|
||||
{GraphicsAllocation::AllocationType::LINEAR_STREAM, "LINRSTRM"},
|
||||
{GraphicsAllocation::AllocationType::MAP_ALLOCATION, "MAPALLOC"},
|
||||
{GraphicsAllocation::AllocationType::MCS, "MCS"},
|
||||
{GraphicsAllocation::AllocationType::PIPE, "PIPE"},
|
||||
{GraphicsAllocation::AllocationType::PREEMPTION, "PRMPTION"},
|
||||
{GraphicsAllocation::AllocationType::PRINTF_SURFACE, "PRNTSRFC"},
|
||||
{GraphicsAllocation::AllocationType::PRIVATE_SURFACE, "PRVTSRFC"},
|
||||
{GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER, "PROFTGBF"},
|
||||
{GraphicsAllocation::AllocationType::SCRATCH_SURFACE, "SCRHSRFC"},
|
||||
{GraphicsAllocation::AllocationType::WORK_PARTITION_SURFACE, "WRPRTSRF"},
|
||||
{GraphicsAllocation::AllocationType::SHARED_BUFFER, "SHRDBUFF"},
|
||||
{GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE, "SRDCXIMG"},
|
||||
{GraphicsAllocation::AllocationType::SHARED_IMAGE, "SHERDIMG"},
|
||||
{GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY, "SRDRSCCP"},
|
||||
{GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP, "SRFCSTHP"},
|
||||
{GraphicsAllocation::AllocationType::SVM_CPU, "SVM_CPU"},
|
||||
{GraphicsAllocation::AllocationType::SVM_GPU, "SVM_GPU"},
|
||||
{GraphicsAllocation::AllocationType::SVM_ZERO_COPY, "SVM0COPY"},
|
||||
{GraphicsAllocation::AllocationType::TAG_BUFFER, "TAGBUFER"},
|
||||
{GraphicsAllocation::AllocationType::GLOBAL_FENCE, "GLBLFENC"},
|
||||
{GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, "TSPKTGBF"},
|
||||
{GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"},
|
||||
{GraphicsAllocation::AllocationType::WRITE_COMBINED, "WRTCMBND"},
|
||||
{GraphicsAllocation::AllocationType::RING_BUFFER, "RINGBUFF"},
|
||||
{GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER, "SMPHRBUF"},
|
||||
{GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA, "DBCXSVAR"},
|
||||
{GraphicsAllocation::AllocationType::DEBUG_SBA_TRACKING_BUFFER, "DBSBATRB"},
|
||||
{GraphicsAllocation::AllocationType::DEBUG_MODULE_AREA, "DBMDLARE"},
|
||||
{GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY, "USHRDMEM"},
|
||||
{GraphicsAllocation::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER, "GPUTSDBF"}};
|
||||
class AllocationTypeTagString : public ::testing::TestWithParam<AllocationTypeTagTestCase> {};
|
||||
|
||||
TEST_P(AllocationTypeTagString, givenGraphicsAllocationTypeWhenCopyTagToStorageInfoThenCorrectTagIsReturned) {
|
||||
if (!AppResourceDefines::resourceTagSupport) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
StorageInfo storageInfo = {};
|
||||
auto input = GetParam();
|
||||
|
||||
DebugManager.flags.EnableResourceTags.set(true);
|
||||
AppResourceHelper::copyResourceTagStr(storageInfo.resourceTag, input.type,
|
||||
sizeof(storageInfo.resourceTag));
|
||||
EXPECT_STREQ(storageInfo.resourceTag, input.str);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllAllocationTypesTag, AllocationTypeTagString, ::testing::ValuesIn(allocationTypeTagValues));
|
||||
Reference in New Issue
Block a user