mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 08:07:19 +08:00
feature: add initial support for Xe2 platforms
Related-To: NEO-8188, NEO-10774 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0158decb2b
commit
778645c11e
@@ -38,4 +38,10 @@ if(TESTS_XEHP_AND_LATER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_XE2_AND_LATER)
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_cmdlist_xe2_and_later.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectories()
|
||||
|
||||
@@ -0,0 +1,387 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/source/cmdlist/cmdlist_hw.h"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_event.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToMemoryCopyRegionBlitThenTimeStampRegistersAreAdded_IsAtLeastSkl, IGFX_XE2_HPG_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToMemoryCopyThenAppendProfilingCalledOnceBeforeAndAfterCommand_IsAtLeastSkl, IGFX_XE2_HPG_CORE);
|
||||
|
||||
using Platforms = IsAtLeastXe2HpgCore;
|
||||
|
||||
struct CommandListXe2AndLaterFixture : public DeviceFixture {
|
||||
void setUp() {
|
||||
DeviceFixture::setUp();
|
||||
|
||||
constexpr ze_event_pool_desc_t eventPoolDesc = {ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, nullptr, ZE_EVENT_POOL_FLAG_HOST_VISIBLE, 4};
|
||||
auto hDevice = device->toHandle();
|
||||
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
eventPool.reset(static_cast<EventPool *>(EventPool::create(device->getDriverHandle(), context, 1, &hDevice, &eventPoolDesc, result)));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ze_event_handle_t hEvent = 0;
|
||||
ze_event_desc_t eventDesc = {};
|
||||
|
||||
eventDesc.index = 0;
|
||||
|
||||
result = eventPool->createEvent(&eventDesc, &hEvent);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
eventObj.reset(L0::Event::fromHandle(hEvent));
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
eventObj.reset(nullptr);
|
||||
eventPool.reset(nullptr);
|
||||
DeviceFixture::tearDown();
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
std::vector<GenCmdList::iterator> findAllSrmCommands(void *streamStart, size_t size) {
|
||||
genSrmCommands.clear();
|
||||
|
||||
EXPECT_TRUE(FamilyType::Parse::parseCommandBuffer(genSrmCommands, streamStart, size));
|
||||
|
||||
return findAll<typename FamilyType::MI_STORE_REGISTER_MEM *>(genSrmCommands.begin(), genSrmCommands.end());
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
std::vector<GenCmdList::iterator> findAllLrrCommands(void *streamStart, size_t size) {
|
||||
genLrrCommands.clear();
|
||||
|
||||
EXPECT_TRUE(FamilyType::Parse::parseCommandBuffer(genLrrCommands, streamStart, size));
|
||||
|
||||
return findAll<typename FamilyType::MI_LOAD_REGISTER_REG *>(genLrrCommands.begin(), genLrrCommands.end());
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
void validateSrmCommand(const typename FamilyType::MI_STORE_REGISTER_MEM *cmd, uint64_t expectedAddress, uint32_t expectedRegisterOffset) {
|
||||
EXPECT_EQ(expectedRegisterOffset, cmd->getRegisterAddress());
|
||||
EXPECT_EQ(expectedAddress, cmd->getMemoryAddress());
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
void validateLrrCommand(const typename FamilyType::MI_LOAD_REGISTER_REG *cmd, uint32_t expectedRegisterOffset) {
|
||||
EXPECT_EQ(expectedRegisterOffset, cmd->getSourceRegisterAddress());
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
void validateCommands(const std::vector<GenCmdList::iterator> &srmCommands, bool beforeWalker, bool useMask) {
|
||||
using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM;
|
||||
using MI_LOAD_REGISTER_REG = typename FamilyType::MI_LOAD_REGISTER_REG;
|
||||
|
||||
auto baseAddr = eventObj->getGpuAddress(device);
|
||||
auto contextOffset = beforeWalker ? eventObj->getContextStartOffset() : eventObj->getContextEndOffset();
|
||||
auto globalOffset = beforeWalker ? eventObj->getGlobalStartOffset() : eventObj->getGlobalEndOffset();
|
||||
|
||||
uint64_t globalAddress = ptrOffset(baseAddr, globalOffset);
|
||||
uint64_t contextAddress = ptrOffset(baseAddr, contextOffset);
|
||||
|
||||
if (useMask) {
|
||||
ASSERT_EQ(8u, srmCommands.size());
|
||||
|
||||
validateSrmCommand<FamilyType>(reinterpret_cast<MI_STORE_REGISTER_MEM *>(*srmCommands[0]), globalAddress, RegisterOffsets::csGprR12);
|
||||
validateSrmCommand<FamilyType>(reinterpret_cast<MI_STORE_REGISTER_MEM *>(*srmCommands[1]), contextAddress, RegisterOffsets::csGprR12);
|
||||
validateSrmCommand<FamilyType>(reinterpret_cast<MI_STORE_REGISTER_MEM *>(*srmCommands[2]), globalAddress + sizeof(uint32_t), RegisterOffsets::csGprR12);
|
||||
validateSrmCommand<FamilyType>(reinterpret_cast<MI_STORE_REGISTER_MEM *>(*srmCommands[3]), contextAddress + sizeof(uint32_t), RegisterOffsets::csGprR12);
|
||||
|
||||
validateLrrCommand<FamilyType>(reinterpret_cast<MI_LOAD_REGISTER_REG *>(*srmCommands[4]), RegisterOffsets::globalTimestampLdw);
|
||||
validateLrrCommand<FamilyType>(reinterpret_cast<MI_LOAD_REGISTER_REG *>(*srmCommands[5]), RegisterOffsets::gpThreadTimeRegAddressOffsetLow);
|
||||
validateLrrCommand<FamilyType>(reinterpret_cast<MI_LOAD_REGISTER_REG *>(*srmCommands[6]), RegisterOffsets::globalTimestampUn);
|
||||
validateLrrCommand<FamilyType>(reinterpret_cast<MI_LOAD_REGISTER_REG *>(*srmCommands[7]), RegisterOffsets::gpThreadTimeRegAddressOffsetHigh);
|
||||
|
||||
} else {
|
||||
ASSERT_EQ(4u, srmCommands.size());
|
||||
|
||||
validateSrmCommand<FamilyType>(reinterpret_cast<MI_STORE_REGISTER_MEM *>(*srmCommands[0]), globalAddress, RegisterOffsets::globalTimestampLdw);
|
||||
validateSrmCommand<FamilyType>(reinterpret_cast<MI_STORE_REGISTER_MEM *>(*srmCommands[1]), contextAddress, RegisterOffsets::gpThreadTimeRegAddressOffsetLow);
|
||||
validateSrmCommand<FamilyType>(reinterpret_cast<MI_STORE_REGISTER_MEM *>(*srmCommands[2]), globalAddress + sizeof(uint32_t), RegisterOffsets::globalTimestampUn);
|
||||
validateSrmCommand<FamilyType>(reinterpret_cast<MI_STORE_REGISTER_MEM *>(*srmCommands[3]), contextAddress + sizeof(uint32_t), RegisterOffsets::gpThreadTimeRegAddressOffsetHigh);
|
||||
}
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
std::unique_ptr<EventPool> eventPool;
|
||||
std::unique_ptr<L0::Event> eventObj;
|
||||
GenCmdList genSrmCommands;
|
||||
GenCmdList genLrrCommands;
|
||||
};
|
||||
|
||||
using CommandListXe2AndLaterTests = Test<CommandListXe2AndLaterFixture>;
|
||||
|
||||
HWTEST2_F(CommandListXe2AndLaterTests, given64bEventWhenTimestampIsWrittenThenAddExtraMmioReads, Platforms) {
|
||||
auto commandList = std::make_unique<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
|
||||
NEO::LinearStream *commandStream = commandList->getCmdContainer().getCommandStream();
|
||||
|
||||
commandList->appendWriteKernelTimestamp(eventObj.get(), nullptr, false, false, false, false);
|
||||
|
||||
size_t streamOffset = commandStream->getUsed();
|
||||
|
||||
{
|
||||
auto srmCommands = findAllSrmCommands<FamilyType>(commandStream->getCpuBase(), commandStream->getUsed());
|
||||
|
||||
validateCommands<FamilyType>(srmCommands, false, false);
|
||||
}
|
||||
|
||||
commandList->appendWriteKernelTimestamp(eventObj.get(), nullptr, true, false, false, false);
|
||||
|
||||
{
|
||||
auto srmCommands = findAllSrmCommands<FamilyType>(ptrOffset(commandStream->getCpuBase(), streamOffset),
|
||||
(commandStream->getUsed() - streamOffset));
|
||||
validateCommands<FamilyType>(srmCommands, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListXe2AndLaterTests, given64bEventWithLsbMaskingWhenTimestampIsWrittenThenAddExtraMmioReads, Platforms) {
|
||||
auto commandList = std::make_unique<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
|
||||
NEO::LinearStream *commandStream = commandList->getCmdContainer().getCommandStream();
|
||||
|
||||
commandList->appendWriteKernelTimestamp(eventObj.get(), nullptr, false, true, false, false);
|
||||
|
||||
size_t streamOffset = commandStream->getUsed();
|
||||
|
||||
{
|
||||
auto commands = findAllSrmCommands<FamilyType>(commandStream->getCpuBase(), commandStream->getUsed());
|
||||
auto lrrCommands = findAllLrrCommands<FamilyType>(commandStream->getCpuBase(), commandStream->getUsed());
|
||||
commands.insert(commands.end(), lrrCommands.begin(), lrrCommands.end());
|
||||
|
||||
validateCommands<FamilyType>(commands, false, true);
|
||||
}
|
||||
|
||||
commandList->appendWriteKernelTimestamp(eventObj.get(), nullptr, true, true, false, false);
|
||||
|
||||
{
|
||||
auto commands = findAllSrmCommands<FamilyType>(ptrOffset(commandStream->getCpuBase(), streamOffset),
|
||||
(commandStream->getUsed() - streamOffset));
|
||||
auto lrrCommands = findAllLrrCommands<FamilyType>(ptrOffset(commandStream->getCpuBase(), streamOffset),
|
||||
(commandStream->getUsed() - streamOffset));
|
||||
commands.insert(commands.end(), lrrCommands.begin(), lrrCommands.end());
|
||||
|
||||
validateCommands<FamilyType>(commands, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
using CommandListAppendRangesBarrierXe2AndLater = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(CommandListAppendRangesBarrierXe2AndLater, givenCallToAppendRangesBarrierThenPipeControlProgrammed, Platforms) {
|
||||
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::copy, 0u);
|
||||
uint64_t gpuAddress = 0x1200;
|
||||
void *buffer = reinterpret_cast<void *>(gpuAddress);
|
||||
size_t size = 0x1100;
|
||||
|
||||
NEO::MockGraphicsAllocation mockAllocation(buffer, gpuAddress, size);
|
||||
NEO::SvmAllocationData allocData(0);
|
||||
allocData.size = size;
|
||||
allocData.gpuAllocations.addAllocation(&mockAllocation);
|
||||
device->getDriverHandle()->getSvmAllocsManager()->insertSVMAlloc(allocData);
|
||||
const void *ranges[] = {buffer};
|
||||
const size_t sizes[] = {size};
|
||||
commandList->applyMemoryRangesBarrier(1, sizes, ranges);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed()));
|
||||
auto itor = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
auto pipeControlCmd = reinterpret_cast<PIPE_CONTROL *>(*itor);
|
||||
EXPECT_TRUE(pipeControlCmd->getDataportFlush());
|
||||
EXPECT_TRUE(pipeControlCmd->getUnTypedDataPortCacheFlush());
|
||||
auto expectedDcFlushEnable = NEO::MemorySynchronizationCommands<GfxFamily>::getDcFlushEnable(true, device->getNEODevice()->getRootDeviceEnvironment());
|
||||
EXPECT_EQ(expectedDcFlushEnable, pipeControlCmd->getDcFlushEnable());
|
||||
}
|
||||
|
||||
using CommandListXe2AndLaterPreemptionTest = Test<ModuleMutableCommandListFixture>;
|
||||
HWTEST2_F(CommandListXe2AndLaterPreemptionTest, givenAppendLaunchKernelWhenKernelFlagRequiresDisablePreemptionThenExpectInterfaceDescriptorDataDisablePreemption, Platforms) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
auto &container = commandList->getCmdContainer();
|
||||
auto &cmdListStream = *container.getCommandStream();
|
||||
|
||||
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.requiresDisabledMidThreadPreemption = true;
|
||||
|
||||
ze_group_count_t groupCount{1, 1, 1};
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
size_t sizeBefore = cmdListStream.getUsed();
|
||||
auto result = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams, false);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
size_t sizeAfter = cmdListStream.getUsed();
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
|
||||
cmdList,
|
||||
ptrOffset(cmdListStream.getCpuBase(), sizeBefore),
|
||||
sizeAfter - sizeBefore));
|
||||
|
||||
auto walkerCmds = findAll<DefaultWalkerType *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_EQ(1u, walkerCmds.size());
|
||||
|
||||
auto walkerCmd = reinterpret_cast<DefaultWalkerType *>(*walkerCmds[0]);
|
||||
auto &idd = walkerCmd->getInterfaceDescriptor();
|
||||
EXPECT_FALSE(idd.getThreadPreemption());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListXe2AndLaterPreemptionTest,
|
||||
givenAppendLaunchKernelWhenKernelRequiresDisablePreemptionForRayTracingAndKernelIsUsingRayTracingCallsThenExpectInterfaceDescriptorDataDisablePreemption,
|
||||
Platforms) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
auto &container = commandList->getCmdContainer();
|
||||
auto &cmdListStream = *container.getCommandStream();
|
||||
|
||||
NEO::MockGraphicsAllocation rtMockAllocation;
|
||||
neoDevice->rtMemoryBackedBuffer = &rtMockAllocation;
|
||||
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.hasRTCalls = true;
|
||||
kernel->midThreadPreemptionDisallowedForRayTracingKernels = true;
|
||||
|
||||
ze_group_count_t groupCount{1, 1, 1};
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
size_t sizeBefore = cmdListStream.getUsed();
|
||||
auto result = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams, false);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
size_t sizeAfter = cmdListStream.getUsed();
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
|
||||
cmdList,
|
||||
ptrOffset(cmdListStream.getCpuBase(), sizeBefore),
|
||||
sizeAfter - sizeBefore));
|
||||
|
||||
auto walkerCmds = findAll<DefaultWalkerType *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_EQ(1u, walkerCmds.size());
|
||||
|
||||
auto walkerCmd = reinterpret_cast<DefaultWalkerType *>(*walkerCmds[0]);
|
||||
auto &idd = walkerCmd->getInterfaceDescriptor();
|
||||
EXPECT_FALSE(idd.getThreadPreemption());
|
||||
|
||||
neoDevice->rtMemoryBackedBuffer = nullptr;
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListXe2AndLaterPreemptionTest,
|
||||
givenAppendLaunchKernelWhenKernelRequiresDisablePreemptionForRayTracingAndKernelIsNotUsingRayTracingCallsThenExpectInterfaceDescriptorDataEnablePreemption,
|
||||
Platforms) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
auto &container = commandList->getCmdContainer();
|
||||
auto &cmdListStream = *container.getCommandStream();
|
||||
|
||||
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.hasRTCalls = false;
|
||||
kernel->midThreadPreemptionDisallowedForRayTracingKernels = true;
|
||||
|
||||
ze_group_count_t groupCount{1, 1, 1};
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
size_t sizeBefore = cmdListStream.getUsed();
|
||||
auto result = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams, false);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
size_t sizeAfter = cmdListStream.getUsed();
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
|
||||
cmdList,
|
||||
ptrOffset(cmdListStream.getCpuBase(), sizeBefore),
|
||||
sizeAfter - sizeBefore));
|
||||
|
||||
auto walkerCmds = findAll<DefaultWalkerType *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_EQ(1u, walkerCmds.size());
|
||||
|
||||
auto walkerCmd = reinterpret_cast<DefaultWalkerType *>(*walkerCmds[0]);
|
||||
auto &idd = walkerCmd->getInterfaceDescriptor();
|
||||
EXPECT_TRUE(idd.getThreadPreemption());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListXe2AndLaterPreemptionTest,
|
||||
givenAppendLaunchKernelWhenKernelDoNotRequireDisablePreemptionForRayTracingAndKernelIsUsingRayTracingCallsThenExpectInterfaceDescriptorDataEnablePreemption,
|
||||
Platforms) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
auto &container = commandList->getCmdContainer();
|
||||
auto &cmdListStream = *container.getCommandStream();
|
||||
|
||||
NEO::MockGraphicsAllocation rtMockAllocation;
|
||||
neoDevice->rtMemoryBackedBuffer = &rtMockAllocation;
|
||||
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.hasRTCalls = true;
|
||||
kernel->midThreadPreemptionDisallowedForRayTracingKernels = false;
|
||||
|
||||
ze_group_count_t groupCount{1, 1, 1};
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
size_t sizeBefore = cmdListStream.getUsed();
|
||||
auto result = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams, false);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
size_t sizeAfter = cmdListStream.getUsed();
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
|
||||
cmdList,
|
||||
ptrOffset(cmdListStream.getCpuBase(), sizeBefore),
|
||||
sizeAfter - sizeBefore));
|
||||
|
||||
auto walkerCmds = findAll<DefaultWalkerType *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_EQ(1u, walkerCmds.size());
|
||||
|
||||
auto walkerCmd = reinterpret_cast<DefaultWalkerType *>(*walkerCmds[0]);
|
||||
auto &idd = walkerCmd->getInterfaceDescriptor();
|
||||
EXPECT_TRUE(idd.getThreadPreemption());
|
||||
|
||||
neoDevice->rtMemoryBackedBuffer = nullptr;
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListXe2AndLaterPreemptionTest,
|
||||
givenObtainKernelPreemptionModeWhenInDeviceFrocePreemptionModeDifferentThanMidThreadThenThreadGroupPreemptionModeIsReturned,
|
||||
Platforms) {
|
||||
|
||||
neoDevice->preemptionMode = NEO::PreemptionMode::Disabled;
|
||||
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.requiresDisabledMidThreadPreemption = false;
|
||||
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.hasRTCalls = false;
|
||||
kernel->midThreadPreemptionDisallowedForRayTracingKernels = false;
|
||||
|
||||
auto commandListCore = std::make_unique<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandListCore->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
|
||||
auto result = commandListCore->obtainKernelPreemptionMode(kernel.get());
|
||||
EXPECT_EQ(NEO::PreemptionMode::ThreadGroup, result);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListXe2AndLaterPreemptionTest,
|
||||
givenObtainKernelPreemptionModeWhenInDeviceFrocePreemptionModeMidThreadAndOtherKernelFlagsNotSetThenMidThreadPreemptionModeIsReturned,
|
||||
Platforms) {
|
||||
|
||||
neoDevice->preemptionMode = NEO::PreemptionMode::MidThread;
|
||||
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.requiresDisabledMidThreadPreemption = false;
|
||||
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.hasRTCalls = false;
|
||||
kernel->midThreadPreemptionDisallowedForRayTracingKernels = false;
|
||||
|
||||
auto commandListCore = std::make_unique<WhiteBox<L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandListCore->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
|
||||
auto result = commandListCore->obtainKernelPreemptionMode(kernel.get());
|
||||
EXPECT_EQ(NEO::PreemptionMode::MidThread, result);
|
||||
}
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
16
level_zero/core/test/unit_tests/xe2_hpg_core/CMakeLists.txt
Normal file
16
level_zero/core/test/unit_tests/xe2_hpg_core/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_XE2_HPG_CORE)
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_cmdlist_xe2_hpg_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_cmdqueue_xe2_hpg_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_xe2_hpg_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_l0_gfx_core_helper_xe2_hpg_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_module_xe2_hpg_core.cpp
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,460 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/product_helper.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/source/event/event.h"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.inl"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_module.h"
|
||||
#include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
struct LocalMemoryModuleFixture : public ModuleFixture {
|
||||
void setUp() {
|
||||
debugManager.flags.EnableLocalMemory.set(1);
|
||||
ModuleFixture::setUp();
|
||||
}
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
using CommandListAppendLaunchKernelXe2HpgCore = Test<LocalMemoryModuleFixture>;
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelXe2HpgCore, givenAppendKernelWhenKernelNotUsingSystemMemoryAllocationsAndEventNotHostSignalScopeThenExpectsNoSystemFenceUsed, IsXe2HpgCore) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
|
||||
constexpr size_t size = 4096u;
|
||||
constexpr size_t alignment = 4096u;
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
result = context->allocDeviceMem(device->toHandle(),
|
||||
&deviceDesc,
|
||||
size, alignment, &ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto mockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = mockModule.get();
|
||||
|
||||
auto allocData = driverHandle->getSvmAllocsManager()->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, allocData);
|
||||
auto kernelAllocation = allocData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
ASSERT_NE(nullptr, kernelAllocation);
|
||||
kernel.residencyContainer.push_back(kernelAllocation);
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE;
|
||||
eventDesc.wait = 0;
|
||||
auto event = std::unique_ptr<L0::Event>(L0::Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device));
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
result = commandList->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = commandList->appendLaunchKernelWithParams(&kernel, groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
GenCmdList commands;
|
||||
ASSERT_TRUE(CmdParse<FamilyType>::parseCommandBuffer(
|
||||
commands,
|
||||
commandList->getCmdContainer().getCommandStream()->getCpuBase(),
|
||||
commandList->getCmdContainer().getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<DefaultWalkerType *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto walkerCmd = genCmdCast<DefaultWalkerType *>(*itor);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_FALSE(postSyncData.getSystemMemoryFenceRequest());
|
||||
|
||||
result = context->freeMem(ptr);
|
||||
ASSERT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelXe2HpgCore,
|
||||
givenAppendKernelWhenKernelUsingUsmHostMemoryAllocationsAndEventNotHostSignalScopeThenExpectsNoSystemFenceUsed, IsXe2HpgCore) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
|
||||
constexpr size_t size = 4096u;
|
||||
constexpr size_t alignment = 4096u;
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
||||
result = context->allocHostMem(&hostDesc, size, alignment, &ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto mockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = mockModule.get();
|
||||
|
||||
auto allocData = driverHandle->getSvmAllocsManager()->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, allocData);
|
||||
auto kernelAllocation = allocData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
ASSERT_NE(nullptr, kernelAllocation);
|
||||
kernel.residencyContainer.push_back(kernelAllocation);
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE;
|
||||
eventDesc.wait = 0;
|
||||
auto event = std::unique_ptr<L0::Event>(L0::Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device));
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
result = commandList->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = commandList->appendLaunchKernelWithParams(&kernel, groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
GenCmdList commands;
|
||||
ASSERT_TRUE(CmdParse<FamilyType>::parseCommandBuffer(
|
||||
commands,
|
||||
commandList->getCmdContainer().getCommandStream()->getCpuBase(),
|
||||
commandList->getCmdContainer().getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<DefaultWalkerType *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto walkerCmd = genCmdCast<DefaultWalkerType *>(*itor);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_FALSE(postSyncData.getSystemMemoryFenceRequest());
|
||||
|
||||
result = context->freeMem(ptr);
|
||||
ASSERT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelXe2HpgCore,
|
||||
givenAppendKernelWhenMigrationOnComputeUsingUsmSharedCpuMemoryAllocationsAndEventNotHostSignalScopeThenExpectsNoSystemFenceUsed, IsXe2HpgCore) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
|
||||
constexpr size_t size = 4096u;
|
||||
constexpr size_t alignment = 4096u;
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
result = context->allocSharedMem(device->toHandle(), &deviceDesc, &hostDesc, size, alignment, &ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
auto allocData = driverHandle->getSvmAllocsManager()->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, allocData);
|
||||
auto dstAllocation = allocData->cpuAllocation;
|
||||
ASSERT_NE(nullptr, dstAllocation);
|
||||
auto srcAllocation = allocData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
ASSERT_NE(nullptr, srcAllocation);
|
||||
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
result = commandList->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
result = commandList->appendPageFaultCopy(dstAllocation, srcAllocation, size, false);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
|
||||
EXPECT_FALSE(commandList->usedKernelLaunchParams.isKernelSplitOperation);
|
||||
EXPECT_TRUE(commandList->usedKernelLaunchParams.isDestinationAllocationInSystemMemory);
|
||||
|
||||
GenCmdList commands;
|
||||
ASSERT_TRUE(CmdParse<FamilyType>::parseCommandBuffer(
|
||||
commands,
|
||||
commandList->getCmdContainer().getCommandStream()->getCpuBase(),
|
||||
commandList->getCmdContainer().getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<DefaultWalkerType *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto walkerCmd = genCmdCast<DefaultWalkerType *>(*itor);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_FALSE(postSyncData.getSystemMemoryFenceRequest());
|
||||
|
||||
result = context->freeMem(ptr);
|
||||
ASSERT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelXe2HpgCore,
|
||||
givenAppendKernelWhenKernelUsingIndirectSystemMemoryAllocationsAndEventNotHostSignalScopeThenExpectsNoSystemFenceUsed, IsXe2HpgCore) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
|
||||
constexpr size_t size = 4096u;
|
||||
constexpr size_t alignment = 4096u;
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
result = context->allocDeviceMem(device->toHandle(),
|
||||
&deviceDesc,
|
||||
size, alignment, &ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto mockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = mockModule.get();
|
||||
|
||||
auto allocData = driverHandle->getSvmAllocsManager()->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, allocData);
|
||||
auto kernelAllocation = allocData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
ASSERT_NE(nullptr, kernelAllocation);
|
||||
kernel.residencyContainer.push_back(kernelAllocation);
|
||||
|
||||
kernel.unifiedMemoryControls.indirectHostAllocationsAllowed = true;
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE;
|
||||
eventDesc.wait = 0;
|
||||
auto event = std::unique_ptr<L0::Event>(L0::Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device));
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
result = commandList->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = commandList->appendLaunchKernelWithParams(&kernel, groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
GenCmdList commands;
|
||||
ASSERT_TRUE(CmdParse<FamilyType>::parseCommandBuffer(
|
||||
commands,
|
||||
commandList->getCmdContainer().getCommandStream()->getCpuBase(),
|
||||
commandList->getCmdContainer().getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<DefaultWalkerType *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto walkerCmd = genCmdCast<DefaultWalkerType *>(*itor);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_FALSE(postSyncData.getSystemMemoryFenceRequest());
|
||||
|
||||
result = context->freeMem(ptr);
|
||||
ASSERT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelXe2HpgCore,
|
||||
givenAppendKernelWhenKernelUsingDeviceMemoryAllocationsAndEventHostSignalScopeThenExpectsNoSystemFenceUsed, IsXe2HpgCore) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
|
||||
constexpr size_t size = 4096u;
|
||||
constexpr size_t alignment = 4096u;
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
result = context->allocDeviceMem(device->toHandle(),
|
||||
&deviceDesc,
|
||||
size, alignment, &ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto mockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = mockModule.get();
|
||||
|
||||
auto allocData = driverHandle->getSvmAllocsManager()->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, allocData);
|
||||
auto kernelAllocation = allocData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
ASSERT_NE(nullptr, kernelAllocation);
|
||||
kernel.residencyContainer.push_back(kernelAllocation);
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
eventDesc.wait = 0;
|
||||
auto event = std::unique_ptr<L0::Event>(L0::Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device));
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
result = commandList->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = commandList->appendLaunchKernelWithParams(&kernel, groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
GenCmdList commands;
|
||||
ASSERT_TRUE(CmdParse<FamilyType>::parseCommandBuffer(
|
||||
commands,
|
||||
commandList->getCmdContainer().getCommandStream()->getCpuBase(),
|
||||
commandList->getCmdContainer().getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<DefaultWalkerType *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto walkerCmd = genCmdCast<DefaultWalkerType *>(*itor);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_FALSE(postSyncData.getSystemMemoryFenceRequest());
|
||||
|
||||
result = context->freeMem(ptr);
|
||||
ASSERT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelXe2HpgCore,
|
||||
givenAppendKernelWhenKernelUsingUsmHostMemoryAllocationsAndEventHostSignalScopeThenExpectsSystemFenceUsed, IsXe2HpgCore) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
|
||||
constexpr size_t size = 4096u;
|
||||
constexpr size_t alignment = 4096u;
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
||||
result = context->allocHostMem(&hostDesc, size, alignment, &ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto mockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = mockModule.get();
|
||||
|
||||
auto allocData = driverHandle->getSvmAllocsManager()->getSVMAlloc(ptr);
|
||||
ASSERT_NE(nullptr, allocData);
|
||||
auto kernelAllocation = allocData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
ASSERT_NE(nullptr, kernelAllocation);
|
||||
kernel.residencyContainer.push_back(kernelAllocation);
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
eventDesc.wait = 0;
|
||||
auto event = std::unique_ptr<L0::Event>(L0::Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device));
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
result = commandList->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = commandList->appendLaunchKernelWithParams(&kernel, groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
GenCmdList commands;
|
||||
ASSERT_TRUE(CmdParse<FamilyType>::parseCommandBuffer(
|
||||
commands,
|
||||
commandList->getCmdContainer().getCommandStream()->getCpuBase(),
|
||||
commandList->getCmdContainer().getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<DefaultWalkerType *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto walkerCmd = genCmdCast<DefaultWalkerType *>(*itor);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_TRUE(postSyncData.getSystemMemoryFenceRequest());
|
||||
|
||||
result = context->freeMem(ptr);
|
||||
ASSERT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
using CommandListAppendLaunchKernelXe2HpgCoreDebugger = Test<L0DebuggerHwFixture>;
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelXe2HpgCoreDebugger, givenDebuggingEnabledWhenKernelAppendedThenIDDDoesNotHaveMidThreadPreemptionEnabled, IsXe2HpgCore) {
|
||||
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
||||
|
||||
ze_command_queue_desc_t queueDesc = {};
|
||||
auto queue = std::make_unique<Mock<CommandQueue>>(device, device->getNEODevice()->getDefaultEngine().commandStreamReceiver, &queueDesc);
|
||||
|
||||
ze_group_count_t groupCount{128, 1, 1};
|
||||
auto immediateCmdList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
immediateCmdList->cmdListType = ::L0::CommandList::CommandListType::typeImmediate;
|
||||
immediateCmdList->isFlushTaskSubmissionEnabled = false;
|
||||
immediateCmdList->cmdQImmediate = queue.get();
|
||||
auto result = immediateCmdList->initialize(device, NEO::EngineGroupType::compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto cmdStream = immediateCmdList->getCmdContainer().getCommandStream();
|
||||
|
||||
auto sizeBefore = cmdStream->getUsed();
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto mockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = mockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
|
||||
result = immediateCmdList->appendLaunchKernelWithParams(&kernel, groupCount, nullptr, launchParams);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
auto sizeAfter = cmdStream->getUsed();
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
|
||||
cmdList,
|
||||
ptrOffset(cmdStream->getCpuBase(), sizeBefore),
|
||||
sizeAfter - sizeBefore));
|
||||
|
||||
auto itorWalker = find<DefaultWalkerType *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), itorWalker);
|
||||
auto cmdWalker = genCmdCast<DefaultWalkerType *>(*itorWalker);
|
||||
|
||||
EXPECT_EQ(0u, cmdWalker->getInterfaceDescriptor().getThreadPreemption());
|
||||
}
|
||||
|
||||
using CmdListThreadArbitrationTestXe2HpgCore = Test<CmdListThreadArbitrationFixture>;
|
||||
|
||||
using ThreadArbitrationSupport = IsAnyProducts<IGFX_BMG, IGFX_LUNARLAKE>;
|
||||
HWTEST2_F(CmdListThreadArbitrationTestXe2HpgCore,
|
||||
givenAppendThreadArbitrationKernelToCommandListWhenExecutingCommandListThenStateComputeModeStateIsTrackedCorrectly, ThreadArbitrationSupport) {
|
||||
testBody<FamilyType>();
|
||||
}
|
||||
|
||||
using CmdListLargeGrfTestXe2Hpg = Test<CmdListLargeGrfFixture>;
|
||||
|
||||
using LargeGrfSupport = IsAnyProducts<IGFX_BMG, IGFX_LUNARLAKE>;
|
||||
HWTEST2_F(CmdListLargeGrfTestXe2Hpg,
|
||||
givenAppendLargeGrfKernelToCommandListWhenExecutingCommandListThenStateComputeModeStateIsTrackedCorrectly, LargeGrfSupport) {
|
||||
testBody<FamilyType>();
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/mocks/mock_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/source/cmdlist/cmdlist.h"
|
||||
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using CommandQueueCommandsXe2HpgCore = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(CommandQueueCommandsXe2HpgCore, givenCommandQueueWhenExecutingCommandListsThenStateSystemMemFenceAddressCmdIsGenerated, IsAtLeastXe2HpgCore) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
ze_command_queue_desc_t desc = {};
|
||||
auto csr = neoDevice->getDefaultEngine().commandStreamReceiver;
|
||||
|
||||
auto commandQueue = new MockCommandQueueHw<gfxCoreFamily>(device, csr, &desc);
|
||||
commandQueue->initialize(false, false, false);
|
||||
|
||||
ze_result_t returnValue;
|
||||
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::compute, 0u, returnValue, false));
|
||||
auto commandListHandle = commandList->toHandle();
|
||||
commandList->close();
|
||||
|
||||
commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false, nullptr);
|
||||
|
||||
auto globalFence = csr->getGlobalFenceAllocation();
|
||||
|
||||
auto used = commandQueue->commandStream.getUsed();
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
|
||||
cmdList, commandQueue->commandStream.getCpuBase(), used));
|
||||
|
||||
auto itor = find<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), itor);
|
||||
|
||||
auto systemMemFenceAddressCmd = genCmdCast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(*itor);
|
||||
EXPECT_EQ(globalFence->getGpuAddress(), systemMemFenceAddressCmd->getSystemMemoryFenceAddress());
|
||||
|
||||
commandQueue->destroy();
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandQueueCommandsXe2HpgCore, givenCommandQueueWhenExecutingCommandListsForTheSecondTimeThenStateSystemMemFenceAddressCmdIsNotGenerated, IsAtLeastXe2HpgCore) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
ze_command_queue_desc_t desc = {};
|
||||
auto csr = neoDevice->getDefaultEngine().commandStreamReceiver;
|
||||
|
||||
auto commandQueue = new MockCommandQueueHw<gfxCoreFamily>(device, csr, &desc);
|
||||
commandQueue->initialize(false, false, false);
|
||||
|
||||
ze_result_t returnValue;
|
||||
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::compute, 0u, returnValue, false));
|
||||
auto commandListHandle = commandList->toHandle();
|
||||
commandList->close();
|
||||
|
||||
commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false, nullptr);
|
||||
auto usedSpaceAfter1stExecute = commandQueue->commandStream.getUsed();
|
||||
commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false, nullptr);
|
||||
auto usedSpaceOn2ndExecute = commandQueue->commandStream.getUsed() - usedSpaceAfter1stExecute;
|
||||
|
||||
GenCmdList cmdList;
|
||||
auto cmdBufferAddress = ptrOffset(commandQueue->commandStream.getCpuBase(), usedSpaceAfter1stExecute);
|
||||
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList, cmdBufferAddress, usedSpaceOn2ndExecute));
|
||||
|
||||
auto itor = find<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(cmdList.end(), itor);
|
||||
|
||||
commandQueue->destroy();
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_device.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using DeviceXe2HpgCoreTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(DeviceXe2HpgCoreTest, whenCallingGetMemoryPropertiesWithNonNullPtrThenPropertiesAreReturned, IsXe2HpgCore) {
|
||||
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);
|
||||
EXPECT_EQ(memProperties.maxBusWidth, this->neoDevice->getDeviceInfo().addressBits);
|
||||
EXPECT_EQ(memProperties.totalSize, this->neoDevice->getDeviceInfo().globalMemSize);
|
||||
}
|
||||
|
||||
HWTEST2_F(DeviceXe2HpgCoreTest, GivenTargetXeHpgCoreWhenGettingDpSupportThenReturnsTrue, IsXe2HpgCore) {
|
||||
ze_device_module_properties_t deviceModProps = {ZE_STRUCTURE_TYPE_DEVICE_MODULE_PROPERTIES};
|
||||
ze_intel_device_module_dp_exp_properties_t moduleDpProps = {ZE_STRUCTURE_INTEL_DEVICE_MODULE_DP_EXP_PROPERTIES};
|
||||
moduleDpProps.flags = 0u;
|
||||
deviceModProps.pNext = &moduleDpProps;
|
||||
|
||||
ze_result_t res = device->getKernelProperties(&deviceModProps);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
|
||||
bool dp4a = moduleDpProps.flags & ZE_INTEL_DEVICE_MODULE_EXP_FLAG_DP4A;
|
||||
bool dpas = moduleDpProps.flags & ZE_INTEL_DEVICE_MODULE_EXP_FLAG_DPAS;
|
||||
EXPECT_TRUE(dp4a);
|
||||
EXPECT_TRUE(dpas);
|
||||
}
|
||||
|
||||
using CommandQueueGroupTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(CommandQueueGroupTest, givenNoBlitterSupportAndNoCCSThenOneQueueGroupIsReturned, IsXe2HpgCore) {
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrCCSNode = false;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = false;
|
||||
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
|
||||
MockDeviceImp deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
|
||||
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_GE(count, 1u);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandQueueGroupTest, givenNoBlitterSupportAndCCSThenTwoQueueGroupsAreReturned, IsXe2HpgCore) {
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrCCSNode = true;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = false;
|
||||
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
|
||||
MockDeviceImp deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
|
||||
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_GE(count, 2u);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandQueueGroupTest, givenBlitterSupportAndCCSThenFourQueueGroupsAreReturned, IsXe2HpgCore) {
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrCCSNode = true;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
hwInfo.featureTable.ftrBcsInfo.set();
|
||||
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
|
||||
MockDeviceImp deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
|
||||
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_GE(count, 4u);
|
||||
|
||||
std::vector<ze_command_queue_group_properties_t> properties(count);
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
auto &engineGroups = neoMockDevice->getRegularEngineGroups();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::renderCompute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::compute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
uint32_t numerOfCCSEnabled = hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
|
||||
EXPECT_EQ(properties[i].numQueues, numerOfCCSEnabled);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::copy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint8_t));
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::linkedCopy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].numQueues, hwInfo.featureTable.ftrBcsInfo.count() - 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint8_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandQueueGroupTest, givenBlitterSupportCCSAndLinkedBcsDisabledThenThreeQueueGroupsAreReturned, IsXe2HpgCore) {
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrCCSNode = true;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
hwInfo.featureTable.ftrBcsInfo.set(0);
|
||||
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
|
||||
MockDeviceImp deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
|
||||
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_GE(count, 3u);
|
||||
|
||||
std::vector<ze_command_queue_group_properties_t> properties(count);
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
auto &engineGroups = neoMockDevice->getRegularEngineGroups();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::renderCompute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::compute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
uint32_t numerOfCCSEnabled = hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
|
||||
EXPECT_EQ(properties[i].numQueues, numerOfCCSEnabled);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::copy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint8_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandQueueGroupTest, givenBlitterDisabledAndAllBcsSetThenTwoQueueGroupsAreReturned, IsXe2HpgCore) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
debugManager.flags.EnableBlitterOperationsSupport.set(0);
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrCCSNode = true;
|
||||
hwInfo.featureTable.ftrBcsInfo.set();
|
||||
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
|
||||
MockDeviceImp deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
|
||||
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_EQ(count, 2u);
|
||||
}
|
||||
|
||||
class DeviceCopyQueueGroupXe2HpgCoreFixture : public DeviceFixture {
|
||||
public:
|
||||
void setUp() {
|
||||
debugManager.flags.EnableBlitterOperationsSupport.set(0);
|
||||
DeviceFixture::setUp();
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
DeviceFixture::tearDown();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
using DeviceCopyQueueGroupXe2HpgCoreTest = Test<DeviceCopyQueueGroupXe2HpgCoreFixture>;
|
||||
|
||||
HWTEST2_F(DeviceCopyQueueGroupXe2HpgCoreTest,
|
||||
givenBlitterSupportAndEnableBlitterOperationsSupportSetToZeroThenNoCopyEngineIsReturned, IsXe2HpgCore) {
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrCCSNode = false;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
hwInfo.featureTable.ftrBcsInfo.set(0);
|
||||
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo,
|
||||
rootDeviceIndex);
|
||||
MockDeviceImp deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
|
||||
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
std::vector<ze_command_queue_group_properties_t> properties(count);
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
for (auto &engineGroup : neoMockDevice->getRegularEngineGroups()) {
|
||||
EXPECT_NE(NEO::EngineGroupType::copy, engineGroup.engineGroupType);
|
||||
}
|
||||
}
|
||||
|
||||
class CommandQueueGroupTestXe2HpgCore : public DeviceFixture, public testing::TestWithParam<uint32_t> {
|
||||
public:
|
||||
void SetUp() override {
|
||||
DeviceFixture::setUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
DeviceFixture::tearDown();
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST2_P(CommandQueueGroupTestXe2HpgCore, givenVaryingBlitterSupportAndCCSThenBCSGroupContainsCorrectNumberOfEngines, IsXe2HpgCore) {
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrCCSNode = true;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(2);
|
||||
hwInfo.featureTable.ftrBcsInfo.set(GetParam());
|
||||
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, rootDeviceIndex);
|
||||
MockDeviceImp deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
|
||||
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_GE(count, 3u);
|
||||
|
||||
std::vector<ze_command_queue_group_properties_t> properties(count);
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
auto &engineGroups = neoMockDevice->getRegularEngineGroups();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::renderCompute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::compute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
uint32_t numerOfCCSEnabled = hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
|
||||
EXPECT_EQ(properties[i].numQueues, numerOfCCSEnabled);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::copy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint8_t));
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::linkedCopy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].numQueues, hwInfo.featureTable.ftrBcsInfo.count() - 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, sizeof(uint8_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
CommandQueueGroupTestXe2HpgCoreValues,
|
||||
CommandQueueGroupTestXe2HpgCore,
|
||||
testing::Values(0, 1, 2, 3));
|
||||
|
||||
HWTEST2_F(DeviceXe2HpgCoreTest, givenReturnedDevicePropertiesThenExpectedPageFaultSupportReturned, IsXe2HpgCore) {
|
||||
ze_device_properties_t deviceProps = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
|
||||
device->getProperties(&deviceProps);
|
||||
EXPECT_NE(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING);
|
||||
}
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/xe2_hpg_core/hw_cmds.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using L0GfxCoreHelperTestXe2Hpg = Test<DeviceFixture>;
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenAskingForImageCompressionSupportThenReturnFalse, IGFX_XE2_HPG_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenAskingForUsmCompressionSupportThenReturnFalse, IGFX_XE2_HPG_CORE);
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, givenL0GfxCoreHelperWhenGetRegsetTypeForLargeGrfDetectionIsCalledThenSrRegsetTypeIsRetuned) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_EQ(ZET_DEBUG_REGSET_TYPE_SR_INTEL_GPU, l0GfxCoreHelper.getRegsetTypeForLargeGrfDetection());
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, givenL0GfxCoreHelperWhenAskingForImageCompressionSupportThenReturnCorrectValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
|
||||
HardwareInfo hwInfo = *NEO::defaultHwInfo;
|
||||
|
||||
hwInfo.capabilityTable.ftrRenderCompressedImages = true;
|
||||
EXPECT_TRUE(l0GfxCoreHelper.imageCompressionSupported(hwInfo));
|
||||
|
||||
hwInfo.capabilityTable.ftrRenderCompressedImages = false;
|
||||
EXPECT_FALSE(l0GfxCoreHelper.imageCompressionSupported(hwInfo));
|
||||
|
||||
NEO::debugManager.flags.RenderCompressedImagesEnabled.set(1);
|
||||
EXPECT_TRUE(l0GfxCoreHelper.imageCompressionSupported(hwInfo));
|
||||
|
||||
hwInfo.capabilityTable.ftrRenderCompressedImages = true;
|
||||
NEO::debugManager.flags.RenderCompressedImagesEnabled.set(0);
|
||||
EXPECT_FALSE(l0GfxCoreHelper.imageCompressionSupported(hwInfo));
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, givenL0GfxCoreHelperWhenAskingForUsmCompressionSupportThenReturnCorrectValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
|
||||
EXPECT_TRUE(l0GfxCoreHelper.forceDefaultUsmCompressionSupport());
|
||||
|
||||
HardwareInfo hwInfo = *NEO::defaultHwInfo;
|
||||
|
||||
hwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
|
||||
EXPECT_TRUE(l0GfxCoreHelper.usmCompressionSupported(hwInfo));
|
||||
|
||||
hwInfo.capabilityTable.ftrRenderCompressedBuffers = false;
|
||||
EXPECT_FALSE(l0GfxCoreHelper.usmCompressionSupported(hwInfo));
|
||||
|
||||
NEO::debugManager.flags.RenderCompressedBuffersEnabled.set(1);
|
||||
EXPECT_TRUE(l0GfxCoreHelper.usmCompressionSupported(hwInfo));
|
||||
|
||||
hwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
|
||||
NEO::debugManager.flags.RenderCompressedBuffersEnabled.set(0);
|
||||
EXPECT_FALSE(l0GfxCoreHelper.usmCompressionSupported(hwInfo));
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForMultiTileCapablePlatformThenReturnFalse) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_FALSE(l0GfxCoreHelper.multiTileCapablePlatform());
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForCmdListHeapSharingSupportThenReturnTrue) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_TRUE(l0GfxCoreHelper.platformSupportsCmdListHeapSharing());
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForStateComputeModeTrackingSupportThenReturnTrue) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_TRUE(l0GfxCoreHelper.platformSupportsStateComputeModeTracking());
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForFrontEndTrackingSupportThenReturnTrue) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_TRUE(l0GfxCoreHelper.platformSupportsFrontEndTracking());
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForPipelineSelectTrackingSupportThenReturnTrue) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_TRUE(l0GfxCoreHelper.platformSupportsPipelineSelectTracking());
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForStateBaseAddressTrackingSupportThenReturnFalse) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_FALSE(l0GfxCoreHelper.platformSupportsStateBaseAddressTracking(device->getNEODevice()->getRootDeviceEnvironment()));
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenGettingPlatformDefaultHeapAddressModelThenReturnPrivateHeaps) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_EQ(NEO::HeapAddressModel::privateHeaps, l0GfxCoreHelper.getPlatformHeapAddressModel(device->getNEODevice()->getRootDeviceEnvironment()));
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForCmdlistPrimaryBufferSupportThenReturnTrue) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_TRUE(l0GfxCoreHelper.platformSupportsPrimaryBatchBufferCmdList());
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForPlatformSupportsImmediateFlushTaskThenReturnTrue) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_TRUE(l0GfxCoreHelper.platformSupportsImmediateComputeFlushTask());
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenGettingSupportedRTASFormatThenExpectedFormatIsReturned) {
|
||||
const auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_EQ(RTASDeviceFormatInternal::version1, static_cast<RTASDeviceFormatInternal>(l0GfxCoreHelper.getSupportedRTASFormat()));
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenGettingCmdlistUpdateCapabilityThenReturnCorrectValue) {
|
||||
const auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
EXPECT_EQ(63u, l0GfxCoreHelper.getPlatformCmdListUpdateCapabilities());
|
||||
}
|
||||
|
||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForDeletingIpSamplingEntryWithNullValuesThenMapRemainstheSameSize) {
|
||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||
std::map<uint64_t, void *> stallSumIpDataMap;
|
||||
stallSumIpDataMap.emplace(std::pair<uint64_t, void *>(0ull, nullptr));
|
||||
l0GfxCoreHelper.stallIpDataMapDelete(stallSumIpDataMap);
|
||||
EXPECT_NE(0u, stallSumIpDataMap.size());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/kernel/kernel_properties.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_device.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_module.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using KernelPropertyTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(KernelPropertyTest, givenKernelExtendedPropertiesStructureWhenKernelPropertiesCalledThenPropertiesAreCorrectlySet, IsXe2HpgCore) {
|
||||
ze_device_module_properties_t kernelProperties = {};
|
||||
ze_float_atomic_ext_properties_t kernelExtendedProperties = {};
|
||||
kernelExtendedProperties.stype = ZE_STRUCTURE_TYPE_FLOAT_ATOMIC_EXT_PROPERTIES;
|
||||
kernelProperties.pNext = &kernelExtendedProperties;
|
||||
ze_result_t res = device->getKernelProperties(&kernelProperties);
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
|
||||
const auto &fp16Properties = kernelExtendedProperties.fp16Flags;
|
||||
EXPECT_TRUE(fp16Properties & FpAtomicExtFlags::globalLoadStore);
|
||||
EXPECT_TRUE(fp16Properties & FpAtomicExtFlags::localLoadStore);
|
||||
EXPECT_TRUE(fp16Properties & FpAtomicExtFlags::globalMinMax);
|
||||
EXPECT_TRUE(fp16Properties & FpAtomicExtFlags::localMinMax);
|
||||
|
||||
EXPECT_FALSE(fp16Properties & FpAtomicExtFlags::globalAdd);
|
||||
EXPECT_FALSE(fp16Properties & FpAtomicExtFlags::localAdd);
|
||||
|
||||
const auto &fp32Properties = kernelExtendedProperties.fp32Flags;
|
||||
EXPECT_TRUE(fp32Properties & FpAtomicExtFlags::globalLoadStore);
|
||||
EXPECT_TRUE(fp32Properties & FpAtomicExtFlags::localLoadStore);
|
||||
EXPECT_TRUE(fp32Properties & FpAtomicExtFlags::globalMinMax);
|
||||
EXPECT_TRUE(fp32Properties & FpAtomicExtFlags::localMinMax);
|
||||
EXPECT_TRUE(fp32Properties & FpAtomicExtFlags::globalAdd);
|
||||
EXPECT_TRUE(fp32Properties & FpAtomicExtFlags::localAdd);
|
||||
|
||||
const auto &fp64Properties = kernelExtendedProperties.fp64Flags;
|
||||
EXPECT_TRUE(fp64Properties & FpAtomicExtFlags::globalLoadStore);
|
||||
EXPECT_TRUE(fp64Properties & FpAtomicExtFlags::localLoadStore);
|
||||
EXPECT_TRUE(fp64Properties & FpAtomicExtFlags::globalMinMax);
|
||||
EXPECT_TRUE(fp64Properties & FpAtomicExtFlags::localMinMax);
|
||||
EXPECT_TRUE(fp64Properties & FpAtomicExtFlags::globalAdd);
|
||||
EXPECT_TRUE(fp64Properties & FpAtomicExtFlags::localAdd);
|
||||
}
|
||||
|
||||
using Xe2KernelSetupTests = ::testing::Test;
|
||||
|
||||
XE2_HPG_CORETEST_F(Xe2KernelSetupTests, givenParamsWhenSetupGroupSizeThenNumThreadsPerThreadGroupAreCorrectly) {
|
||||
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
|
||||
|
||||
{
|
||||
NEO::Device *mockNeoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get(), 0));
|
||||
MockDeviceImp l0Device(mockNeoDevice, mockNeoDevice->getExecutionEnvironment());
|
||||
|
||||
Mock<KernelImp> kernel;
|
||||
kernel.descriptor.kernelAttributes.numGrfRequired = GrfConfig::defaultGrfNumber;
|
||||
kernel.enableForcingOfGenerateLocalIdByHw = true;
|
||||
Mock<Module> module(&l0Device, nullptr);
|
||||
module.getMaxGroupSizeResult = UINT32_MAX;
|
||||
kernel.module = &module;
|
||||
|
||||
std::array<std::array<uint32_t, 3>, 4> values = {{
|
||||
{16u, 1u, 64u}, // SIMT Size, HW local-id generation, Max Num of threads
|
||||
{32u, 1u, 32u},
|
||||
{16u, 0u, 64u},
|
||||
{32u, 0u, 64u},
|
||||
|
||||
}};
|
||||
|
||||
for (auto &[simtSize, isHwLocalIdGeneration, expectedNumThreadsPerThreadGroup] : values) {
|
||||
kernel.descriptor.kernelAttributes.simdSize = simtSize;
|
||||
kernel.forceGenerateLocalIdByHw = isHwLocalIdGeneration;
|
||||
kernel.setGroupSize(1024u, 1024u, 1024u);
|
||||
EXPECT_EQ(expectedNumThreadsPerThreadGroup, kernel.numThreadsPerThreadGroup);
|
||||
kernel.groupSize[0] = kernel.groupSize[1] = kernel.groupSize[2] = 0;
|
||||
}
|
||||
}
|
||||
{
|
||||
NEO::Device *mockNeoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get(), 0));
|
||||
MockDeviceImp l0Device(mockNeoDevice, mockNeoDevice->getExecutionEnvironment());
|
||||
|
||||
Mock<KernelImp> kernel;
|
||||
kernel.descriptor.kernelAttributes.numGrfRequired = GrfConfig::largeGrfNumber;
|
||||
kernel.enableForcingOfGenerateLocalIdByHw = true;
|
||||
Mock<Module> module(&l0Device, nullptr);
|
||||
module.getMaxGroupSizeResult = UINT32_MAX;
|
||||
kernel.module = &module;
|
||||
|
||||
std::array<std::array<uint32_t, 3>, 4> values = {{
|
||||
{16u, 0u, 32u}, // SIMT Size, HW local-id generation, Max Num of threads
|
||||
{16u, 1u, 32u},
|
||||
{32u, 0u, 32u},
|
||||
{32u, 1u, 32u},
|
||||
}};
|
||||
|
||||
for (auto &[simtSize, isHwLocalIdGeneration, expectedNumThreadsPerThreadGroup] : values) {
|
||||
kernel.descriptor.kernelAttributes.simdSize = simtSize;
|
||||
kernel.forceGenerateLocalIdByHw = isHwLocalIdGeneration;
|
||||
kernel.setGroupSize(1024u, 1024u, 1024u);
|
||||
EXPECT_EQ(expectedNumThreadsPerThreadGroup, kernel.numThreadsPerThreadGroup);
|
||||
kernel.groupSize[0] = kernel.groupSize[1] = kernel.groupSize[2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user