Skip to content

Commit f17f45d

Browse files
feature: initial support for patching region params
Related-To: NEO-8070 Signed-off-by: Dunajski, Bartosz <[email protected]>
1 parent 27b988b commit f17f45d

File tree

8 files changed

+41
-17
lines changed

8 files changed

+41
-17
lines changed

level_zero/core/source/cmdlist/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ target_sources(${L0_STATIC_LIB_NAME}
1616
${CMAKE_CURRENT_SOURCE_DIR}/cmdlist_imp.h
1717
${CMAKE_CURRENT_SOURCE_DIR}/cmdlist_hw_immediate.h
1818
${CMAKE_CURRENT_SOURCE_DIR}/cmdlist_hw_immediate.inl
19+
${CMAKE_CURRENT_SOURCE_DIR}/cmdlist_launch_params.h
1920
${CMAKE_CURRENT_SOURCE_DIR}/cmdlist_extended${BRANCH_DIR_SUFFIX}cmdlist_extended.inl
2021
)
2122

level_zero/core/source/cmdlist/cmdlist.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "shared/source/unified_memory/unified_memory.h"
1919
#include "shared/source/utilities/stackvec.h"
2020

21+
#include "level_zero/core/source/cmdlist/cmdlist_launch_params.h"
2122
#include <level_zero/ze_api.h>
2223
#include <level_zero/zet_api.h>
2324

@@ -34,23 +35,6 @@ struct Event;
3435
struct Kernel;
3536
struct CommandQueue;
3637

37-
struct CmdListKernelLaunchParams {
38-
NEO::RequiredPartitionDim requiredPartitionDim = NEO::RequiredPartitionDim::none;
39-
NEO::RequiredDispatchWalkOrder requiredDispatchWalkOrder = NEO::RequiredDispatchWalkOrder::none;
40-
uint32_t additionalSizeParam = NEO::additionalKernelLaunchSizeParamNotSet;
41-
uint32_t numKernelsInSplitLaunch = 0;
42-
uint32_t numKernelsExecutedInSplitLaunch = 0;
43-
bool isIndirect = false;
44-
bool isPredicate = false;
45-
bool isCooperative = false;
46-
bool isKernelSplitOperation = false;
47-
bool isBuiltInKernel = false;
48-
bool isDestinationAllocationInSystemMemory = false;
49-
bool isHostSignalScopeEvent = false;
50-
bool skipInOrderNonWalkerSignaling = false;
51-
bool pipeControlSignalling = false;
52-
};
53-
5438
struct CmdListReturnPoint {
5539
NEO::StreamProperties configSnapshot;
5640
uint64_t gpuAddress = 0;

level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
163163
auto kernelPreemptionMode = obtainKernelPreemptionMode(kernel);
164164

165165
kernel->patchGlobalOffset();
166+
kernel->patchRegionParams(launchParams);
166167
this->allocateOrReuseKernelPrivateMemoryIfNeeded(kernel, kernelDescriptor.kernelAttributes.perHwThreadPrivateMemorySize);
167168

168169
if (launchParams.isIndirect) {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (C) 2023 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include "shared/source/helpers/definitions/command_encoder_args.h"
11+
12+
#include <cstdint>
13+
14+
namespace L0 {
15+
struct CmdListKernelLaunchParams {
16+
NEO::RequiredPartitionDim requiredPartitionDim = NEO::RequiredPartitionDim::none;
17+
NEO::RequiredDispatchWalkOrder requiredDispatchWalkOrder = NEO::RequiredDispatchWalkOrder::none;
18+
uint32_t additionalSizeParam = NEO::additionalKernelLaunchSizeParamNotSet;
19+
uint32_t numKernelsInSplitLaunch = 0;
20+
uint32_t numKernelsExecutedInSplitLaunch = 0;
21+
bool isIndirect = false;
22+
bool isPredicate = false;
23+
bool isCooperative = false;
24+
bool isKernelSplitOperation = false;
25+
bool isBuiltInKernel = false;
26+
bool isDestinationAllocationInSystemMemory = false;
27+
bool isHostSignalScopeEvent = false;
28+
bool skipInOrderNonWalkerSignaling = false;
29+
bool pipeControlSignalling = false;
30+
};
31+
} // namespace L0

level_zero/core/source/kernel/kernel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class MemoryManager;
3030
namespace L0 {
3131
struct Device;
3232
struct Module;
33+
struct CmdListKernelLaunchParams;
3334

3435
struct KernelImmutableData {
3536
KernelImmutableData(L0::Device *l0device = nullptr);
@@ -137,6 +138,7 @@ struct Kernel : _ze_kernel_handle_t, virtual NEO::DispatchKernelEncoderI {
137138
virtual uint32_t *getGlobalOffsets() = 0;
138139
virtual ze_result_t setGlobalOffsetExp(uint32_t offsetX, uint32_t offsetY, uint32_t offsetZ) = 0;
139140
virtual void patchGlobalOffset() = 0;
141+
virtual void patchRegionParams(const CmdListKernelLaunchParams &launchParams) = 0;
140142

141143
virtual ze_result_t suggestMaxCooperativeGroupCount(uint32_t *totalGroupCount, NEO::EngineGroupType engineGroupType,
142144
bool isEngineInstanced) = 0;

level_zero/core/source/kernel/kernel_imp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct KernelImp : Kernel {
5858
ze_result_t setArgumentValue(uint32_t argIndex, size_t argSize, const void *pArgValue) override;
5959

6060
void setGroupCount(uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) override;
61+
void patchRegionParams(const CmdListKernelLaunchParams &launchParams) override;
6162

6263
ze_result_t setGroupSize(uint32_t groupSizeX, uint32_t groupSizeY,
6364
uint32_t groupSizeZ) override;

level_zero/core/source/kernel/kernel_imp_helper.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
*/
77

8+
#include "level_zero/core/source/cmdlist/cmdlist_launch_params.h"
89
#include "level_zero/core/source/kernel/kernel_imp.h"
910

1011
namespace L0 {
@@ -13,4 +14,6 @@ KernelExt *KernelImp::getExtension(uint32_t extensionType) { return nullptr; }
1314

1415
void KernelImp::getExtendedKernelProperties(ze_base_desc_t *pExtendedProperties) {}
1516

17+
void KernelImp::patchRegionParams(const CmdListKernelLaunchParams &launchParams) {}
18+
1619
} // namespace L0

level_zero/core/test/unit_tests/fixtures/module_fixture.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct ModuleImmutableDataFixture : public DeviceFixture {
8888
using KernelImp::kernelRequiresUncachedMocsCount;
8989
using KernelImp::midThreadPreemptionDisallowedForRayTracingKernels;
9090
using KernelImp::patchBindlessOffsetsInCrossThreadData;
91+
using KernelImp::pImplicitArgs;
9192
using KernelImp::printfBuffer;
9293
using KernelImp::privateMemoryGraphicsAllocation;
9394
using KernelImp::requiredWorkgroupOrder;

0 commit comments

Comments
 (0)