mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Refactor tests with magic numbers on xe_hpc
-Steppings not baseDieA0 is available only on pvc xt -Convert to use proper configuration in specific tests scenarios Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c25d2a1769
commit
65e70c7a0f
@@ -13,6 +13,8 @@ if(TESTS_XE_HPC_CORE)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_l0_hw_helper_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_module_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/xe_hpc_core_test_l0_fixtures.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/xe_hpc_core_test_l0_fixtures.cpp
|
||||
)
|
||||
add_subdirectories()
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_PVC)
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_pvc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_cmdlist_pvc.cpp
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
|
||||
#include "level_zero/core/test/unit_tests/xe_hpc_core/xe_hpc_core_test_l0_fixtures.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using CommandListStatePrefetchPvcXt = Test<CommandListStatePrefetchXeHpcCore>;
|
||||
|
||||
PVCTEST_F(CommandListStatePrefetchPvcXt, givenCommandBufferIsExhaustedWhenPrefetchApiCalledAndIsPvcXtNotBaseDieA0ThenProgramStatePrefetch) {
|
||||
auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||
hwInfo->platform.usDeviceID = PVC_XT_IDS.front();
|
||||
hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, *hwInfo); // not BD A0
|
||||
checkIfCommandBufferIsExhaustedWhenPrefetchApiCalledThenStatePrefetchProgrammed(hwInfo);
|
||||
}
|
||||
|
||||
PVCTEST_F(CommandListStatePrefetchPvcXt, givenDebugFlagSetWhenPrefetchApiCalledAndIsPvcXtNotBaseDieA0ThenProgramStatePrefetch) {
|
||||
auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||
hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
hwInfo->platform.usDeviceID = PVC_XT_IDS.front();
|
||||
hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, *hwInfo); // not BD A0
|
||||
checkIfDebugFlagSetWhenPrefetchApiCalledAThenStatePrefetchProgrammed(hwInfo);
|
||||
}
|
||||
|
||||
using CommandListEventFenceTestsPvc = Test<ModuleFixture>;
|
||||
|
||||
PVCTEST_F(CommandListEventFenceTestsPvc, givenCommandListWithProfilingEventAfterCommandOnPvcRev00ThenMiFenceIsNotAdded) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<IGFX_XE_HPC_CORE>::GfxFamily;
|
||||
using MI_MEM_FENCE = typename FamilyType::MI_MEM_FENCE;
|
||||
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<IGFX_XE_HPC_CORE>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
|
||||
auto hwInfo = commandList->commandContainer.getDevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
hwInfo->platform.usRevId = 0x00;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = 0;
|
||||
eventDesc.wait = 0;
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
auto event = std::unique_ptr<L0::Event>(L0::Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
|
||||
commandList->appendEventForProfiling(event->toHandle(), false, false);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<MI_MEM_FENCE *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(cmdList.end(), itor);
|
||||
}
|
||||
|
||||
using CommandListAppendBarrierXeHpcCore = Test<DeviceFixture>;
|
||||
|
||||
PVCTEST_F(CommandListAppendBarrierXeHpcCore, givenCommandListWhenAppendingBarrierThenPipeControlIsProgrammedAndHdcAndUnTypedFlushesAreSet) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<IGFX_XE_HPC_CORE>::GfxFamily;
|
||||
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<IGFX_XE_HPC_CORE>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
ze_result_t returnValue = commandList->appendBarrier(nullptr, 0, nullptr);
|
||||
EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
|
||||
// PC for STATE_BASE_ADDRESS from list initialization
|
||||
auto itor = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
itor++;
|
||||
|
||||
// PC for appendBarrier
|
||||
itor = find<PIPE_CONTROL *>(itor, cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
|
||||
auto pipeControlCmd = reinterpret_cast<typename FamilyType::PIPE_CONTROL *>(*itor);
|
||||
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
|
||||
EXPECT_TRUE(pipeControlCmd->getUnTypedDataPortCacheFlush());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/implicit_scaling.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "level_zero/core/source/cmdlist/cmdlist_imp.h"
|
||||
#include "level_zero/core/source/hw_helpers/l0_hw_helper.h"
|
||||
#include "level_zero/core/test/unit_tests/xe_hpc_core/xe_hpc_core_test_l0_fixtures.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using DeviceTestPvcXt = Test<DeviceFixtureXeHpcTests>;
|
||||
|
||||
PVCTEST_F(DeviceTestPvcXt, whenCallingGetMemoryPropertiesWithNonNullPtrAndRevisionIsNotBaseDieA0OnPvcXtThenMaxClockRateReturnedIsZero) {
|
||||
auto &device = driverHandle->devices[0];
|
||||
auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||
hwInfo->platform.usDeviceID = PVC_XT_IDS.front();
|
||||
hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, *hwInfo); // not BD A0
|
||||
|
||||
checkIfCallingGetMemoryPropertiesWithNonNullPtrThenMaxClockRateReturnZero(hwInfo);
|
||||
}
|
||||
|
||||
using DeviceTestPvc = Test<DeviceFixtureXeHpcTests>;
|
||||
PVCTEST_F(DeviceTestPvc, givenPvcAStepWhenCreatingMultiTileDeviceThenExpectImplicitScalingDisabled) {
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
VariableBackup<bool> apiSupportBackup(&NEO::ImplicitScaling::apiSupport, true);
|
||||
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
std::unique_ptr<DriverHandleImp> driverHandle(new DriverHandleImp);
|
||||
|
||||
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
auto device = Device::create(driverHandle.get(), neoDevice.release(), false, &returnValue);
|
||||
ASSERT_NE(nullptr, device);
|
||||
|
||||
EXPECT_FALSE(device->isImplicitScalingCapable());
|
||||
|
||||
static_cast<DeviceImp *>(device)->releaseResources();
|
||||
delete device;
|
||||
}
|
||||
|
||||
PVCTEST_F(DeviceTestPvc, whenCallingGetMemoryPropertiesWithNonNullPtrThenPropertiesAreReturned) {
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = device->getMemoryProperties(&count, nullptr);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
ze_device_memory_properties_t memProperties = {};
|
||||
res = device->getMemoryProperties(&count, &memProperties);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
EXPECT_EQ(memProperties.maxClockRate, 3200u);
|
||||
EXPECT_EQ(memProperties.maxBusWidth, this->neoDevice->getDeviceInfo().addressBits);
|
||||
EXPECT_EQ(memProperties.totalSize, this->neoDevice->getDeviceInfo().globalMemSize);
|
||||
}
|
||||
|
||||
PVCTEST_F(DeviceTestPvc, GivenPvcWhenGettingPhysicalEuSimdWidthThenReturn16) {
|
||||
ze_device_properties_t properties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
device->getProperties(&properties);
|
||||
EXPECT_EQ(16u, properties.physicalEUSimdWidth);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -55,57 +55,6 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore, givenKernelUsingSyncBufferWhen
|
||||
|
||||
using CommandListStatePrefetchXeHpcCore = Test<ModuleFixture>;
|
||||
|
||||
HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenDebugFlagSetWhenPrefetchApiCalledAndIsNotBaseDieA0ThenProgramStatePrefetch, IsXeHpcCore) {
|
||||
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
constexpr size_t size = MemoryConstants::cacheLineSize * 2;
|
||||
constexpr size_t alignment = MemoryConstants::pageSize64k;
|
||||
constexpr size_t offset = MemoryConstants::cacheLineSize;
|
||||
constexpr uint32_t mocsIndexForL3 = (2 << 1);
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
context->allocDeviceMem(device->toHandle(), &deviceDesc, size + offset, alignment, &ptr);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
hwInfo->platform.usRevId = 0x8; // not BD A0
|
||||
|
||||
auto cmdListBaseOffset = pCommandList->commandContainer.getCommandStream()->getUsed();
|
||||
|
||||
{
|
||||
auto ret = pCommandList->appendMemoryPrefetch(ptrOffset(ptr, offset), size);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
||||
|
||||
EXPECT_EQ(cmdListBaseOffset, pCommandList->commandContainer.getCommandStream()->getUsed());
|
||||
}
|
||||
|
||||
{
|
||||
DebugManager.flags.AddStatePrefetchCmdToMemoryPrefetchAPI.set(1);
|
||||
|
||||
auto ret = pCommandList->appendMemoryPrefetch(ptrOffset(ptr, offset), size);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
||||
|
||||
EXPECT_EQ(cmdListBaseOffset + sizeof(STATE_PREFETCH), pCommandList->commandContainer.getCommandStream()->getUsed());
|
||||
|
||||
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(ptrOffset(pCommandList->commandContainer.getCommandStream()->getCpuBase(), cmdListBaseOffset));
|
||||
|
||||
EXPECT_EQ(statePrefetchCmd->getAddress(), reinterpret_cast<uint64_t>(ptrOffset(ptr, offset)));
|
||||
EXPECT_FALSE(statePrefetchCmd->getKernelInstructionPrefetch());
|
||||
EXPECT_EQ(mocsIndexForL3, statePrefetchCmd->getMemoryObjectControlState());
|
||||
EXPECT_EQ(1u, statePrefetchCmd->getPrefetchSize());
|
||||
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(ptr), pCommandList->commandContainer.getResidencyContainer().back()->getGpuAddress());
|
||||
}
|
||||
|
||||
context->freeMem(ptr);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenUnifiedSharedMemoryWhenPrefetchApiCalledThenDontSetMemPrefetch, IsXeHpcCore) {
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
@@ -271,92 +220,6 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr
|
||||
context->freeMem(ptr);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenCommandBufferIsExhaustedWhenPrefetchApiCalledAndIsNotBaseDieA0ThenProgramStatePrefetch, IsXeHpcCore) {
|
||||
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
|
||||
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
constexpr size_t size = MemoryConstants::cacheLineSize * 2;
|
||||
constexpr size_t alignment = MemoryConstants::pageSize64k;
|
||||
constexpr size_t offset = MemoryConstants::cacheLineSize;
|
||||
constexpr uint32_t mocsIndexForL3 = (2 << 1);
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
context->allocDeviceMem(device->toHandle(), &deviceDesc, size + offset, alignment, &ptr);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
hwInfo->platform.usRevId = 0x8; // not BD A0
|
||||
|
||||
auto firstBatchBufferAllocation = pCommandList->commandContainer.getCommandStream()->getGraphicsAllocation();
|
||||
|
||||
auto useSize = pCommandList->commandContainer.getCommandStream()->getAvailableSpace();
|
||||
useSize -= sizeof(MI_BATCH_BUFFER_END);
|
||||
pCommandList->commandContainer.getCommandStream()->getSpace(useSize);
|
||||
|
||||
DebugManager.flags.AddStatePrefetchCmdToMemoryPrefetchAPI.set(1);
|
||||
|
||||
auto ret = pCommandList->appendMemoryPrefetch(ptrOffset(ptr, offset), size);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
||||
auto secondBatchBufferAllocation = pCommandList->commandContainer.getCommandStream()->getGraphicsAllocation();
|
||||
|
||||
EXPECT_NE(firstBatchBufferAllocation, secondBatchBufferAllocation);
|
||||
|
||||
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(pCommandList->commandContainer.getCommandStream()->getCpuBase());
|
||||
|
||||
EXPECT_EQ(statePrefetchCmd->getAddress(), reinterpret_cast<uint64_t>(ptrOffset(ptr, offset)));
|
||||
EXPECT_FALSE(statePrefetchCmd->getKernelInstructionPrefetch());
|
||||
EXPECT_EQ(mocsIndexForL3, statePrefetchCmd->getMemoryObjectControlState());
|
||||
EXPECT_EQ(1u, statePrefetchCmd->getPrefetchSize());
|
||||
|
||||
NEO::ResidencyContainer::iterator it = pCommandList->commandContainer.getResidencyContainer().end();
|
||||
it--;
|
||||
EXPECT_EQ(secondBatchBufferAllocation->getGpuAddress(), (*it)->getGpuAddress());
|
||||
it--;
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(ptr), (*it)->getGpuAddress());
|
||||
|
||||
context->freeMem(ptr);
|
||||
}
|
||||
|
||||
using CommandListEventFenceTestsPvc = Test<ModuleFixture>;
|
||||
|
||||
HWTEST2_F(CommandListEventFenceTestsPvc, givenCommandListWithProfilingEventAfterCommandOnPvcRev00ThenMiFenceIsNotAdded, IsPVC) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using MI_MEM_FENCE = typename FamilyType::MI_MEM_FENCE;
|
||||
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
|
||||
auto hwInfo = commandList->commandContainer.getDevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
hwInfo->platform.usRevId = 0x00;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = 0;
|
||||
eventDesc.wait = 0;
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
auto event = std::unique_ptr<L0::Event>(L0::Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
|
||||
commandList->appendEventForProfiling(event->toHandle(), false, false);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<MI_MEM_FENCE *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(cmdList.end(), itor);
|
||||
}
|
||||
|
||||
using CommandListEventFenceTestsXeHpcCore = Test<ModuleFixture>;
|
||||
|
||||
HWTEST2_F(CommandListEventFenceTestsXeHpcCore, givenCommandListWithProfilingEventAfterCommandWhenRevId03ThenMiFenceIsAdded, IsXeHpcCore) {
|
||||
@@ -448,33 +311,5 @@ HWTEST2_F(CommandListAppendRangesBarrierXeHpcCore, givenCallToAppendRangesBarrie
|
||||
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
|
||||
EXPECT_TRUE(pipeControlCmd->getUnTypedDataPortCacheFlush());
|
||||
}
|
||||
|
||||
using CommandListAppendBarrierXeHpcCore = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(CommandListAppendBarrierXeHpcCore, givenCommandListWhenAppendingBarrierThenPipeControlIsProgrammedAndHdcAndUnTypedFlushesAreSet, IsPVC) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||
ze_result_t returnValue = commandList->appendBarrier(nullptr, 0, nullptr);
|
||||
EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
|
||||
// PC for STATE_BASE_ADDRESS from list initialization
|
||||
auto itor = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
itor++;
|
||||
|
||||
// PC for appendBarrier
|
||||
itor = find<PIPE_CONTROL *>(itor, cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
|
||||
auto pipeControlCmd = reinterpret_cast<typename FamilyType::PIPE_CONTROL *>(*itor);
|
||||
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
|
||||
EXPECT_TRUE(pipeControlCmd->getUnTypedDataPortCacheFlush());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/implicit_scaling.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
@@ -22,24 +21,6 @@ HWTEST_EXCLUDE_PRODUCT(AppendMemoryCopy, givenCopyOnlyCommandListAndHostPointers
|
||||
|
||||
using DeviceTestXeHpc = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(DeviceTestXeHpc, whenCallingGetMemoryPropertiesWithNonNullPtrAndBdRevisionIsNotA0ThenmaxClockRateReturnedIsZero, IsXeHpcCore) {
|
||||
uint32_t count = 0;
|
||||
auto device = driverHandle->devices[0];
|
||||
auto hwInfo = device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
hwInfo->platform.usRevId = 0x8; // not BD A0
|
||||
|
||||
ze_result_t res = device->getMemoryProperties(&count, nullptr);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
ze_device_memory_properties_t memProperties = {};
|
||||
res = device->getMemoryProperties(&count, &memProperties);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
EXPECT_EQ(memProperties.maxClockRate, 0u);
|
||||
}
|
||||
|
||||
HWTEST2_F(DeviceTestXeHpc, givenXeHpcAStepAndDebugFlagOverridesWhenCreatingMultiTileDeviceThenExpectImplicitScalingEnabled, IsXeHpcCore) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
@@ -49,7 +30,8 @@ HWTEST2_F(DeviceTestXeHpc, givenXeHpcAStepAndDebugFlagOverridesWhenCreatingMulti
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
std::unique_ptr<DriverHandleImp> driverHandle(new DriverHandleImp);
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
hwInfo.platform.usRevId = 0x3;
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
|
||||
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
auto device = Device::create(driverHandle.get(), neoDevice.release(), false, &returnValue);
|
||||
@@ -69,7 +51,8 @@ HWTEST2_F(DeviceTestXeHpc, givenXeHpcBStepWhenCreatingMultiTileDeviceThenExpectI
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
std::unique_ptr<DriverHandleImp> driverHandle(new DriverHandleImp);
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
hwInfo.platform.usRevId = 0x6;
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
|
||||
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
auto device = Device::create(driverHandle.get(), neoDevice.release(), false, &returnValue);
|
||||
@@ -81,44 +64,6 @@ HWTEST2_F(DeviceTestXeHpc, givenXeHpcBStepWhenCreatingMultiTileDeviceThenExpectI
|
||||
delete device;
|
||||
}
|
||||
|
||||
using DeviceTestPvc = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(DeviceTestPvc, givenPvcAStepWhenCreatingMultiTileDeviceThenExpectImplicitScalingDisabled, IsPVC) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
VariableBackup<bool> apiSupportBackup(&NEO::ImplicitScaling::apiSupport, true);
|
||||
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
std::unique_ptr<DriverHandleImp> driverHandle(new DriverHandleImp);
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
hwInfo.platform.usRevId = 0x3;
|
||||
|
||||
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
auto device = Device::create(driverHandle.get(), neoDevice.release(), false, &returnValue);
|
||||
ASSERT_NE(nullptr, device);
|
||||
|
||||
EXPECT_FALSE(device->isImplicitScalingCapable());
|
||||
|
||||
static_cast<DeviceImp *>(device)->releaseResources();
|
||||
delete device;
|
||||
}
|
||||
|
||||
HWTEST2_F(DeviceTestPvc, whenCallingGetMemoryPropertiesWithNonNullPtrThenPropertiesAreReturned, IsPVC) {
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = device->getMemoryProperties(&count, nullptr);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
ze_device_memory_properties_t memProperties = {};
|
||||
res = device->getMemoryProperties(&count, &memProperties);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
EXPECT_EQ(memProperties.maxClockRate, 3200u);
|
||||
EXPECT_EQ(memProperties.maxBusWidth, this->neoDevice->getDeviceInfo().addressBits);
|
||||
EXPECT_EQ(memProperties.totalSize, this->neoDevice->getDeviceInfo().globalMemSize);
|
||||
}
|
||||
|
||||
using MultiDeviceCommandQueueGroupWithNineCopyEnginesTest = Test<SingleRootMultiSubDeviceFixtureWithImplicitScaling<9, 1>>;
|
||||
|
||||
HWTEST2_F(MultiDeviceCommandQueueGroupWithNineCopyEnginesTest, givenMainAndLinkCopyEngineSupportAndCCSAndImplicitScalingThenExpectedQueueGroupsAreReturned, IsXeHpcCore) {
|
||||
@@ -397,22 +342,20 @@ HWTEST2_F(CommandQueueGroupTest, givenBlitterDisabledAndAllBcsSetThenTwoQueueGro
|
||||
EXPECT_EQ(count, 2u);
|
||||
}
|
||||
|
||||
class DeviceCopyQueueGroupFixture : public DeviceFixture {
|
||||
class DeviceCopyQueueGroupXeHpcFixture : public DeviceFixture {
|
||||
public:
|
||||
void SetUp() {
|
||||
DebugManager.flags.EnableBlitterOperationsSupport.set(0);
|
||||
DeviceFixture::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
DeviceFixture::TearDown();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
using DeviceCopyQueueGroupXeHpcTest = Test<DeviceCopyQueueGroupXeHpcFixture>;
|
||||
|
||||
using DeviceCopyQueueGroupTest = Test<DeviceCopyQueueGroupFixture>;
|
||||
|
||||
HWTEST2_F(DeviceCopyQueueGroupTest,
|
||||
HWTEST2_F(DeviceCopyQueueGroupXeHpcTest,
|
||||
givenBlitterSupportAndEnableBlitterOperationsSupportSetToZeroThenNoCopyEngineIsReturned, IsXeHpcCore) {
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
@@ -446,11 +389,5 @@ HWTEST2_F(DeviceTestXeHpc, givenReturnedDevicePropertiesThenExpectedPropertyFlag
|
||||
EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED);
|
||||
}
|
||||
|
||||
HWTEST2_F(DeviceTestXeHpc, GivenPvcWhenGettingPhysicalEuSimdWidthThenReturn16, IsPVC) {
|
||||
ze_device_properties_t properties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
device->getProperties(&properties);
|
||||
EXPECT_EQ(16u, properties.physicalEUSimdWidth);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/core/test/unit_tests/xe_hpc_core/xe_hpc_core_test_l0_fixtures.h"
|
||||
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
|
||||
|
||||
using namespace L0;
|
||||
using namespace ult;
|
||||
|
||||
void DeviceFixtureXeHpcTests::checkIfCallingGetMemoryPropertiesWithNonNullPtrThenMaxClockRateReturnZero(HardwareInfo *hwInfo) {
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = device->getMemoryProperties(&count, nullptr);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
ze_device_memory_properties_t memProperties = {};
|
||||
res = device->getMemoryProperties(&count, &memProperties);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
EXPECT_EQ(memProperties.maxClockRate, 0u);
|
||||
}
|
||||
|
||||
void CommandListStatePrefetchXeHpcCore::checkIfDebugFlagSetWhenPrefetchApiCalledAThenStatePrefetchProgrammed(HardwareInfo *hwInfo) {
|
||||
using STATE_PREFETCH = typename XE_HPC_COREFamily::STATE_PREFETCH;
|
||||
DebugManagerStateRestore restore;
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<IGFX_XE_HPC_CORE>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
constexpr size_t size = MemoryConstants::cacheLineSize * 2;
|
||||
constexpr size_t alignment = MemoryConstants::pageSize64k;
|
||||
constexpr size_t offset = MemoryConstants::cacheLineSize;
|
||||
constexpr uint32_t mocsIndexForL3 = (2 << 1);
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
context->allocDeviceMem(device->toHandle(), &deviceDesc, size + offset, alignment, &ptr);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
auto cmdListBaseOffset = pCommandList->commandContainer.getCommandStream()->getUsed();
|
||||
|
||||
{
|
||||
auto ret = pCommandList->appendMemoryPrefetch(ptrOffset(ptr, offset), size);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
||||
|
||||
EXPECT_EQ(cmdListBaseOffset, pCommandList->commandContainer.getCommandStream()->getUsed());
|
||||
}
|
||||
|
||||
{
|
||||
DebugManager.flags.AddStatePrefetchCmdToMemoryPrefetchAPI.set(1);
|
||||
|
||||
auto ret = pCommandList->appendMemoryPrefetch(ptrOffset(ptr, offset), size);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
||||
|
||||
EXPECT_EQ(cmdListBaseOffset + sizeof(STATE_PREFETCH), pCommandList->commandContainer.getCommandStream()->getUsed());
|
||||
|
||||
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(ptrOffset(pCommandList->commandContainer.getCommandStream()->getCpuBase(), cmdListBaseOffset));
|
||||
|
||||
EXPECT_EQ(statePrefetchCmd->getAddress(), reinterpret_cast<uint64_t>(ptrOffset(ptr, offset)));
|
||||
EXPECT_FALSE(statePrefetchCmd->getKernelInstructionPrefetch());
|
||||
EXPECT_EQ(mocsIndexForL3, statePrefetchCmd->getMemoryObjectControlState());
|
||||
EXPECT_EQ(1u, statePrefetchCmd->getPrefetchSize());
|
||||
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(ptr), pCommandList->commandContainer.getResidencyContainer().back()->getGpuAddress());
|
||||
}
|
||||
|
||||
context->freeMem(ptr);
|
||||
}
|
||||
|
||||
void CommandListStatePrefetchXeHpcCore::checkIfCommandBufferIsExhaustedWhenPrefetchApiCalledThenStatePrefetchProgrammed(HardwareInfo *hwInfo) {
|
||||
using STATE_PREFETCH = typename XE_HPC_COREFamily::STATE_PREFETCH;
|
||||
using MI_BATCH_BUFFER_END = typename XE_HPC_COREFamily::MI_BATCH_BUFFER_END;
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<IGFX_XE_HPC_CORE>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
constexpr size_t size = MemoryConstants::cacheLineSize * 2;
|
||||
constexpr size_t alignment = MemoryConstants::pageSize64k;
|
||||
constexpr size_t offset = MemoryConstants::cacheLineSize;
|
||||
constexpr uint32_t mocsIndexForL3 = (2 << 1);
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
context->allocDeviceMem(device->toHandle(), &deviceDesc, size + offset, alignment, &ptr);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
auto firstBatchBufferAllocation = pCommandList->commandContainer.getCommandStream()->getGraphicsAllocation();
|
||||
|
||||
auto useSize = pCommandList->commandContainer.getCommandStream()->getAvailableSpace();
|
||||
useSize -= sizeof(MI_BATCH_BUFFER_END);
|
||||
pCommandList->commandContainer.getCommandStream()->getSpace(useSize);
|
||||
|
||||
DebugManager.flags.AddStatePrefetchCmdToMemoryPrefetchAPI.set(1);
|
||||
|
||||
auto ret = pCommandList->appendMemoryPrefetch(ptrOffset(ptr, offset), size);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
||||
auto secondBatchBufferAllocation = pCommandList->commandContainer.getCommandStream()->getGraphicsAllocation();
|
||||
|
||||
EXPECT_NE(firstBatchBufferAllocation, secondBatchBufferAllocation);
|
||||
|
||||
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(pCommandList->commandContainer.getCommandStream()->getCpuBase());
|
||||
|
||||
EXPECT_EQ(statePrefetchCmd->getAddress(), reinterpret_cast<uint64_t>(ptrOffset(ptr, offset)));
|
||||
EXPECT_FALSE(statePrefetchCmd->getKernelInstructionPrefetch());
|
||||
EXPECT_EQ(mocsIndexForL3, statePrefetchCmd->getMemoryObjectControlState());
|
||||
EXPECT_EQ(1u, statePrefetchCmd->getPrefetchSize());
|
||||
|
||||
NEO::ResidencyContainer::iterator it = pCommandList->commandContainer.getResidencyContainer().end();
|
||||
it--;
|
||||
EXPECT_EQ(secondBatchBufferAllocation->getGpuAddress(), (*it)->getGpuAddress());
|
||||
it--;
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(ptr), (*it)->getGpuAddress());
|
||||
|
||||
context->freeMem(ptr);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
struct DeviceFixtureXeHpcTests : public DeviceFixture {
|
||||
void checkIfCallingGetMemoryPropertiesWithNonNullPtrThenMaxClockRateReturnZero(HardwareInfo *hwInfo);
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
struct CommandListStatePrefetchXeHpcCore : public ModuleFixture {
|
||||
void checkIfDebugFlagSetWhenPrefetchApiCalledAThenStatePrefetchProgrammed(HardwareInfo *hwInfo);
|
||||
void checkIfCommandBufferIsExhaustedWhenPrefetchApiCalledThenStatePrefetchProgrammed(HardwareInfo *hwInfo);
|
||||
};
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user