Skip to content

Commit 794b21a

Browse files
refactor: Add extra parameters to computeSlmValues function
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
1 parent b7d21b1 commit 794b21a

17 files changed

+53
-36
lines changed

opencl/source/helpers/hardware_commands_helper_base.inl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ size_t HardwareCommandsHelper<GfxFamily>::sendInterfaceDescriptorData(
177177

178178
const auto &hardwareInfo = device.getHardwareInfo();
179179
auto &gfxCoreHelper = device.getGfxCoreHelper();
180-
auto programmableIDSLMSize = EncodeDispatchKernel<GfxFamily>::computeSlmValues(hardwareInfo, slmTotalSize);
180+
auto releaseHelper = device.getReleaseHelper();
181+
auto programmableIDSLMSize = EncodeDispatchKernel<GfxFamily>::computeSlmValues(hardwareInfo, slmTotalSize, releaseHelper, heaplessModeEnabled);
181182

182183
if (debugManager.flags.OverrideSlmAllocationSize.get() != -1) {
183184
programmableIDSLMSize = static_cast<uint32_t>(debugManager.flags.OverrideSlmAllocationSize.get());

shared/source/command_container/command_encoder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class GmmHelper;
2929
class IndirectHeap;
3030
class InOrderExecInfo;
3131
class ProductHelper;
32+
class ReleaseHelper;
3233

3334
struct DeviceInfo;
3435
struct DispatchKernelEncoderI;
@@ -229,7 +230,7 @@ struct EncodeDispatchKernel {
229230
static void forceComputeWalkerPostSyncFlushWithWrite(WalkerType &walkerCmd);
230231

231232
static uint32_t alignSlmSize(uint32_t slmSize);
232-
static uint32_t computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize);
233+
static uint32_t computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize, ReleaseHelper *releaseHelper, bool isHeapless);
233234

234235
static bool singleTileExecImplicitScalingRequired(bool cooperativeKernel);
235236

shared/source/command_container/command_encoder_xehp_and_later.inl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
115115

116116
EncodeDispatchKernel<Family>::encodeEuSchedulingPolicy(&idd, kernelDescriptor, args.defaultPipelinedThreadArbitrationPolicy);
117117

118-
auto slmSize = EncodeDispatchKernel<Family>::computeSlmValues(hwInfo, args.dispatchInterface->getSlmTotalSize());
118+
auto releaseHelper = rootDeviceEnvironment.getReleaseHelper();
119+
auto slmSize = EncodeDispatchKernel<Family>::computeSlmValues(hwInfo, args.dispatchInterface->getSlmTotalSize(), releaseHelper, heaplessModeEnabled);
119120

120121
if (debugManager.flags.OverrideSlmAllocationSize.get() != -1) {
121122
slmSize = static_cast<uint32_t>(debugManager.flags.OverrideSlmAllocationSize.get());
@@ -953,7 +954,7 @@ uint32_t EncodeDispatchKernel<Family>::alignSlmSize(uint32_t slmSize) {
953954
}
954955

955956
template <typename Family>
956-
uint32_t EncodeDispatchKernel<Family>::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize) {
957+
uint32_t EncodeDispatchKernel<Family>::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize, ReleaseHelper *releaseHelper, bool isHeapless) {
957958
using SHARED_LOCAL_MEMORY_SIZE = typename Family::INTERFACE_DESCRIPTOR_DATA::SHARED_LOCAL_MEMORY_SIZE;
958959

959960
if (slmSize == 0u) {

shared/source/gen12lp/command_encoder_gen12lp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
104104
EncodeDispatchKernel<Family>::programBarrierEnable(idd,
105105
kernelDescriptor,
106106
hwInfo);
107-
auto slmSize = EncodeDispatchKernel<Family>::computeSlmValues(hwInfo, args.dispatchInterface->getSlmTotalSize());
107+
auto slmSize = EncodeDispatchKernel<Family>::computeSlmValues(hwInfo, args.dispatchInterface->getSlmTotalSize(), nullptr, false);
108108
idd.setSharedLocalMemorySize(slmSize);
109109

110110
uint32_t bindingTableStateCount = kernelDescriptor.payloadMappings.bindingTable.numEntries;
@@ -631,7 +631,7 @@ uint32_t EncodeDispatchKernel<Family>::alignSlmSize(uint32_t slmSize) {
631631
}
632632

633633
template <typename Family>
634-
uint32_t EncodeDispatchKernel<Family>::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize) {
634+
uint32_t EncodeDispatchKernel<Family>::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize, ReleaseHelper *releaseHelper, bool isHeapless) {
635635
auto value = std::max(slmSize, 1024u);
636636
value = Math::nextPowerOfTwo(value);
637637
value = Math::getMinLsbSet(value);

shared/source/helpers/gfx_core_helper.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct RootDeviceEnvironment;
4545
struct PipeControlArgs;
4646
struct KernelDescriptor;
4747
class ProductHelper;
48+
class ReleaseHelper;
4849
class GfxCoreHelper;
4950
class AILConfiguration;
5051

@@ -101,7 +102,7 @@ class GfxCoreHelper {
101102
virtual uint32_t calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) const = 0;
102103
virtual uint32_t calculateMaxWorkGroupSize(const KernelDescriptor &kernelDescriptor, uint32_t defaultMaxGroupSize) const = 0;
103104
virtual uint32_t alignSlmSize(uint32_t slmSize) const = 0;
104-
virtual uint32_t computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize) const = 0;
105+
virtual uint32_t computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize, ReleaseHelper *releaseHelper, bool isHeapless) const = 0;
105106

106107
virtual bool isWaDisableRccRhwoOptimizationRequired() const = 0;
107108
virtual uint32_t getMinimalSIMDSize() const = 0;
@@ -313,7 +314,7 @@ class GfxCoreHelperHw : public GfxCoreHelper {
313314

314315
uint32_t alignSlmSize(uint32_t slmSize) const override;
315316

316-
uint32_t computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize) const override;
317+
uint32_t computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize, ReleaseHelper *releaseHelper, bool isHeapless) const override;
317318

318319
static AuxTranslationMode getAuxTranslationMode(const HardwareInfo &hwInfo);
319320

shared/source/helpers/gfx_core_helper_base.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ uint32_t GfxCoreHelperHw<GfxFamily>::alignSlmSize(uint32_t slmSize) const {
406406
}
407407

408408
template <typename GfxFamily>
409-
uint32_t GfxCoreHelperHw<GfxFamily>::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize) const {
410-
return EncodeDispatchKernel<GfxFamily>::computeSlmValues(hwInfo, slmSize);
409+
uint32_t GfxCoreHelperHw<GfxFamily>::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize, ReleaseHelper *releaseHelper, bool isHeapless) const {
410+
return EncodeDispatchKernel<GfxFamily>::computeSlmValues(hwInfo, slmSize, releaseHelper, isHeapless);
411411
}
412412

413413
template <typename GfxFamily>

shared/source/release_helper/release_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class ReleaseHelper {
6363
virtual const SizeToPreferredSlmValueArray &getSizeToPreferredSlmValue(bool isHeapless) const = 0;
6464
virtual bool isNumRtStacksPerDssFixedValue() const = 0;
6565
virtual bool getFtrXe2Compression() const = 0;
66+
virtual uint32_t computeSlmValues(uint32_t slmSize, bool isHeapless) const = 0;
6667

6768
protected:
6869
ReleaseHelper(HardwareIpVersion hardwareIpVersion) : hardwareIpVersion(hardwareIpVersion) {}
@@ -105,6 +106,7 @@ class ReleaseHelperHw : public ReleaseHelper {
105106
const SizeToPreferredSlmValueArray &getSizeToPreferredSlmValue(bool isHeapless) const override;
106107
bool isNumRtStacksPerDssFixedValue() const override;
107108
bool getFtrXe2Compression() const override;
109+
uint32_t computeSlmValues(uint32_t slmSize, bool isHeapless) const override;
108110

109111
protected:
110112
ReleaseHelperHw(HardwareIpVersion hardwareIpVersion) : ReleaseHelper(hardwareIpVersion) {}

shared/source/release_helper/release_helper_base.inl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,10 @@ template <ReleaseType releaseType>
162162
bool ReleaseHelperHw<releaseType>::getFtrXe2Compression() const {
163163
return true;
164164
}
165+
166+
template <ReleaseType releaseType>
167+
uint32_t ReleaseHelperHw<releaseType>::computeSlmValues(uint32_t slmSize, bool isHeapless) const {
168+
return 0u;
169+
}
170+
165171
} // namespace NEO

shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ uint32_t EncodeDispatchKernel<Family>::alignSlmSize(uint32_t slmSize) {
144144
}
145145

146146
template <>
147-
uint32_t EncodeDispatchKernel<Family>::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize) {
147+
uint32_t EncodeDispatchKernel<Family>::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize, ReleaseHelper *releaseHelper, bool isHeapless) {
148148
auto slmValue = std::max(slmSize, 1024u);
149149
slmValue = Math::nextPowerOfTwo(slmValue);
150150
slmValue = Math::getMinLsbSet(slmValue);

shared/test/common/mocks/mock_release_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class MockReleaseHelper : public ReleaseHelper {
4242
ADDMETHOD_CONST_NOBASE(isNumRtStacksPerDssFixedValue, bool, true, ());
4343
ADDMETHOD_CONST_NOBASE(getFtrXe2Compression, bool, false, ());
4444
ADDMETHOD_CONST_NOBASE(isDirectSubmissionLightSupported, bool, false, ());
45+
ADDMETHOD_CONST_NOBASE(computeSlmValues, uint32_t, {}, (uint32_t slmSize, bool isHeapless));
4546

4647
const SizeToPreferredSlmValueArray &getSizeToPreferredSlmValue(bool isHeapless) const override {
4748
static SizeToPreferredSlmValueArray sizeToPreferredSlmValue = {};

0 commit comments

Comments
 (0)