Extend command list kernel interface

Related-To: NEO-6959

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2022-05-27 16:47:43 +00:00
committed by Compute-Runtime-Automation
parent 9fade632ba
commit 9e575532b3
24 changed files with 314 additions and 89 deletions

View File

@@ -27,6 +27,14 @@ struct EventPool;
struct Event;
struct Kernel;
struct CmdListKernelLaunchParams {
bool isIndirect = false;
bool isPredicate = false;
bool isCooperative = false;
bool isKernelSplitOperation = false;
bool isBuiltInKernel = false;
};
struct CommandList : _ze_command_list_handle_t {
static constexpr uint32_t defaultNumIddsPerBlock = 64u;
static constexpr uint32_t commandListimmediateIddsPerBlock = 1u;
@@ -76,7 +84,8 @@ struct CommandList : _ze_command_list_handle_t {
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) = 0;
virtual ze_result_t appendLaunchKernel(ze_kernel_handle_t hKernel, const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) = 0;
ze_event_handle_t hEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents,
const CmdListKernelLaunchParams &launchParams) = 0;
virtual ze_result_t appendLaunchCooperativeKernel(ze_kernel_handle_t hKernel,
const ze_group_count_t *pLaunchFuncArgs,
ze_event_handle_t hSignalEvent,

View File

@@ -38,13 +38,6 @@ struct AlignedAllocationData {
bool needsFlush = false;
};
struct CmdListKernelLaunchParams {
bool isIndirect = false;
bool isPredicate = false;
bool isCooperative = false;
bool isKernelSplitOperation = false;
};
struct EventPool;
struct Event;
@@ -86,7 +79,8 @@ struct CommandListCoreFamily : CommandListImp {
ze_result_t appendLaunchKernel(ze_kernel_handle_t hKernel,
const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) override;
ze_event_handle_t *phWaitEvents,
const CmdListKernelLaunchParams &launchParams) override;
ze_result_t appendLaunchCooperativeKernel(ze_kernel_handle_t hKernel,
const ze_group_count_t *pLaunchFuncArgs,
ze_event_handle_t hSignalEvent,
@@ -224,7 +218,8 @@ struct CommandListCoreFamily : CommandListImp {
const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent,
const CmdListKernelLaunchParams &launchParams);
ze_result_t appendLaunchKernelSplit(ze_kernel_handle_t hKernel, const ze_group_count_t *pThreadGroupDimensions, ze_event_handle_t hEvent);
ze_result_t appendLaunchKernelSplit(ze_kernel_handle_t hKernel, const ze_group_count_t *pThreadGroupDimensions, ze_event_handle_t hEvent,
const CmdListKernelLaunchParams &launchParams);
ze_result_t prepareIndirectParams(const ze_group_count_t *pThreadGroupDimensions);
void updateStreamProperties(Kernel &kernel, bool isMultiOsContextCapable, bool isCooperative);
void clearCommandsToPatch();

View File

@@ -180,7 +180,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(ze_kernel_h
const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
ze_event_handle_t *phWaitEvents,
const CmdListKernelLaunchParams &launchParams) {
NEO::Device *neoDevice = device->getNEODevice();
uint32_t callId = 0;
@@ -198,7 +199,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(ze_kernel_h
return ret;
}
CmdListKernelLaunchParams launchParams = {};
auto res = appendLaunchKernelWithParams(hKernel, pThreadGroupDimensions,
hEvent, launchParams);
@@ -509,8 +509,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemory(ze_i
ze_group_count_t functionArgs{pDstRegion->width / groupSizeX, pDstRegion->height / groupSizeY,
pDstRegion->depth / groupSizeZ};
CmdListKernelLaunchParams launchParams = {};
launchParams.isBuiltInKernel = true;
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinKernel->toHandle(), &functionArgs,
hEvent, numWaitEvents, phWaitEvents);
hEvent, numWaitEvents, phWaitEvents,
launchParams);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -627,8 +630,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemory(void *
ze_group_count_t functionArgs{pSrcRegion->width / groupSizeX, pSrcRegion->height / groupSizeY,
pSrcRegion->depth / groupSizeZ};
CmdListKernelLaunchParams launchParams = {};
launchParams.isBuiltInKernel = true;
auto ret = CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinKernel->toHandle(), &functionArgs,
hEvent, numWaitEvents, phWaitEvents);
hEvent, numWaitEvents, phWaitEvents, launchParams);
addFlushRequiredCommand(allocationStruct.needsFlush, hEvent);
@@ -735,8 +740,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(ze_image
kernel->setArgumentValue(2, sizeof(srcOffset), &srcOffset);
kernel->setArgumentValue(3, sizeof(dstOffset), &dstOffset);
CmdListKernelLaunchParams launchParams = {};
launchParams.isBuiltInKernel = true;
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(kernel->toHandle(), &functionArgs,
hEvent, numWaitEvents, phWaitEvents);
hEvent, numWaitEvents, phWaitEvents,
launchParams);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -854,7 +862,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernelWithGA(v
uint32_t groups = static_cast<uint32_t>((size + ((static_cast<uint64_t>(groupSizeX) * elementSize) - 1)) / (static_cast<uint64_t>(groupSizeX) * elementSize));
ze_group_count_t dispatchFuncArgs{groups, 1u, 1u};
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent);
CmdListKernelLaunchParams launchParams = {};
launchParams.isKernelSplitOperation = true;
launchParams.isBuiltInKernel = true;
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent, launchParams);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -1287,8 +1298,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel3d(Align
builtinFunction->setArgumentValue(4, sizeof(srcPitches), &srcPitches);
builtinFunction->setArgumentValue(5, sizeof(dstPitches), &dstPitches);
CmdListKernelLaunchParams launchParams = {};
launchParams.isBuiltInKernel = true;
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent, numWaitEvents,
phWaitEvents);
phWaitEvents, launchParams);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -1341,10 +1354,13 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernel2d(Align
builtinFunction->setArgumentValue(4, sizeof(srcPitch), &srcPitch);
builtinFunction->setArgumentValue(5, sizeof(dstPitch), &dstPitch);
CmdListKernelLaunchParams launchParams = {};
launchParams.isBuiltInKernel = true;
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinFunction->toHandle(),
&dispatchFuncArgs, hSignalEvent,
numWaitEvents,
phWaitEvents);
phWaitEvents,
launchParams);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -1410,6 +1426,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
}
auto lock = device->getBuiltinFunctionsLib()->obtainUniqueOwnership();
CmdListKernelLaunchParams launchParams = {};
launchParams.isKernelSplitOperation = true;
launchParams.isBuiltInKernel = true;
if (patternSize == 1) {
Kernel *builtinFunction = nullptr;
@@ -1436,7 +1456,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
uint32_t groups = static_cast<uint32_t>(size) / groupSizeX;
ze_group_count_t dispatchFuncArgs{groups, 1u, 1u};
res = appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent);
res = appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent, launchParams);
if (res) {
return res;
}
@@ -1450,7 +1470,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
builtinFunction->setArgBufferWithAlloc(0, dstAllocation.alignedAllocationPtr, dstAllocation.alloc);
builtinFunction->setArgumentValue(1, sizeof(dstOffset), &dstOffset);
res = appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncRemainderArgs, hSignalEvent);
res = appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncRemainderArgs, hSignalEvent, launchParams);
if (res) {
return res;
}
@@ -1509,7 +1529,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
appendEventForProfilingAllWalkers(hSignalEvent, true);
ze_group_count_t dispatchFuncArgs{groups, 1u, 1u};
res = appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent);
res = appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent, launchParams);
if (res) {
return res;
}
@@ -1539,7 +1559,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
patternGfxAlloc);
builtinFunctionRemainder->setArgumentValue(3, sizeof(patternAllocationSize), &patternAllocationSize);
res = appendLaunchKernelSplit(builtinFunctionRemainder->toHandle(), &dispatchFuncArgs, hSignalEvent);
res = appendLaunchKernelSplit(builtinFunctionRemainder->toHandle(), &dispatchFuncArgs, hSignalEvent, launchParams);
if (res) {
return res;
}
@@ -2035,8 +2055,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendQueryKernelTimestamps(
const size_t *pOffsets, ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) {
auto dstptrAllocationStruct = getAlignedAllocation(this->device, dstptr, sizeof(ze_kernel_timestamp_result_t) * numEvents, false);
commandContainer.addToResidencyContainer(dstptrAllocationStruct.alloc);
auto dstPtrAllocationStruct = getAlignedAllocation(this->device, dstptr, sizeof(ze_kernel_timestamp_result_t) * numEvents, false);
commandContainer.addToResidencyContainer(dstPtrAllocationStruct.alloc);
std::unique_ptr<EventData[]> timestampsData = std::make_unique<EventData[]>(numEvents);
@@ -2104,13 +2124,15 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendQueryKernelTimestamps(
ze_group_count_t dispatchFuncArgs{numEvents / groupSizeX, 1u, 1u};
auto dstValPtr = static_cast<uintptr_t>(dstptrAllocationStruct.alloc->getGpuAddress());
auto dstValPtr = static_cast<uintptr_t>(dstPtrAllocationStruct.alloc->getGpuAddress());
builtinFunction->setArgBufferWithAlloc(0u, static_cast<uintptr_t>(timestampsGPUData->getGpuAddress()), timestampsGPUData);
builtinFunction->setArgBufferWithAlloc(1, dstValPtr, dstptrAllocationStruct.alloc);
builtinFunction->setArgBufferWithAlloc(1, dstValPtr, dstPtrAllocationStruct.alloc);
CmdListKernelLaunchParams launchParams = {};
launchParams.isBuiltInKernel = true;
auto appendResult = appendLaunchKernel(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent, numWaitEvents,
phWaitEvents);
phWaitEvents, launchParams);
if (appendResult != ZE_RESULT_SUCCESS) {
return appendResult;
}

View File

@@ -201,9 +201,8 @@ inline size_t CommandListCoreFamily<gfxCoreFamily>::estimateBufferSizeMultiTileB
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelSplit(ze_kernel_handle_t hKernel,
const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent) {
CmdListKernelLaunchParams launchParams = {};
launchParams.isKernelSplitOperation = true;
ze_event_handle_t hEvent,
const CmdListKernelLaunchParams &launchParams) {
return appendLaunchKernelWithParams(hKernel, pThreadGroupDimensions, nullptr, launchParams);
}

View File

@@ -25,7 +25,8 @@ struct CommandListCoreFamilyImmediate : public CommandListCoreFamily<gfxCoreFami
ze_result_t appendLaunchKernel(ze_kernel_handle_t hKernel,
const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) override;
ze_event_handle_t *phWaitEvents,
const CmdListKernelLaunchParams &launchParams) override;
ze_result_t appendLaunchKernelIndirect(ze_kernel_handle_t hKernel,
const ze_group_count_t *pDispatchArgumentsBuffer,

View File

@@ -150,13 +150,16 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::executeCommandListImm
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendLaunchKernel(
ze_kernel_handle_t hKernel, const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) {
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents,
const CmdListKernelLaunchParams &launchParams) {
if (this->isFlushTaskSubmissionEnabled) {
checkAvailableSpace();
}
auto ret = CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(hKernel, pThreadGroupDimensions,
hSignalEvent, numWaitEvents, phWaitEvents);
hSignalEvent, numWaitEvents, phWaitEvents,
launchParams);
return flushImmediate(ret, true);
}

View File

@@ -346,12 +346,11 @@ inline size_t CommandListCoreFamily<gfxCoreFamily>::estimateBufferSizeMultiTileB
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelSplit(ze_kernel_handle_t hKernel,
const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent) {
ze_event_handle_t hEvent,
const CmdListKernelLaunchParams &launchParams) {
if (hEvent) {
Event::fromHandle(hEvent)->increaseKernelCount();
}
CmdListKernelLaunchParams launchParams = {};
launchParams.isKernelSplitOperation = true;
return appendLaunchKernelWithParams(hKernel, pThreadGroupDimensions, hEvent, launchParams);
}

View File

@@ -26,7 +26,8 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelWithSLMThenL3IsProgrammedWit
EXPECT_LE(0u, kernel->kernelImmData->getDescriptor().kernelAttributes.slmInlineSize);
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();

View File

@@ -108,8 +108,9 @@ GEN9TEST_F(CommandListCreateGen9, GivenDisabledMidThreadPreemptionWhenLaunchingK
auto commandList = whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
EXPECT_EQ(NEO::PreemptionMode::MidThread, commandList->getCommandListPreemptionMode());
CmdListKernelLaunchParams launchParams = {};
commandList->appendLaunchKernel(functionThreadGroup.toHandle(),
&dispatchFunctionArguments, nullptr, 0, nullptr);
&dispatchFunctionArguments, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(NEO::PreemptionMode::ThreadGroup, commandList->getCommandListPreemptionMode());
auto result = commandList->close();
@@ -137,8 +138,9 @@ GEN9TEST_F(CommandListCreateGen9, GivenUsesFencesForReadWriteImagesWhenLaunching
auto commandList = whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
EXPECT_EQ(NEO::PreemptionMode::MidThread, commandList->getCommandListPreemptionMode());
CmdListKernelLaunchParams launchParams = {};
commandList->appendLaunchKernel(functionMidBatch.toHandle(),
&dispatchFunctionArguments, nullptr, 0, nullptr);
&dispatchFunctionArguments, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(NEO::PreemptionMode::MidBatch, commandList->getCommandListPreemptionMode());
auto result = commandList->close();
@@ -171,12 +173,13 @@ GEN9TEST_F(CommandListCreateGen9, WhenCommandListHasLowerPreemptionLevelThenDoNo
auto commandList = whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
EXPECT_EQ(NEO::PreemptionMode::MidThread, commandList->getCommandListPreemptionMode());
CmdListKernelLaunchParams launchParams = {};
commandList->appendLaunchKernel(functionThreadGroup.toHandle(),
&dispatchFunctionArguments, nullptr, 0, nullptr);
&dispatchFunctionArguments, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(NEO::PreemptionMode::ThreadGroup, commandList->getCommandListPreemptionMode());
commandList->appendLaunchKernel(functionMidThread.toHandle(),
&dispatchFunctionArguments, nullptr, 0, nullptr);
&dispatchFunctionArguments, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(NEO::PreemptionMode::ThreadGroup, commandList->getCommandListPreemptionMode());
auto result = commandList->close();

View File

@@ -66,6 +66,18 @@ struct WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>
using BaseClass::updateStreamProperties;
WhiteBox() : ::L0::CommandListCoreFamily<gfxCoreFamily>(BaseClass::defaultNumIddsPerBlock) {}
ze_result_t appendLaunchKernelWithParams(ze_kernel_handle_t hKernel,
const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent,
const CmdListKernelLaunchParams &launchParams) override {
usedKernelLaunchParams = launchParams;
return BaseClass::appendLaunchKernelWithParams(hKernel, pThreadGroupDimensions,
hEvent, launchParams);
}
CmdListKernelLaunchParams usedKernelLaunchParams;
};
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -123,7 +135,8 @@ struct MockCommandList : public CommandList {
(ze_kernel_handle_t hFunction,
const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents));
ze_event_handle_t *phWaitEvents,
const CmdListKernelLaunchParams &launchParams));
ADDMETHOD_NOBASE(appendLaunchCooperativeKernel, ze_result_t, ZE_RESULT_SUCCESS,
(ze_kernel_handle_t hKernel,

View File

@@ -100,6 +100,10 @@ struct Mock<::L0::Kernel> : public WhiteBox<::L0::Kernel> {
using BaseClass = WhiteBox<::L0::Kernel>;
ADDMETHOD_NOBASE(getProperties, ze_result_t, ZE_RESULT_SUCCESS, (ze_kernel_properties_t * pKernelProperties))
ADDMETHOD(setArgRedescribedImage, ze_result_t, true, ZE_RESULT_SUCCESS,
(uint32_t argIndex, ze_image_handle_t argVal),
(argIndex, argVal));
Mock() : BaseClass(nullptr) {
NEO::PatchTokenBinary::KernelFromPatchtokens kernelTokens;
iOpenCL::SKernelBinaryHeaderCommon kernelHeader;

View File

@@ -304,7 +304,8 @@ HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenUseCsrImmediateSubmissi
ze_group_count_t groupCount{1, 1, 1};
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue));
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
}

View File

@@ -49,6 +49,7 @@ struct CmdListHelper {
ze_group_count_t threadGroupDimensions;
const uint32_t *groupSize = nullptr;
uint32_t useOnlyGlobalTimestamp = std::numeric_limits<uint32_t>::max();
bool isBuiltin = false;
};
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -60,7 +61,8 @@ class MockCommandListForAppendLaunchKernel : public WhiteBox<::L0::CommandListCo
const ze_group_count_t *pThreadGroupDimensions,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) override {
ze_event_handle_t *phWaitEvents,
const CmdListKernelLaunchParams &launchParams) override {
const auto kernel = Kernel::fromHandle(hKernel);
cmdListHelper.isaAllocation = kernel->getIsaAllocation();
@@ -81,6 +83,7 @@ class MockCommandListForAppendLaunchKernel : public WhiteBox<::L0::CommandListCo
auto element = arg.as<NEO::ArgDescValue>().elements[0];
auto pDst = ptrOffset(crossThreadData, element.offset);
cmdListHelper.useOnlyGlobalTimestamp = *(uint32_t *)(pDst);
cmdListHelper.isBuiltin = launchParams.isBuiltInKernel;
return ZE_RESULT_SUCCESS;
}
@@ -144,6 +147,8 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime
EXPECT_EQ(1u, commandList.cmdListHelper.threadGroupDimensions.groupCountY);
EXPECT_EQ(1u, commandList.cmdListHelper.threadGroupDimensions.groupCountZ);
EXPECT_TRUE(commandList.cmdListHelper.isBuiltin);
context->freeMem(alloc);
}
@@ -258,6 +263,8 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime
EXPECT_EQ(1u, commandList.cmdListHelper.threadGroupDimensions.groupCountY);
EXPECT_EQ(1u, commandList.cmdListHelper.threadGroupDimensions.groupCountZ);
EXPECT_TRUE(commandList.cmdListHelper.isBuiltin);
context->freeMem(alloc);
}

View File

@@ -10,6 +10,8 @@
#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/mocks/mock_cmdlist.h"
#include "level_zero/core/test/unit_tests/mocks/mock_image.h"
#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h"
namespace L0 {
namespace ult {
@@ -277,5 +279,127 @@ HWTEST2_F(CommandListTest, givenImmediateCommandListWhenAppendMemoryRangesBarrie
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}
HWTEST2_F(CommandListTest, givenComputeCommandListAnd2dRegionWhenMemoryCopyRegionCalledThenBuiltinFlagIsSet, IsAtLeastSkl) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
void *srcPtr = reinterpret_cast<void *>(0x1234);
void *dstPtr = reinterpret_cast<void *>(0x2345);
ze_copy_region_t dstRegion = {4, 4, 0, 2, 2, 1};
ze_copy_region_t srcRegion = {4, 4, 0, 2, 2, 1};
commandList->appendMemoryCopyRegion(dstPtr, &dstRegion, 0, 0, srcPtr, &srcRegion, 0, 0, nullptr, 0, nullptr);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
}
HWTEST2_F(CommandListTest, givenComputeCommandListAnd3dRegionWhenMemoryCopyRegionCalledThenBuiltinFlagIsSet, IsAtLeastSkl) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
void *srcPtr = reinterpret_cast<void *>(0x1234);
void *dstPtr = reinterpret_cast<void *>(0x2345);
ze_copy_region_t dstRegion = {4, 4, 4, 2, 2, 2};
ze_copy_region_t srcRegion = {4, 4, 4, 2, 2, 2};
commandList->appendMemoryCopyRegion(dstPtr, &dstRegion, 0, 0, srcPtr, &srcRegion, 0, 0, nullptr, 0, nullptr);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
}
using ImageSupport = IsNotAnyGfxCores<IGFX_GEN8_CORE, IGFX_XE_HPC_CORE>;
HWTEST2_F(CommandListTest, givenComputeCommandListWhenCopyFromImageToImageTheBuiltinFlagIsSet, ImageSupport) {
auto kernel = device->getBuiltinFunctionsLib()->getImageFunction(ImageBuiltin::CopyImageRegion);
auto mockBuiltinKernel = static_cast<Mock<::L0::Kernel> *>(kernel);
mockBuiltinKernel->setArgRedescribedImageCallBase = false;
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
ze_image_desc_t zeDesc = {};
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
imageHWSrc->initialize(device, &zeDesc);
imageHWDst->initialize(device, &zeDesc);
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
ze_image_region_t dstRegion = {4, 4, 4, 2, 2, 2};
commandList->appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
}
HWTEST2_F(CommandListTest, givenComputeCommandListWhenCopyFromImageToMemoryThenBuiltinFlagIsSet, ImageSupport) {
auto kernel = device->getBuiltinFunctionsLib()->getImageFunction(ImageBuiltin::CopyImageRegion);
auto mockBuiltinKernel = static_cast<Mock<::L0::Kernel> *>(kernel);
mockBuiltinKernel->setArgRedescribedImageCallBase = false;
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
void *dstPtr = reinterpret_cast<void *>(0x1234);
ze_image_desc_t zeDesc = {};
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
auto imageHW = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
imageHW->initialize(device, &zeDesc);
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
commandList->appendImageCopyToMemory(dstPtr, imageHW->toHandle(), &srcRegion, nullptr, 0, nullptr);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
}
HWTEST2_F(CommandListTest, givenComputeCommandListWhenImageCopyFromMemoryThenBuiltinFlagIsSet, ImageSupport) {
auto kernel = device->getBuiltinFunctionsLib()->getImageFunction(ImageBuiltin::CopyImageRegion);
auto mockBuiltinKernel = static_cast<Mock<::L0::Kernel> *>(kernel);
mockBuiltinKernel->setArgRedescribedImageCallBase = false;
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
void *srcPtr = reinterpret_cast<void *>(0x1234);
ze_image_desc_t zeDesc = {};
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
zeDesc.type = ZE_IMAGE_TYPE_3D;
zeDesc.height = 2;
zeDesc.depth = 2;
auto imageHW = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
imageHW->initialize(device, &zeDesc);
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
commandList->appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
}
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyThenBuiltinFlagIsSet, IsAtLeastSkl) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
void *srcPtr = reinterpret_cast<void *>(0x1234);
void *dstPtr = reinterpret_cast<void *>(0x2345);
commandList->appendMemoryCopy(dstPtr, srcPtr, 8, nullptr, 0, nullptr);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isKernelSplitOperation);
}
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryFillThenBuiltinFlagIsSet, IsAtLeastSkl) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
static constexpr size_t allocSize = 4096;
static constexpr size_t patternSize = 8;
uint8_t pattern[patternSize] = {1, 2, 3, 4};
void *dstBuffer = nullptr;
ze_host_mem_alloc_desc_t hostDesc = {};
auto result = context->allocHostMem(&hostDesc, allocSize, allocSize, &dstBuffer);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
commandList->appendMemoryFill(dstBuffer, pattern, patternSize, allocSize, nullptr, 0, nullptr);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isKernelSplitOperation);
context->freeMem(dstBuffer);
}
} // namespace ult
} // namespace L0

View File

@@ -38,7 +38,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithIndirectAllocationsAllowe
ze_group_count_t groupCount{1, 1, 1};
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_TRUE(commandList->hasIndirectAllocationsAllowed());
@@ -53,7 +54,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithIndirectAllocationsNotAll
ze_group_count_t groupCount{1, 1, 1};
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_FALSE(commandList->hasIndirectAllocationsAllowed());
@@ -96,7 +98,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithThreadArbitrationPolicySe
ze_group_count_t groupCount{1, 1, 1};
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_EQ(NEO::ThreadArbitrationPolicy::RoundRobin, commandList->getFinalStreamState().stateComputeMode.threadArbitrationPolicy.value);
@@ -117,7 +120,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithThreadArbitrationPolicySe
ze_group_count_t groupCount{1, 1, 1};
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_EQ(NEO::ThreadArbitrationPolicy::AgeBased, commandList->getFinalStreamState().stateComputeMode.threadArbitrationPolicy.value);
@@ -182,8 +186,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfUsedWhenAppendedToC
ze_group_count_t groupCount{1, 1, 1};
EXPECT_TRUE(kernel->kernelImmData->getDescriptor().kernelAttributes.flags.usesPrintf);
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(1u, commandList->getPrintfFunctionContainer().size());
@@ -197,14 +201,14 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfUsedWhenAppendedToC
ze_group_count_t groupCount{1, 1, 1};
EXPECT_TRUE(kernel->kernelImmData->getDescriptor().kernelAttributes.flags.usesPrintf);
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(1u, commandList->getPrintfFunctionContainer().size());
EXPECT_EQ(kernel.get(), commandList->getPrintfFunctionContainer()[0]);
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(1u, commandList->getPrintfFunctionContainer().size());
}
@@ -225,8 +229,9 @@ HWTEST_F(CommandListAppendLaunchKernel, WhenAppendingMultipleTimesThenSshIsNotDe
auto initialAllocation = ssh->getGraphicsAllocation();
EXPECT_NE(nullptr, initialAllocation);
const_cast<KernelDescriptor::AddressingMode &>(kernel->getKernelDescriptor().kernelAttributes.bufferAddressingMode) = KernelDescriptor::BindfulAndStateless;
CmdListKernelLaunchParams launchParams = {};
for (size_t i = 0; i < sshHeapSize / kernelSshSize + 1; i++) {
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
}
@@ -259,8 +264,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenTimestampEventsWhenAppendingKernel
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);
kernel.toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
@@ -353,8 +359,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelLaunchWithTSEventAndScopeFla
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);
kernel.toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
@@ -382,7 +389,8 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenForcePipeControlPriorToWalkerKeyTh
auto usedSpaceBefore = commandListBase->commandContainer.getCommandStream()->getUsed();
ze_group_count_t groupCount{1, 1, 1};
result = commandListBase->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
result = commandListBase->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandListBase->commandContainer.getCommandStream()->getUsed();
@@ -403,7 +411,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenForcePipeControlPriorToWalkerKeyTh
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
usedSpaceBefore = commandListWithDebugKey->commandContainer.getCommandStream()->getUsed();
result = commandListWithDebugKey->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
result = commandListWithDebugKey->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
usedSpaceAfter = commandListWithDebugKey->commandContainer.getCommandStream()->getUsed();
@@ -438,7 +446,8 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenForcePipeControlPriorToWalkerKeyAn
commandList->commandContainer.getCommandStream()->getSpace(useSize);
ze_group_count_t groupCount{1, 1, 1};
result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto secondBatchBufferAllocation = commandList->commandContainer.getCommandStream()->getGraphicsAllocation();
@@ -467,8 +476,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenCommandListWhenAppendLaunchKernelS
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
EXPECT_EQ(1u, event->getPacketsInUse());
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
for (uint32_t i = 0; i < NEO::TimestampPacketSizeControl::preferredPacketCount + 4; i++) {
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, event->toHandle(), 0, nullptr);
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}
EXPECT_EQ(1u, event->getPacketsInUse());
@@ -586,8 +596,9 @@ HWTEST_F(CommandListAppendLaunchKernel, givenCommandListWhenResetCalledThenState
ASSERT_NE(nullptr, commandListControl->commandContainer.getCommandStream());
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(
kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
result = commandList->close();
@@ -643,8 +654,9 @@ HWTEST_F(CommandListAppendLaunchKernel, WhenAddingKernelsThenResidencyContainerD
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
for (int i = 0; i < 4; ++i) {
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}
@@ -681,7 +693,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenSingleValidWaitEventsThenAddSemapho
ze_event_handle_t hEventHandle = event->toHandle();
ze_group_count_t groupCount{1, 1, 1};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 1, &hEventHandle);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 1, &hEventHandle, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
@@ -741,7 +754,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenMultipleValidWaitEventsThenAddSemap
waitEvents[1] = hEventHandle2;
ze_group_count_t groupCount{1, 1, 1};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 2, waitEvents);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 2, waitEvents, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();

View File

@@ -395,7 +395,8 @@ HWTEST_F(CommandListAppendLaunchKernelSWTags, givenEnableSWTagsWhenAppendLaunchK
auto usedSpaceBefore = cmdStream->getUsed();
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = cmdStream->getUsed();
@@ -981,7 +982,8 @@ struct CmdlistAppendLaunchKernelWithImplicitArgsTests : CmdlistAppendLaunchKerne
indirectHeapAllocation = indirectHeap->getGraphicsAllocation();
ze_group_count_t groupCount{expectedImplicitArgs.groupCountX, expectedImplicitArgs.groupCountY, expectedImplicitArgs.groupCountZ};
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
implicitArgsProgrammingSize = ImplicitArgsHelper::getSizeForImplicitArgsPatching(&expectedImplicitArgs, *kernelDescriptor, neoDevice->getHardwareInfo());
@@ -1125,7 +1127,8 @@ HWTEST_F(CmdlistAppendLaunchKernelTests, givenKernelWithoutImplicitArgsWhenAppen
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ze_group_count_t groupCount = {3, 2, 1};
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto indirectHeap = commandList->commandContainer.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT);
@@ -1162,7 +1165,8 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests, givenKernelWitchScratchAndPrivateWhenA
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ze_group_count_t groupCount = {3, 2, 1};
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(commandList->getCommandListPerThreadPrivateScratchSize(), static_cast<uint32_t>(0x100));
@@ -1330,7 +1334,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, MultiTileCommandListAppendLaunchFunctionXeHpCoreTes
EXPECT_EQ(4u, commandList->partitionCount);
ze_group_count_t groupCount{256, 1, 1};
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, hEventHandle, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, hEventHandle, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(4u, event->getPacketsInUse());

View File

@@ -36,7 +36,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenFunctionWhenBind
ze_group_count_t groupCount{1, 1, 1};
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
auto commandStream = commandList->commandContainer.getCommandStream();
@@ -81,8 +82,9 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenEventsWhenAppend
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);
kernel.toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();
@@ -203,9 +205,10 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendingL
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
result = commandList0->appendLaunchKernel(
kernel->toHandle(),
&groupCount, nullptr, 0, nullptr);
&groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
}
@@ -229,9 +232,10 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendingL
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
result = commandList0->appendLaunchKernel(
kernel->toHandle(),
&groupCount, nullptr, 1, nullptr);
&groupCount, nullptr, 1, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, result);
}

View File

@@ -254,7 +254,8 @@ HWTEST_F(CommandQueueCreate, given100CmdListsWhenExecutingThenCommandStreamIsNot
ASSERT_NE(nullptr, commandList);
ze_group_count_t dispatchFunctionArguments{1, 1, 1};
commandList->appendLaunchKernel(kernel.toHandle(), &dispatchFunctionArguments, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
commandList->appendLaunchKernel(kernel.toHandle(), &dispatchFunctionArguments, nullptr, 0, nullptr, launchParams);
const size_t numHandles = 100;
ze_command_list_handle_t cmdListHandles[numHandles];
@@ -292,7 +293,8 @@ HWTEST2_F(CommandQueueCreate, givenGpuHangInReservingLinearStreamWhenExecutingCo
ASSERT_NE(nullptr, commandList);
ze_group_count_t dispatchFunctionArguments{1, 1, 1};
commandList->appendLaunchKernel(kernel.toHandle(), &dispatchFunctionArguments, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
commandList->appendLaunchKernel(kernel.toHandle(), &dispatchFunctionArguments, nullptr, 0, nullptr, launchParams);
ze_command_list_handle_t cmdListHandles[1] = {commandList->toHandle()};
@@ -875,11 +877,13 @@ HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandL
EXPECT_TRUE(kernel->getUnifiedMemoryControls().indirectDeviceAllocationsAllowed);
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel->toHandle(),
&groupCount,
nullptr,
0,
nullptr);
nullptr,
launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto itorEvent = std::find(std::begin(commandList->commandContainer.getResidencyContainer()),
@@ -937,11 +941,13 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDebugModeToTreatIndirectAllocatio
EXPECT_TRUE(kernel->getUnifiedMemoryControls().indirectDeviceAllocationsAllowed);
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel->toHandle(),
&groupCount,
nullptr,
0,
nullptr);
nullptr,
launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto itorEvent = std::find(std::begin(commandList->commandContainer.getResidencyContainer()),
@@ -998,11 +1004,13 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDeviceThatSupportsSubmittingIndir
EXPECT_TRUE(kernel->getUnifiedMemoryControls().indirectDeviceAllocationsAllowed);
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel->toHandle(),
&groupCount,
nullptr,
0,
nullptr);
nullptr,
launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto itorEvent = std::find(std::begin(commandList->commandContainer.getResidencyContainer()),
@@ -1062,11 +1070,13 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDeviceThatSupportsSubmittingIndir
static_cast<MockMemoryManager *>(driverHandle->getMemoryManager())->overrideAllocateAsPackReturn = 1u;
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel->toHandle(),
&groupCount,
nullptr,
0,
nullptr);
nullptr,
launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_TRUE(gpuAlloc->isResident(csr.getOsContext().getContextId()));
@@ -1112,11 +1122,13 @@ HWTEST_F(CommandQueueIndirectAllocations, givenImmediateCommandListAndFlushTaskW
static_cast<MockMemoryManager *>(driverHandle->getMemoryManager())->overrideAllocateAsPackReturn = 1u;
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel->toHandle(),
&groupCount,
nullptr,
0,
nullptr);
nullptr,
launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
device->getDriverHandle()->getSvmAllocsManager()->freeSVMAlloc(deviceAlloc);

View File

@@ -745,7 +745,8 @@ HWTEST2_F(DeviceWithDualStorage, givenCmdListWithAppendedKernelAndUsmTransferAnd
kernel.residencyContainer.push_back(gpuAlloc);
ze_group_count_t dispatchFunctionArguments{1, 1, 1};
commandList->appendLaunchKernel(kernel.toHandle(), &dispatchFunctionArguments, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
commandList->appendLaunchKernel(kernel.toHandle(), &dispatchFunctionArguments, nullptr, 0, nullptr, launchParams);
auto deviceImp = static_cast<DeviceImp *>(device);
auto pageFaultCmdQueue = whiteboxCast(deviceImp->pageFaultCommandList->cmdQImmediate);

View File

@@ -208,7 +208,8 @@ HWTEST_F(L0DebuggerTest, givenDebuggerWhenAppendingKernelToCommandListThenBindle
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
ze_group_count_t groupCount{1, 1, 1};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
commandList->close();
@@ -237,7 +238,8 @@ HWTEST_F(L0DebuggerTest, givenDebuggerWhenAppendingKernelToCommandListThenDebugS
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
ze_group_count_t groupCount{1, 1, 1};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
commandList->close();

View File

@@ -127,7 +127,8 @@ HWTEST_F(L0DebuggerWithBlitterTest, givenImmediateCommandListWhenExecutingWithFl
EXPECT_EQ(&csr, commandList->csr);
csr.lastFlushedCommandStream = nullptr;
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, csr.lastFlushedCommandStream);
@@ -185,7 +186,8 @@ HWTEST_F(L0DebuggerWithBlitterTest, givenInternalUsageImmediateCommandListWhenEx
auto &csr = reinterpret_cast<NEO::UltCommandStreamReceiver<FamilyType> &>(*commandList->csr);
csr.storeMakeResidentAllocations = true;
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
auto sbaBuffer = device->getL0Debugger()->getSbaTrackingBuffer(commandList->csr->getOsContext().getContextId());

View File

@@ -727,7 +727,8 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenEventWhenInvokingAppendLaunchKerne
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
ze_group_count_t groupCount{1, 1, 1};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, event->toHandle(), 0, nullptr);
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();
@@ -774,7 +775,8 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenTimestampEventWhenInvokingAppendLa
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
ze_group_count_t groupCount{1, 1, 1};
auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, event->toHandle(), 0, nullptr);
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();

View File

@@ -412,7 +412,8 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpgCore, givenEventWhenAppendKernelIsCa
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed();
result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, event->toHandle(), 0, nullptr);
CmdListKernelLaunchParams launchParams = {};
result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed();