Skip to content

Commit 4fa5041

Browse files
Add inline directive to smallest functions
Signed-off-by: Zbigniew Zdanowicz <[email protected]>
1 parent 8abbc69 commit 4fa5041

File tree

10 files changed

+40
-46
lines changed

10 files changed

+40
-46
lines changed

opencl/test/unit_test/helpers/timestamp_packet_tests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct TimestampPacketTests : public TimestampPacketSimpleTests {
8383
auto writeAddress = TimestampPacketHelper::getGpuDependenciesCountGpuAddress(*timestampPacketNode);
8484

8585
EXPECT_EQ(MI_ATOMIC::ATOMIC_OPCODES::ATOMIC_4B_INCREMENT, miAtomicCmd->getAtomicOpcode());
86-
EXPECT_EQ(writeAddress, UnitTestHelper<GfxFamily>::getMemoryAddress(*miAtomicCmd));
86+
EXPECT_EQ(writeAddress, UnitTestHelper<GfxFamily>::getAtomicMemoryAddress(*miAtomicCmd));
8787
};
8888

8989
void verifyDependencyCounterValues(TimestampPacketContainer *timestampPacketContainer, uint32_t expectedValue) {

opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenWriteBufferEnqueueWhenProgrammingCommand
527527
miAtomicsCount++;
528528
auto dataAddress = TimestampPacketHelper::getGpuDependenciesCountGpuAddress(*timestampPacketNode);
529529
EXPECT_EQ(MI_ATOMIC::ATOMIC_OPCODES::ATOMIC_4B_INCREMENT, miAtomicCmd->getAtomicOpcode());
530-
EXPECT_EQ(dataAddress, UnitTestHelper<FamilyType>::getMemoryAddress(*miAtomicCmd));
530+
EXPECT_EQ(dataAddress, UnitTestHelper<FamilyType>::getAtomicMemoryAddress(*miAtomicCmd));
531531
EXPECT_EQ(1u, semaphoresCount);
532532
}
533533
}
@@ -572,7 +572,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenReadBufferEnqueueWhenProgrammingCommandS
572572
miAtomicsCount++;
573573
auto dataAddress = TimestampPacketHelper::getGpuDependenciesCountGpuAddress(*timestampPacketNode);
574574
EXPECT_EQ(MI_ATOMIC::ATOMIC_OPCODES::ATOMIC_4B_INCREMENT, miAtomicCmd->getAtomicOpcode());
575-
EXPECT_EQ(dataAddress, UnitTestHelper<FamilyType>::getMemoryAddress(*miAtomicCmd));
575+
EXPECT_EQ(dataAddress, UnitTestHelper<FamilyType>::getAtomicMemoryAddress(*miAtomicCmd));
576576
EXPECT_EQ(1u, semaphoresCount);
577577
}
578578
}

shared/source/command_container/command_encoder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ struct EncodeAtomic {
332332
uint32_t operand1dword1);
333333

334334
static void setMiAtomicAddress(MI_ATOMIC &atomic, uint64_t writeAddress);
335-
static uint64_t getMiAtomicAddress(MI_ATOMIC &atomic);
336335
};
337336

338337
template <typename GfxFamily>

shared/source/command_container/command_encoder.inl

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ uint32_t EncodeStates<Family>::copySamplerState(IndirectHeap *dsh,
8484
} // namespace NEO
8585

8686
template <typename Family>
87-
size_t EncodeStates<Family>::getAdjustStateComputeModeSize() {
87+
inline size_t EncodeStates<Family>::getAdjustStateComputeModeSize() {
8888
return 0;
8989
}
9090

@@ -424,7 +424,7 @@ size_t EncodeSurfaceState<Family>::pushBindingTableAndSurfaceStates(IndirectHeap
424424
}
425425

426426
template <typename Family>
427-
void EncodeSurfaceState<Family>::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const HardwareInfo &hwInfo) {}
427+
inline void EncodeSurfaceState<Family>::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const HardwareInfo &hwInfo) {}
428428

429429
template <typename Family>
430430
void EncodeSurfaceState<Family>::setImageAuxParamsForCCS(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
@@ -528,17 +528,17 @@ void EncodeIndirectParams<Family>::setGlobalWorkSizeIndirect(CommandContainer &c
528528
}
529529

530530
template <typename Family>
531-
size_t EncodeIndirectParams<Family>::getCmdsSizeForIndirectParams() {
531+
inline size_t EncodeIndirectParams<Family>::getCmdsSizeForIndirectParams() {
532532
return 3 * sizeof(typename Family::MI_LOAD_REGISTER_MEM);
533533
}
534534

535535
template <typename Family>
536-
size_t EncodeIndirectParams<Family>::getCmdsSizeForSetGroupCountIndirect() {
536+
inline size_t EncodeIndirectParams<Family>::getCmdsSizeForSetGroupCountIndirect() {
537537
return 3 * (sizeof(MI_STORE_REGISTER_MEM));
538538
}
539539

540540
template <typename Family>
541-
size_t EncodeIndirectParams<Family>::getCmdsSizeForSetGroupSizeIndirect() {
541+
inline size_t EncodeIndirectParams<Family>::getCmdsSizeForSetGroupSizeIndirect() {
542542
return 3 * (sizeof(MI_LOAD_REGISTER_REG) + sizeof(MI_LOAD_REGISTER_IMM) + sizeof(MI_MATH) + sizeof(MI_MATH_ALU_INST_INLINE) + sizeof(MI_STORE_REGISTER_MEM));
543543
}
544544

@@ -565,22 +565,16 @@ void EncodeSempahore<Family>::addMiSemaphoreWaitCommand(LinearStream &commandStr
565565
}
566566

567567
template <typename Family>
568-
size_t EncodeSempahore<Family>::getSizeMiSemaphoreWait() {
568+
inline size_t EncodeSempahore<Family>::getSizeMiSemaphoreWait() {
569569
return sizeof(MI_SEMAPHORE_WAIT);
570570
}
571571

572572
template <typename Family>
573-
void EncodeAtomic<Family>::setMiAtomicAddress(MI_ATOMIC &atomic, uint64_t writeAddress) {
573+
inline void EncodeAtomic<Family>::setMiAtomicAddress(MI_ATOMIC &atomic, uint64_t writeAddress) {
574574
atomic.setMemoryAddress(static_cast<uint32_t>(writeAddress & 0x0000FFFFFFFFULL));
575575
atomic.setMemoryAddressHigh(static_cast<uint32_t>(writeAddress >> 32));
576576
}
577577

578-
template <typename Family>
579-
uint64_t EncodeAtomic<Family>::getMiAtomicAddress(MI_ATOMIC &atomic) {
580-
uint64_t address = (static_cast<uint64_t>(atomic.getMemoryAddressHigh()) << 32) | (atomic.getMemoryAddress());
581-
return address;
582-
}
583-
584578
template <typename Family>
585579
void EncodeAtomic<Family>::programMiAtomic(MI_ATOMIC *atomic,
586580
uint64_t writeAddress,
@@ -663,10 +657,10 @@ size_t EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite() {
663657
}
664658

665659
template <typename GfxFamily>
666-
void EncodeMemoryPrefetch<GfxFamily>::programMemoryPrefetch(LinearStream &commandStream, const GraphicsAllocation &graphicsAllocation, uint32_t size, size_t offset, const HardwareInfo &hwInfo) {}
660+
inline void EncodeMemoryPrefetch<GfxFamily>::programMemoryPrefetch(LinearStream &commandStream, const GraphicsAllocation &graphicsAllocation, uint32_t size, size_t offset, const HardwareInfo &hwInfo) {}
667661

668662
template <typename GfxFamily>
669-
size_t EncodeMemoryPrefetch<GfxFamily>::getSizeForMemoryPrefetch(size_t size) { return 0u; }
663+
inline size_t EncodeMemoryPrefetch<GfxFamily>::getSizeForMemoryPrefetch(size_t size) { return 0u; }
670664

671665
template <typename Family>
672666
void EncodeMiArbCheck<Family>::program(LinearStream &commandStream) {
@@ -675,6 +669,6 @@ void EncodeMiArbCheck<Family>::program(LinearStream &commandStream) {
675669
}
676670

677671
template <typename Family>
678-
size_t EncodeMiArbCheck<Family>::getCommandSize() { return sizeof(MI_ARB_CHECK); }
672+
inline size_t EncodeMiArbCheck<Family>::getCommandSize() { return sizeof(MI_ARB_CHECK); }
679673

680674
} // namespace NEO

shared/source/command_container/command_encoder_bdw_plus.inl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ void EncodeMediaInterfaceDescriptorLoad<Family>::encode(CommandContainer &contai
245245
}
246246

247247
template <typename Family>
248-
bool EncodeDispatchKernel<Family>::isRuntimeLocalIdsGenerationRequired(uint32_t activeChannels,
249-
size_t *lws,
250-
std::array<uint8_t, 3> walkOrder,
251-
bool requireInputWalkOrder,
252-
uint32_t &requiredWalkOrder,
253-
uint32_t simd) {
248+
inline bool EncodeDispatchKernel<Family>::isRuntimeLocalIdsGenerationRequired(uint32_t activeChannels,
249+
size_t *lws,
250+
std::array<uint8_t, 3> walkOrder,
251+
bool requireInputWalkOrder,
252+
uint32_t &requiredWalkOrder,
253+
uint32_t simd) {
254254
requiredWalkOrder = 0u;
255255
return true;
256256
}
@@ -312,7 +312,7 @@ void EncodeDispatchKernel<Family>::programBarrierEnable(INTERFACE_DESCRIPTOR_DAT
312312
}
313313

314314
template <typename Family>
315-
void EncodeDispatchKernel<Family>::encodeAdditionalWalkerFields(const HardwareInfo &hwInfo, WALKER_TYPE &walkerCmd) {}
315+
inline void EncodeDispatchKernel<Family>::encodeAdditionalWalkerFields(const HardwareInfo &hwInfo, WALKER_TYPE &walkerCmd) {}
316316

317317
template <typename Family>
318318
void EncodeDispatchKernel<Family>::appendAdditionalIDDFields(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, const HardwareInfo &hwInfo, const uint32_t threadsPerThreadGroup, uint32_t slmTotalSize, SlmPolicy slmPolicy) {}
@@ -340,11 +340,11 @@ size_t EncodeDispatchKernel<Family>::estimateEncodeDispatchKernelCmdsSize(Device
340340
}
341341

342342
template <typename Family>
343-
void EncodeComputeMode<Family>::adjustComputeMode(LinearStream &csr, void *const stateComputeModePtr, StateComputeModeProperties &properties) {
343+
inline void EncodeComputeMode<Family>::adjustComputeMode(LinearStream &csr, void *const stateComputeModePtr, StateComputeModeProperties &properties) {
344344
}
345345

346346
template <typename Family>
347-
void EncodeComputeMode<Family>::adjustPipelineSelect(CommandContainer &container, const NEO::KernelDescriptor &kernelDescriptor) {
347+
inline void EncodeComputeMode<Family>::adjustPipelineSelect(CommandContainer &container, const NEO::KernelDescriptor &kernelDescriptor) {
348348
}
349349

350350
template <typename Family>
@@ -412,8 +412,8 @@ inline size_t EncodeWA<GfxFamily>::getAdditionalPipelineSelectSize(Device &devic
412412
}
413413

414414
template <typename GfxFamily>
415-
void EncodeSurfaceState<GfxFamily>::encodeExtraBufferParams(R_SURFACE_STATE *surfaceState, GraphicsAllocation *allocation, GmmHelper *gmmHelper,
416-
bool isReadOnly, uint32_t numAvailableDevices, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
415+
inline void EncodeSurfaceState<GfxFamily>::encodeExtraBufferParams(R_SURFACE_STATE *surfaceState, GraphicsAllocation *allocation, GmmHelper *gmmHelper,
416+
bool isReadOnly, uint32_t numAvailableDevices, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
417417
encodeExtraCacheSettings(surfaceState, *gmmHelper->getHardwareInfo());
418418
}
419419

@@ -423,7 +423,7 @@ bool EncodeSurfaceState<GfxFamily>::doBindingTablePrefetch() {
423423
}
424424

425425
template <typename Family>
426-
void EncodeSurfaceState<Family>::setCoherencyType(R_SURFACE_STATE *surfaceState, COHERENCY_TYPE coherencyType) {
426+
inline void EncodeSurfaceState<Family>::setCoherencyType(R_SURFACE_STATE *surfaceState, COHERENCY_TYPE coherencyType) {
427427
surfaceState->setCoherencyType(coherencyType);
428428
}
429429

shared/source/command_container/encode_compute_mode_bdw_plus.inl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@
1111

1212
namespace NEO {
1313
template <typename Family>
14-
void EncodeStates<Family>::adjustStateComputeMode(LinearStream &csr, uint32_t numGrfRequired, void *const stateComputeModePtr,
15-
bool isMultiOsContextCapable, bool requiresCoherency, bool useGlobalAtomics,
16-
bool areMultipleSubDevicesInContext, uint32_t threadArbitrationPolicy) {
14+
inline void EncodeStates<Family>::adjustStateComputeMode(LinearStream &csr, uint32_t numGrfRequired, void *const stateComputeModePtr,
15+
bool isMultiOsContextCapable, bool requiresCoherency, bool useGlobalAtomics,
16+
bool areMultipleSubDevicesInContext, uint32_t threadArbitrationPolicy) {
1717
}
1818

1919
template <typename Family>
20-
void EncodeStoreMMIO<Family>::remapOffset(MI_STORE_REGISTER_MEM *pStoreRegMem) {
20+
inline void EncodeStoreMMIO<Family>::remapOffset(MI_STORE_REGISTER_MEM *pStoreRegMem) {
2121
}
2222

2323
template <typename Family>
24-
void EncodeSetMMIO<Family>::remapOffset(MI_LOAD_REGISTER_MEM *pMiLoadReg) {
24+
inline void EncodeSetMMIO<Family>::remapOffset(MI_LOAD_REGISTER_MEM *pMiLoadReg) {
2525
}
2626

2727
template <typename Family>
28-
void EncodeSetMMIO<Family>::remapOffset(MI_LOAD_REGISTER_REG *pMiLoadReg) {
28+
inline void EncodeSetMMIO<Family>::remapOffset(MI_LOAD_REGISTER_REG *pMiLoadReg) {
2929
}
3030

3131
template <typename Family>
32-
bool EncodeSetMMIO<Family>::isRemapApplicable(uint32_t offset) {
32+
inline bool EncodeSetMMIO<Family>::isRemapApplicable(uint32_t offset) {
3333
return false;
3434
}
3535

shared/source/command_container/encode_compute_mode_tgllp_plus.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void EncodeStates<Family>::adjustStateComputeMode(LinearStream &csr, uint32_t nu
2121
}
2222

2323
template <typename Family>
24-
void EncodeStoreMMIO<Family>::remapOffset(MI_STORE_REGISTER_MEM *pStoreRegMem) {
24+
inline void EncodeStoreMMIO<Family>::remapOffset(MI_STORE_REGISTER_MEM *pStoreRegMem) {
2525
pStoreRegMem->setMmioRemapEnable(true);
2626
}
2727

@@ -43,7 +43,7 @@ void EncodeSetMMIO<Family>::remapOffset(MI_LOAD_REGISTER_REG *pMiLoadReg) {
4343
}
4444

4545
template <typename Family>
46-
bool EncodeSetMMIO<Family>::isRemapApplicable(uint32_t offset) {
46+
inline bool EncodeSetMMIO<Family>::isRemapApplicable(uint32_t offset) {
4747
return (0x2000 <= offset && offset <= 0x27ff) ||
4848
(0x4200 <= offset && offset <= 0x420f) ||
4949
(0x4400 <= offset && offset <= 0x441f);

shared/test/common/helpers/unit_test_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct UnitTestHelper {
4545

4646
static bool isAdditionalMiSemaphoreWait(const typename GfxFamily::MI_SEMAPHORE_WAIT &semaphoreWait);
4747

48-
static uint64_t getMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic);
48+
static uint64_t getAtomicMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic);
4949

5050
static bool requiresTimestampPacketsInSystemMemory();
5151

shared/test/common/helpers/unit_test_helper.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ bool UnitTestHelper<GfxFamily>::isAdditionalMiSemaphoreWait(const typename GfxFa
7171
}
7272

7373
template <typename GfxFamily>
74-
inline uint64_t UnitTestHelper<GfxFamily>::getMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic) {
74+
inline uint64_t UnitTestHelper<GfxFamily>::getAtomicMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic) {
7575
return atomic.getMemoryAddress() | ((static_cast<uint64_t>(atomic.getMemoryAddressHigh())) << 32);
7676
}
7777

shared/test/unit_test/encoders/test_encode_atomic.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "shared/source/helpers/ptr_math.h"
1010
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
1111
#include "shared/test/common/fixtures/command_container_fixture.h"
12+
#include "shared/test/common/helpers/unit_test_helper.h"
1213

1314
using namespace NEO;
1415

@@ -37,7 +38,7 @@ HWTEST_F(CommandEncodeAtomic, WhenProgrammingMiAtomicThenExpectAllFieldsSetCorre
3738

3839
EXPECT_EQ(ATOMIC_OPCODES::ATOMIC_4B_DECREMENT, miAtomicCmd->getAtomicOpcode());
3940
EXPECT_EQ(DATA_SIZE::DATA_SIZE_DWORD, miAtomicCmd->getDataSize());
40-
EXPECT_EQ(address, EncodeAtomic<FamilyType>::getMiAtomicAddress(*miAtomicCmd));
41+
EXPECT_EQ(address, UnitTestHelper<FamilyType>::getAtomicMemoryAddress(*miAtomicCmd));
4142
EXPECT_EQ(0x1u, miAtomicCmd->getReturnDataControl());
4243
EXPECT_EQ(0x1u, miAtomicCmd->getCsStall());
4344
}
@@ -75,7 +76,7 @@ HWTEST_F(CommandEncodeAtomic, WhenProgrammingMiAtomicMoveOperationThenExpectInli
7576

7677
EXPECT_EQ(ATOMIC_OPCODES::ATOMIC_4B_MOVE, miAtomicCmd->getAtomicOpcode());
7778
EXPECT_EQ(DATA_SIZE::DATA_SIZE_DWORD, miAtomicCmd->getDataSize());
78-
EXPECT_EQ(address, EncodeAtomic<FamilyType>::getMiAtomicAddress(*miAtomicCmd));
79+
EXPECT_EQ(address, UnitTestHelper<FamilyType>::getAtomicMemoryAddress(*miAtomicCmd));
7980
EXPECT_EQ(0x0u, miAtomicCmd->getReturnDataControl());
8081
EXPECT_EQ(DWORD_LENGTH::DWORD_LENGTH_INLINE_DATA_1, miAtomicCmd->getDwordLength());
8182
EXPECT_EQ(0x1u, miAtomicCmd->getInlineData());
@@ -85,7 +86,7 @@ HWTEST_F(CommandEncodeAtomic, WhenProgrammingMiAtomicMoveOperationThenExpectInli
8586
miAtomicCmd++;
8687
EXPECT_EQ(ATOMIC_OPCODES::ATOMIC_8B_MOVE, miAtomicCmd->getAtomicOpcode());
8788
EXPECT_EQ(DATA_SIZE::DATA_SIZE_QWORD, miAtomicCmd->getDataSize());
88-
EXPECT_EQ(address, EncodeAtomic<FamilyType>::getMiAtomicAddress(*miAtomicCmd));
89+
EXPECT_EQ(address, UnitTestHelper<FamilyType>::getAtomicMemoryAddress(*miAtomicCmd));
8990
EXPECT_EQ(0x0u, miAtomicCmd->getReturnDataControl());
9091
EXPECT_EQ(DWORD_LENGTH::DWORD_LENGTH_INLINE_DATA_1, miAtomicCmd->getDwordLength());
9192
EXPECT_EQ(0x1u, miAtomicCmd->getInlineData());

0 commit comments

Comments
 (0)