mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
refactor: remove not needed code
Related-To: NEO-7527 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
cb730d11f4
commit
3a21b3b228
@@ -5,23 +5,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/built_ins/sip.h"
|
||||
#include "shared/source/device/root_device.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/os_interface/linux/sys_calls_linux_ult.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_built_ins.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_context.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -34,110 +21,6 @@ struct TestDeviceUuid : public ::testing::Test {
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
HWTEST2_F(TestDeviceUuid, GivenCorrectTelemetryNodesAreAvailableWhenRetrievingDeviceAndSubDevicePropertiesThenCorrectUuidIsReceived, IsXEHP) {
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsReadlink)> mockReadLink(&NEO::SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||
std::map<std::string, std::string> fileNameLinkMap = {
|
||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
||||
};
|
||||
|
||||
auto it = fileNameLinkMap.find(std::string(path));
|
||||
if (it != fileNameLinkMap.end()) {
|
||||
std::memcpy(buf, it->second.c_str(), it->second.size());
|
||||
return static_cast<int>(it->second.size());
|
||||
}
|
||||
return -1;
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> mockOpen(&NEO::SysCalls::sysCallsOpen, [](const char *pathname, int flags) -> int {
|
||||
std::vector<std::string> supportedFiles = {
|
||||
"/sys/class/intel_pmt/telem1/guid",
|
||||
"/sys/class/intel_pmt/telem1/offset",
|
||||
"/sys/class/intel_pmt/telem1/telem",
|
||||
};
|
||||
|
||||
auto itr = std::find(supportedFiles.begin(), supportedFiles.end(), std::string(pathname));
|
||||
if (itr != supportedFiles.end()) {
|
||||
// skipping "0"
|
||||
return static_cast<int>(std::distance(supportedFiles.begin(), itr)) + 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||
std::vector<std::pair<std::string, std::string>> supportedFiles = {
|
||||
{"/sys/class/intel_pmt/telem1/guid", "0xfdc76195"},
|
||||
{"/sys/class/intel_pmt/telem1/offset", "0\n"},
|
||||
{"/sys/class/intel_pmt/telem1/telem", "dummy"},
|
||||
};
|
||||
|
||||
fd -= 1;
|
||||
|
||||
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||
if (supportedFiles[fd].second == "dummy") {
|
||||
uint64_t data = 0xFEEDBEADDEABDEEF;
|
||||
memcpy(buf, &data, sizeof(data));
|
||||
return sizeof(data);
|
||||
}
|
||||
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||
return supportedFiles[fd].second.size();
|
||||
}
|
||||
|
||||
return -1;
|
||||
});
|
||||
DebugManager.flags.EnableChipsetUniqueUUID.set(1);
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
|
||||
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;
|
||||
NEO::MockDevice *neoDevice = nullptr;
|
||||
L0::Device *device = nullptr;
|
||||
DrmMockResources *drmMock = nullptr;
|
||||
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
auto mockBuiltIns = new MockBuiltins();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
||||
auto osInterface = new OSInterface();
|
||||
drmMock = new DrmMockResources(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface);
|
||||
std::vector<std::string> pciPaths = {
|
||||
"0000:3a:00.0"};
|
||||
drmMock->setPciPath(pciPaths[0].c_str());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<Drm>(drmMock));
|
||||
|
||||
neoDevice = NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, 0u);
|
||||
|
||||
NEO::DeviceVector devices;
|
||||
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
|
||||
driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
|
||||
driverHandle->initialize(std::move(devices));
|
||||
device = driverHandle->devices[0];
|
||||
|
||||
uint64_t expectedVal = 0xFEEDBEADDEABDEEF;
|
||||
ze_device_properties_t deviceProps;
|
||||
deviceProps = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, device->getProperties(&deviceProps));
|
||||
EXPECT_TRUE(0 == std::memcmp(deviceProps.uuid.id, &expectedVal, sizeof(expectedVal)));
|
||||
|
||||
uint32_t subdeviceCount = neoDevice->getNumGenericSubDevices();
|
||||
std::vector<ze_device_handle_t> subdevices;
|
||||
subdevices.resize(subdeviceCount);
|
||||
device->getSubDevices(&subdeviceCount, subdevices.data());
|
||||
|
||||
uint8_t expectedUuid[16] = {0};
|
||||
std::memcpy(expectedUuid, &expectedVal, sizeof(uint64_t));
|
||||
expectedUuid[15] = 1;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, static_cast<Device *>(subdevices[0])->getProperties(&deviceProps));
|
||||
EXPECT_TRUE(0 == std::memcmp(deviceProps.uuid.id, expectedUuid, sizeof(expectedUuid)));
|
||||
expectedUuid[15] = 2;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, static_cast<Device *>(subdevices[1])->getProperties(&deviceProps));
|
||||
EXPECT_TRUE(0 == std::memcmp(deviceProps.uuid.id, expectedUuid, sizeof(expectedUuid)));
|
||||
}
|
||||
|
||||
TEST_F(TestDeviceUuid, GivenEnableChipsetUniqueUuidIsSetWhenOsInterfaceIsNotSetThenUuidOfFallbackPathIsReceived) {
|
||||
|
||||
DebugManager.flags.EnableChipsetUniqueUUID.set(1);
|
||||
@@ -157,4 +40,4 @@ TEST_F(TestDeviceUuid, GivenEnableChipsetUniqueUuidIsSetWhenOsInterfaceIsNotSetT
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
} // namespace L0
|
||||
|
||||
@@ -3361,35 +3361,6 @@ TEST_F(KernelImplicitArgTests, givenKernelWithImplicitArgsWhenSettingKernelParam
|
||||
EXPECT_EQ(0, memcmp(pImplicitArgs, &expectedImplicitArgs, sizeof(ImplicitArgs)));
|
||||
}
|
||||
|
||||
using MultiTileModuleTest = Test<MultiTileModuleFixture>;
|
||||
|
||||
HWTEST2_F(MultiTileModuleTest, GivenMultiTileDeviceWhenSettingKernelArgAndSurfaceStateThenMultiTileFlagsAreSetCorrectly, IsXeHpCore) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
ze_kernel_desc_t desc = {};
|
||||
desc.pKernelName = kernelName.c_str();
|
||||
|
||||
WhiteBoxKernelHw<gfxCoreFamily> mockKernel;
|
||||
mockKernel.module = modules[0].get();
|
||||
mockKernel.initialize(&desc);
|
||||
|
||||
auto &arg = const_cast<NEO::ArgDescPointer &>(mockKernel.kernelImmData->getDescriptor().payloadMappings.explicitArgs[0].template as<NEO::ArgDescPointer>());
|
||||
arg.bindless = undefined<CrossThreadDataOffset>;
|
||||
arg.bindful = 0x40;
|
||||
|
||||
constexpr size_t size = 128;
|
||||
uint64_t gpuAddress = 0x2000;
|
||||
char bufferArray[size] = {};
|
||||
void *buffer = reinterpret_cast<void *>(bufferArray);
|
||||
NEO::MockGraphicsAllocation mockAllocation(buffer, gpuAddress, size);
|
||||
|
||||
mockKernel.setBufferSurfaceState(0, buffer, &mockAllocation);
|
||||
|
||||
void *surfaceStateAddress = ptrOffset(mockKernel.surfaceStateHeapData.get(), arg.bindful);
|
||||
RENDER_SURFACE_STATE *surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(surfaceStateAddress);
|
||||
EXPECT_FALSE(surfaceState->getDisableSupportForMultiGpuAtomics());
|
||||
EXPECT_FALSE(surfaceState->getDisableSupportForMultiGpuPartialWrites());
|
||||
}
|
||||
|
||||
using BindlessKernelTest = Test<DeviceFixture>;
|
||||
|
||||
TEST_F(BindlessKernelTest, givenBindlessKernelWhenPatchingCrossThreadDataThenCorrectBindlessOffsetsAreWritten) {
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021-2023 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -1,829 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/l3_range.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/source/helpers/state_base_address.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_timestamp_packet.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#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_kernel.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_module.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using CommandListCreate = Test<DeviceFixture>;
|
||||
using CommandListAppendLaunchKernel = Test<ModuleFixture>;
|
||||
|
||||
using CommandListAppendLaunchKernelWithAtomics = Test<ModuleFixture>;
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelWithAtomics, givenKernelWithNoGlobalAtomicsThenLastSentGlobalAtomicsInContainerStaysFalse, IsXeHpCore) {
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
pCommandList->partitionCount = 2;
|
||||
|
||||
auto &kernelAttributes = kernel.immutableData.kernelDescriptor->kernelAttributes;
|
||||
kernelAttributes.flags.useGlobalAtomics = false;
|
||||
EXPECT_FALSE(pCommandList->commandContainer.lastSentUseGlobalAtomics);
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, nullptr, launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
EXPECT_FALSE(pCommandList->commandContainer.lastSentUseGlobalAtomics);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelWithAtomics, givenKernelWithGlobalAtomicsThenLastSentGlobalAtomicsInContainerIsSetToTrue, IsXeHpCore) {
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
pCommandList->partitionCount = 2;
|
||||
|
||||
auto &kernelAttributes = kernel.immutableData.kernelDescriptor->kernelAttributes;
|
||||
kernelAttributes.flags.useGlobalAtomics = true;
|
||||
EXPECT_FALSE(pCommandList->commandContainer.lastSentUseGlobalAtomics);
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, nullptr, launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
EXPECT_TRUE(pCommandList->commandContainer.lastSentUseGlobalAtomics);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelWithAtomics, givenKernelWithGlobalAtomicsAndLastSentGlobalAtomicsInContainerTrueThenLastSentGlobalAtomicsStaysTrue, IsXeHpCore) {
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
pCommandList->partitionCount = 2;
|
||||
|
||||
auto &kernelAttributes = kernel.immutableData.kernelDescriptor->kernelAttributes;
|
||||
kernelAttributes.flags.useGlobalAtomics = true;
|
||||
pCommandList->commandContainer.lastSentUseGlobalAtomics = true;
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, nullptr, launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
EXPECT_TRUE(pCommandList->commandContainer.lastSentUseGlobalAtomics);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelWithAtomics, givenKernelWithNoGlobalAtomicsAndLastSentGlobalAtomicsInContainerTrueThenLastSentGlobalAtomicsIsSetToFalse, IsXeHpCore) {
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
pCommandList->partitionCount = 2;
|
||||
|
||||
auto &kernelAttributes = kernel.immutableData.kernelDescriptor->kernelAttributes;
|
||||
kernelAttributes.flags.useGlobalAtomics = false;
|
||||
pCommandList->commandContainer.lastSentUseGlobalAtomics = true;
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, nullptr, launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
EXPECT_FALSE(pCommandList->commandContainer.lastSentUseGlobalAtomics);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelWithAtomics, givenKernelWithGlobalAtomicsAndNoImplicitScalingThenLastSentGlobalAtomicsInContainerStaysFalse, IsXeHpCore) {
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto &kernelAttributes = kernel.immutableData.kernelDescriptor->kernelAttributes;
|
||||
kernelAttributes.flags.useGlobalAtomics = true;
|
||||
EXPECT_FALSE(pCommandList->commandContainer.lastSentUseGlobalAtomics);
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, nullptr, launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
EXPECT_FALSE(pCommandList->commandContainer.lastSentUseGlobalAtomics);
|
||||
}
|
||||
|
||||
struct MultTileCommandListAppendLaunchKernelL3FlushFixture : public MultiTileCommandListFixture<false, false, false> {
|
||||
using BaseClass = MultiTileCommandListFixture<false, false, false>;
|
||||
void setUp() {
|
||||
DebugManager.flags.CompactL3FlushEventPacket.set(0);
|
||||
BaseClass::setUp();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
using MultTileCommandListAppendLaunchKernelL3Flush = Test<MultTileCommandListAppendLaunchKernelL3FlushFixture>;
|
||||
|
||||
HWTEST2_F(MultTileCommandListAppendLaunchKernelL3Flush, givenKernelWithRegularEventAndWithWalkerPartitionThenProperCommandsEncoded, IsXeHpCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION;
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
pCommandList->partitionCount = 2;
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
|
||||
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));
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto gpuAddress = event->getGpuAddress(device) +
|
||||
(pCommandList->partitionCount * event->getSinglePacketSize()) +
|
||||
event->getContextEndOffset();
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(pCommandList->commandContainer.getCommandStream()->getCpuBase(), 0), pCommandList->commandContainer.getCommandStream()->getUsed()));
|
||||
|
||||
EXPECT_EQ(2u, pCommandList->partitionCount);
|
||||
auto itorLri = find<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(cmdList.end(), itorLri);
|
||||
auto itorPC = findAll<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(0u, itorPC.size());
|
||||
uint32_t postSyncCount = 0u;
|
||||
for (auto it : itorPC) {
|
||||
auto cmd = genCmdCast<PIPE_CONTROL *>(*it);
|
||||
if (cmd->getPostSyncOperation() == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) {
|
||||
EXPECT_EQ(gpuAddress, NEO::UnitTestHelper<FamilyType>::getPipeControlPostSyncAddress(*cmd));
|
||||
EXPECT_TRUE(cmd->getWorkloadPartitionIdOffsetEnable());
|
||||
postSyncCount++;
|
||||
}
|
||||
}
|
||||
ASSERT_LE(1u, postSyncCount);
|
||||
}
|
||||
|
||||
HWTEST2_F(MultTileCommandListAppendLaunchKernelL3Flush, givenKernelWithTimestampEventAndWithWalkerPartitionThenProperCommandsEncoded, IsXeHpCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION;
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
pCommandList->partitionCount = 2;
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE | ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
|
||||
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));
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto gpuAddress = event->getGpuAddress(device) +
|
||||
(pCommandList->partitionCount * event->getSinglePacketSize()) +
|
||||
event->getContextEndOffset();
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(pCommandList->commandContainer.getCommandStream()->getCpuBase(), 0), pCommandList->commandContainer.getCommandStream()->getUsed()));
|
||||
|
||||
EXPECT_EQ(2u, pCommandList->partitionCount);
|
||||
auto itorLri = findAll<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(0u, itorLri.size());
|
||||
auto itorPC = findAll<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(0u, itorPC.size());
|
||||
uint32_t postSyncCount = 0u;
|
||||
for (auto it : itorPC) {
|
||||
auto cmd = genCmdCast<PIPE_CONTROL *>(*it);
|
||||
if (cmd->getPostSyncOperation() == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) {
|
||||
EXPECT_EQ(gpuAddress, NEO::UnitTestHelper<FamilyType>::getPipeControlPostSyncAddress(*cmd));
|
||||
EXPECT_TRUE(cmd->getWorkloadPartitionIdOffsetEnable());
|
||||
postSyncCount++;
|
||||
}
|
||||
}
|
||||
ASSERT_LE(1u, postSyncCount);
|
||||
}
|
||||
|
||||
struct CommandListAppendLaunchKernelL3FlushFixture : public ModuleFixture {
|
||||
void setUp() {
|
||||
DebugManager.flags.CompactL3FlushEventPacket.set(0);
|
||||
ModuleFixture::setUp();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
using CommandListAppendLaunchKernelL3Flush = Test<CommandListAppendLaunchKernelL3FlushFixture>;
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelL3Flush, givenKernelWithEventAndWithoutWalkerPartitionThenProperCommandsEncoded, IsXeHpCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
||||
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));
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(pCommandList->commandContainer.getCommandStream()->getCpuBase(), 0), pCommandList->commandContainer.getCommandStream()->getUsed()));
|
||||
|
||||
EXPECT_EQ(1u, pCommandList->partitionCount);
|
||||
auto itorLri = find<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_EQ(cmdList.end(), itorLri);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelL3Flush, givenKernelWithEventHostScopeWithoutWalkerPartitionThenEventL3FlushWaSet, IsXeHpCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE | ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
|
||||
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));
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
EXPECT_EQ(true, event->getL3FlushForCurrenKernel());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelL3Flush, givenKernelWithEventZeroScopeWithoutWalkerPartitionThenEventL3FlushNotSet, IsXeHpCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE | ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
||||
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));
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
EXPECT_EQ(false, event->getL3FlushForCurrenKernel());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernelL3Flush, givenKernelWithEventHostScopeWithoutWalkerPartitionThenSkipOddPacketsDuringQuery, IsXeHpCore) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
Mock<::L0::KernelImp> kernel;
|
||||
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
|
||||
kernel.module = pMockModule.get();
|
||||
|
||||
kernel.setGroupSize(1, 1, 1);
|
||||
ze_group_count_t groupCount{8, 1, 1};
|
||||
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE | ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
|
||||
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));
|
||||
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
result = pCommandList->appendLaunchKernelWithParams(&kernel, &groupCount, event.get(), launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
EXPECT_EQ(true, event->getL3FlushForCurrenKernel());
|
||||
EXPECT_EQ(2u, event->getPacketsInUse());
|
||||
|
||||
typename MockTimestampPackets32::Packet data[3] = {};
|
||||
data[0].contextStart = 3u;
|
||||
data[0].contextEnd = 4u;
|
||||
data[0].globalStart = 5u;
|
||||
data[0].globalEnd = 6u;
|
||||
data[1].contextStart = 2u;
|
||||
data[1].contextEnd = 6u;
|
||||
data[1].globalStart = 4u;
|
||||
data[1].globalEnd = 8u;
|
||||
event->hostAddress = &data;
|
||||
|
||||
ze_kernel_timestamp_result_t tsResult = {};
|
||||
|
||||
event->queryKernelTimestamp(&tsResult);
|
||||
EXPECT_EQ(data[0].contextStart, tsResult.context.kernelStart);
|
||||
EXPECT_EQ(data[0].contextEnd, tsResult.context.kernelEnd);
|
||||
EXPECT_EQ(data[0].globalStart, tsResult.global.kernelStart);
|
||||
EXPECT_EQ(data[0].globalEnd, tsResult.global.kernelEnd);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate, WhenCreatingCommandListThenBindingTablePoolAllocAddedToBatchBuffer, IsXeHpCore) {
|
||||
using _3DSTATE_BINDING_TABLE_POOL_ALLOC = typename FamilyType::_3DSTATE_BINDING_TABLE_POOL_ALLOC;
|
||||
|
||||
ze_result_t returnValue;
|
||||
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue));
|
||||
auto &commandContainer = commandList->commandContainer;
|
||||
auto gmmHelper = commandContainer.getDevice()->getGmmHelper();
|
||||
|
||||
ASSERT_NE(nullptr, commandContainer.getCommandStream());
|
||||
auto usedSpaceBefore = commandContainer.getCommandStream()->getUsed();
|
||||
|
||||
auto result = commandList->close();
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto usedSpaceAfter = commandContainer.getCommandStream()->getUsed();
|
||||
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList,
|
||||
ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0),
|
||||
usedSpaceAfter));
|
||||
|
||||
auto itor = find<_3DSTATE_BINDING_TABLE_POOL_ALLOC *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), itor);
|
||||
|
||||
{
|
||||
|
||||
uint32_t streamBuffer[50] = {};
|
||||
NEO::LinearStream linearStream(streamBuffer, sizeof(streamBuffer));
|
||||
|
||||
NEO::StateBaseAddressHelper<FamilyType>::programBindingTableBaseAddress(
|
||||
linearStream,
|
||||
*commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE),
|
||||
gmmHelper);
|
||||
|
||||
auto expectedCommand = reinterpret_cast<_3DSTATE_BINDING_TABLE_POOL_ALLOC *>(streamBuffer);
|
||||
|
||||
auto programmedCommand = genCmdCast<_3DSTATE_BINDING_TABLE_POOL_ALLOC *>(*itor);
|
||||
|
||||
EXPECT_EQ(0, memcmp(expectedCommand, programmedCommand, sizeof(_3DSTATE_BINDING_TABLE_POOL_ALLOC)));
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate, givenNotCopyCommandListWhenProfilingEventBeforeCommandThenStoreRegMemAdded, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using MI_LOAD_REGISTER_REG = typename GfxFamily::MI_LOAD_REGISTER_REG;
|
||||
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;
|
||||
|
||||
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.get(), true);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<MI_LOAD_REGISTER_REG *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
auto cmd = genCmdCast<MI_LOAD_REGISTER_REG *>(*itor);
|
||||
EXPECT_EQ(cmd->getSourceRegisterAddress(), REG_GLOBAL_TIMESTAMP_LDW);
|
||||
itor++;
|
||||
itor = find<MI_LOAD_REGISTER_REG *>(itor, cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
cmd = genCmdCast<MI_LOAD_REGISTER_REG *>(*itor);
|
||||
EXPECT_EQ(cmd->getSourceRegisterAddress(), GP_THREAD_TIME_REG_ADDRESS_OFFSET_LOW);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate, givenNotCopyCommandListWhenProfilingEventAfterCommandThenPipeControlAndStoreRegMemAdded, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using MI_LOAD_REGISTER_REG = typename GfxFamily::MI_LOAD_REGISTER_REG;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
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;
|
||||
|
||||
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.get(), false);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
|
||||
auto itor = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
itor++;
|
||||
itor = find<MI_LOAD_REGISTER_REG *>(itor, cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
auto cmd = genCmdCast<MI_LOAD_REGISTER_REG *>(*itor);
|
||||
EXPECT_EQ(cmd->getSourceRegisterAddress(), REG_GLOBAL_TIMESTAMP_LDW);
|
||||
itor++;
|
||||
itor = find<MI_LOAD_REGISTER_REG *>(itor, cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
cmd = genCmdCast<MI_LOAD_REGISTER_REG *>(*itor);
|
||||
EXPECT_EQ(cmd->getSourceRegisterAddress(), GP_THREAD_TIME_REG_ADDRESS_OFFSET_LOW);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingEventThenStoreRegCommandIsAdded, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::Copy, 0u);
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 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.get(), false);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
auto itor = find<MI_STORE_REGISTER_MEM *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate, givenAllocationsWhenAppendRangesBarrierThenL3ControlIsProgrammed, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using L3_CONTROL = typename GfxFamily::L3_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->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
auto itor = find<L3_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
EXPECT_EQ(cmdList.end(), ++itor);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate, givenAllocationWithSizeTooBigForL3ControlWhenAppendRangesBarrierThenTwoL3ControlAreProgrammed, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using L3_CONTROL = typename GfxFamily::L3_CONTROL;
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::Copy, 0u);
|
||||
uint64_t gpuAddress = 0x2000;
|
||||
void *buffer = reinterpret_cast<void *>(gpuAddress);
|
||||
size_t size = NEO::L3Range::maxSingleRange * (NEO::maxFlushSubrangeCount + 1);
|
||||
|
||||
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->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
auto itor = find<L3_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
EXPECT_NE(cmdList.end(), ++itor);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate, givenRangeSizeTwiceBiggerThanAllocWhenAppendRangesBarrierThenL3ControlIsNotProgrammed, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using L3_CONTROL = typename GfxFamily::L3_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 = 0x1000;
|
||||
|
||||
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[] = {2 * size};
|
||||
commandList->applyMemoryRangesBarrier(1, sizes, ranges);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
auto itor = find<L3_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(cmdList.end(), itor);
|
||||
}
|
||||
HWTEST2_F(CommandListCreate, givenRangeNotInSvmManagerThanAllocWhenAppendRangesBarrierThenL3ControlIsNotProgrammed, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using L3_CONTROL = typename GfxFamily::L3_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 = 0x1000;
|
||||
|
||||
const void *ranges[] = {buffer};
|
||||
const size_t sizes[] = {size};
|
||||
commandList->applyMemoryRangesBarrier(1, sizes, ranges);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
auto itor = find<L3_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(cmdList.end(), itor);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate, givenRangeNotAlignedToPageWhenAppendRangesBarrierThenCommandAddressIsAligned, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using L3_CONTROL = typename GfxFamily::L3_CONTROL;
|
||||
using L3_FLUSH_ADDRESS_RANGE = typename GfxFamily::L3_FLUSH_ADDRESS_RANGE;
|
||||
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->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
auto itor = find<L3_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
auto programmedCommand = genCmdCast<L3_CONTROL *>(*itor);
|
||||
programmedCommand++;
|
||||
L3_FLUSH_ADDRESS_RANGE *l3Ranges = reinterpret_cast<L3_FLUSH_ADDRESS_RANGE *>(programmedCommand);
|
||||
EXPECT_EQ(l3Ranges->getAddress(), alignDown(gpuAddress, MemoryConstants::pageSize));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListCreate, givenRangeBetweenTwoPagesWhenAppendRangesBarrierThenAddressMaskIsCorrect, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using L3_CONTROL = typename GfxFamily::L3_CONTROL;
|
||||
using L3_FLUSH_ADDRESS_RANGE = typename GfxFamily::L3_FLUSH_ADDRESS_RANGE;
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::Copy, 0u);
|
||||
uint64_t gpuAddress = 2 * MemoryConstants::pageSize + MemoryConstants::pageSize / 2;
|
||||
void *buffer = reinterpret_cast<void *>(gpuAddress);
|
||||
size_t size = MemoryConstants::pageSize / 2 + 1;
|
||||
|
||||
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->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed()));
|
||||
auto itor = find<L3_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
auto programmedCommand = genCmdCast<L3_CONTROL *>(*itor);
|
||||
programmedCommand++;
|
||||
L3_FLUSH_ADDRESS_RANGE *l3Ranges = reinterpret_cast<L3_FLUSH_ADDRESS_RANGE *>(programmedCommand);
|
||||
EXPECT_EQ(l3Ranges->getAddressMask(), NEO::L3Range::getMaskFromSize(2 * MemoryConstants::pageSize));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernel, givenEventWhenInvokingAppendLaunchKernelThenPostSyncIsAdded, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using POSTSYNC_DATA = typename FamilyType::POSTSYNC_DATA;
|
||||
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CompactL3FlushEventPacket.set(0);
|
||||
|
||||
createKernel();
|
||||
ze_result_t returnValue;
|
||||
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
|
||||
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE;
|
||||
eventPoolDesc.count = 1;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||
|
||||
auto eventPool = std::unique_ptr<EventPool>(EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, returnValue));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
|
||||
|
||||
ze_group_count_t groupCount{1, 1, 1};
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
|
||||
EXPECT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||
|
||||
GenCmdList cmdList;
|
||||
EXPECT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter));
|
||||
|
||||
bool postSyncFound = false;
|
||||
auto gpuAddress = event->getGpuAddress(device);
|
||||
|
||||
auto itorPS = findAll<WALKER_TYPE *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(0u, itorPS.size());
|
||||
|
||||
for (auto it : itorPS) {
|
||||
auto cmd = genCmdCast<WALKER_TYPE *>(*it);
|
||||
auto &postSync = cmd->getPostSync();
|
||||
EXPECT_EQ(POSTSYNC_DATA::OPERATION_WRITE_TIMESTAMP, postSync.getOperation());
|
||||
EXPECT_EQ(gpuAddress, postSync.getDestinationAddress());
|
||||
postSyncFound = true;
|
||||
}
|
||||
EXPECT_TRUE(postSyncFound);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernel, givenTimestampEventWhenInvokingAppendLaunchKernelThenPostSyncIsAdded, IsXeHpCore) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using POSTSYNC_DATA = typename FamilyType::POSTSYNC_DATA;
|
||||
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
|
||||
|
||||
createKernel();
|
||||
ze_result_t returnValue;
|
||||
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
|
||||
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
|
||||
ze_event_pool_desc_t eventPoolDesc = {};
|
||||
eventPoolDesc.count = 1;
|
||||
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
|
||||
|
||||
ze_event_desc_t eventDesc = {};
|
||||
eventDesc.index = 0;
|
||||
|
||||
auto eventPool = std::unique_ptr<EventPool>(EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, returnValue));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
|
||||
|
||||
ze_group_count_t groupCount{1, 1, 1};
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
|
||||
EXPECT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||
|
||||
GenCmdList cmdList;
|
||||
EXPECT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter));
|
||||
|
||||
bool postSyncFound = false;
|
||||
auto gpuAddress = event->getGpuAddress(device);
|
||||
|
||||
auto itorPS = findAll<WALKER_TYPE *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(0u, itorPS.size());
|
||||
|
||||
for (auto it : itorPS) {
|
||||
auto cmd = genCmdCast<WALKER_TYPE *>(*it);
|
||||
auto &postSync = cmd->getPostSync();
|
||||
EXPECT_EQ(POSTSYNC_DATA::OPERATION_WRITE_TIMESTAMP, postSync.getOperation());
|
||||
EXPECT_EQ(gpuAddress, postSync.getDestinationAddress());
|
||||
postSyncFound = true;
|
||||
}
|
||||
EXPECT_TRUE(postSyncFound);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.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_cmdlist.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_device.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_memory_manager.h"
|
||||
#include <level_zero/ze_api.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using CommandQueueExecuteCommandListsXE_HP_CORE = Test<DeviceFixture>;
|
||||
|
||||
XE_HP_CORE_TEST_F(CommandQueueExecuteCommandListsXE_HP_CORE, WhenExecutingCmdListsThenPipelineSelectAndCfeStateAreAddedToCmdBuffer) {
|
||||
const ze_command_queue_desc_t desc = {};
|
||||
ze_result_t returnValue;
|
||||
auto commandQueue = whiteboxCast(CommandQueue::create(
|
||||
productFamily,
|
||||
device, neoDevice->getDefaultEngine().commandStreamReceiver, &desc, false, false, returnValue));
|
||||
ASSERT_NE(nullptr, commandQueue);
|
||||
auto usedSpaceBefore = commandQueue->commandStream.getUsed();
|
||||
|
||||
ze_command_list_handle_t commandLists[] = {
|
||||
CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()};
|
||||
uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]);
|
||||
auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true);
|
||||
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto usedSpaceAfter = commandQueue->commandStream.getUsed();
|
||||
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandQueue->commandStream.getCpuBase(), 0), usedSpaceAfter));
|
||||
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
auto itorCFE = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(itorCFE, cmdList.end());
|
||||
|
||||
// Should have a PS before a CFE
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
auto itorPS = find<PIPELINE_SELECT *>(cmdList.begin(), itorCFE);
|
||||
ASSERT_NE(itorPS, itorCFE);
|
||||
{
|
||||
auto cmd = genCmdCast<PIPELINE_SELECT *>(*itorPS);
|
||||
EXPECT_EQ(cmd->getMaskBits() & 3u, 3u);
|
||||
EXPECT_EQ(cmd->getPipelineSelection(), PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
|
||||
}
|
||||
|
||||
CommandList::fromHandle(commandLists[0])->destroy();
|
||||
commandQueue->destroy();
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(CommandQueueExecuteCommandListsXE_HP_CORE, WhenExecutingCmdListsThenStateBaseAddressForGeneralStateBaseAddressIsNotAdded) {
|
||||
const ze_command_queue_desc_t desc = {};
|
||||
ze_result_t returnValue;
|
||||
auto commandQueue = whiteboxCast(CommandQueue::create(
|
||||
productFamily,
|
||||
device, neoDevice->getDefaultEngine().commandStreamReceiver, &desc, false, false, returnValue));
|
||||
ASSERT_NE(nullptr, commandQueue);
|
||||
auto usedSpaceBefore = commandQueue->commandStream.getUsed();
|
||||
|
||||
ze_command_list_handle_t commandLists[] = {
|
||||
CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle()};
|
||||
uint32_t numCommandLists = sizeof(commandLists) / sizeof(commandLists[0]);
|
||||
auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true);
|
||||
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto usedSpaceAfter = commandQueue->commandStream.getUsed();
|
||||
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(commandQueue->commandStream.getCpuBase(), 0), usedSpaceAfter));
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
|
||||
auto itorSba = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(itorSba, cmdList.end());
|
||||
|
||||
CommandList::fromHandle(commandLists[0])->destroy();
|
||||
commandQueue->destroy();
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using DeviceFixtureXeHpCore = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(DeviceFixtureXeHpCore, GivenTargetXeHpCoreaWhenGettingMemoryPropertiesThenMemoryNameComesAsHBM, IsXeHpCore) {
|
||||
ze_device_memory_properties_t memProperties = {};
|
||||
uint32_t pCount = 1u;
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, device->getMemoryProperties(&pCount, &memProperties));
|
||||
EXPECT_EQ(0, strcmp(memProperties.name, "HBM"));
|
||||
}
|
||||
|
||||
HWTEST2_F(DeviceFixtureXeHpCore, givenReturnedDevicePropertiesThenExpectedPropertyFlagsSet, IsXeHpCore) {
|
||||
ze_device_properties_t deviceProps = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
|
||||
device->getProperties(&deviceProps);
|
||||
EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING);
|
||||
EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_ECC);
|
||||
EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE);
|
||||
EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED);
|
||||
}
|
||||
|
||||
using CommandQueueGroupTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(CommandQueueGroupTest, givenNoBlitterSupportAndNoCCSThenOneQueueGroupIsReturned, IsXeHpCore) {
|
||||
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);
|
||||
Mock<L0::DeviceImp> 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, IsXeHpCore) {
|
||||
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);
|
||||
Mock<L0::DeviceImp> 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, givenBlitterSupportAndCCSThenThreeQueueGroupsAreReturned, IsXeHpCore) {
|
||||
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);
|
||||
Mock<L0::DeviceImp> 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, hwInfo.featureTable.ftrBcsInfo.count());
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DeviceCopyQueueGroupXeHpCoreFixture : public DeviceFixture {
|
||||
public:
|
||||
void setUp() {
|
||||
DebugManager.flags.EnableBlitterOperationsSupport.set(0);
|
||||
DeviceFixture::setUp();
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
DeviceFixture::tearDown();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
using DeviceCopyQueueGroupXeHpCoreTest = Test<DeviceCopyQueueGroupXeHpCoreFixture>;
|
||||
|
||||
HWTEST2_F(DeviceCopyQueueGroupXeHpCoreTest,
|
||||
givenBlitterSupportAndEnableBlitterOperationsSupportSetToZeroThenNoCopyEngineIsReturned, IsXeHpCore) {
|
||||
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);
|
||||
Mock<L0::DeviceImp> 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);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/kernel/kernel_properties.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using KernelPropertyTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(KernelPropertyTest, givenKernelExtendedPropertiesStructureWhenKernelPropertiesCalledThenPropertiesAreCorrectlySet, IsXeHpCore) {
|
||||
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);
|
||||
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp16Flags & FP_ATOMIC_EXT_FLAG_GLOBAL_LOAD_STORE);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp16Flags & FP_ATOMIC_EXT_FLAG_GLOBAL_ADD);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp16Flags & FP_ATOMIC_EXT_FLAG_GLOBAL_MIN_MAX);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp16Flags & FP_ATOMIC_EXT_FLAG_LOCAL_LOAD_STORE);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp16Flags & FP_ATOMIC_EXT_FLAG_LOCAL_ADD);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp16Flags & FP_ATOMIC_EXT_FLAG_LOCAL_MIN_MAX);
|
||||
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp32Flags & FP_ATOMIC_EXT_FLAG_GLOBAL_LOAD_STORE);
|
||||
EXPECT_TRUE(kernelExtendedProperties.fp32Flags & FP_ATOMIC_EXT_FLAG_GLOBAL_ADD);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp32Flags & FP_ATOMIC_EXT_FLAG_GLOBAL_MIN_MAX);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp32Flags & FP_ATOMIC_EXT_FLAG_LOCAL_LOAD_STORE);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp32Flags & FP_ATOMIC_EXT_FLAG_LOCAL_ADD);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp32Flags & FP_ATOMIC_EXT_FLAG_LOCAL_MIN_MAX);
|
||||
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp64Flags & FP_ATOMIC_EXT_FLAG_GLOBAL_LOAD_STORE);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp64Flags & FP_ATOMIC_EXT_FLAG_GLOBAL_ADD);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp64Flags & FP_ATOMIC_EXT_FLAG_GLOBAL_MIN_MAX);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp64Flags & FP_ATOMIC_EXT_FLAG_LOCAL_LOAD_STORE);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp64Flags & FP_ATOMIC_EXT_FLAG_LOCAL_ADD);
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp64Flags & FP_ATOMIC_EXT_FLAG_LOCAL_MIN_MAX);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user