Skip to content

Commit e06aa17

Browse files
pwilmaCompute-Runtime-Automation
authored andcommitted
Grf configuration
Change-Id: I3741f53a38c6707b0c8ad82ae553ea65ae6917e4 Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
1 parent a81b1a4 commit e06aa17

19 files changed

+73
-26
lines changed

runtime/command_queue/enqueue_common.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
534534
}
535535

536536
auto mediaSamplerRequired = false;
537+
uint32_t numGrfRequired = GrfConfig::DefaultGrfNumber;
537538
Kernel *kernel = nullptr;
538539
for (auto &dispatchInfo : multiDispatchInfo) {
539540
if (kernel != dispatchInfo.getKernel()) {
@@ -544,6 +545,8 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
544545
kernel->makeResident(commandStreamReceiver);
545546
requiresCoherency |= kernel->requiresCoherency();
546547
mediaSamplerRequired |= kernel->isVmeKernel();
548+
auto numGrfRequiredByKernel = kernel->getKernelInfo().patchInfo.executionEnvironment->NumGRFRequired;
549+
numGrfRequired = std::max(numGrfRequired, numGrfRequiredByKernel);
547550
}
548551

549552
if (mediaSamplerRequired) {
@@ -593,7 +596,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
593596
if (commandStreamReceiver.peekTimestampPacketWriteEnabled()) {
594597
dispatchFlags.outOfDeviceDependencies = &eventsRequest;
595598
}
596-
599+
dispatchFlags.numGrfRequired = numGrfRequired;
597600
DEBUG_BREAK_IF(taskLevel >= Event::eventNotReady);
598601

599602
if (gtpinIsGTPinInitialized()) {

runtime/command_stream/command_stream_receiver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "runtime/helpers/completion_stamp.h"
1616
#include "runtime/helpers/flat_batch_buffer_helper.h"
1717
#include "runtime/helpers/options.h"
18+
#include "runtime/kernel/grf_config.h"
1819
#include "runtime/indirect_heap/indirect_heap.h"
1920
#include <cstddef>
2021
#include <cstdint>
@@ -179,6 +180,7 @@ class CommandStreamReceiver {
179180
int8_t lastMediaSamplerConfig = -1;
180181
PreemptionMode lastPreemptionMode = PreemptionMode::Initial;
181182
uint32_t latestSentStatelessMocsConfig = 0;
183+
uint32_t lastSentNumGrfRequired = GrfConfig::DefaultGrfNumber;
182184

183185
LinearStream commandStream;
184186

runtime/command_stream/command_stream_receiver_hw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
5050
size_t getCmdSizeForPreemption(const DispatchFlags &dispatchFlags) const;
5151
size_t getCmdSizeForL3Config() const;
5252
size_t getCmdSizeForPipelineSelect() const;
53-
size_t getCmdSizeForCoherency();
53+
size_t getCmdSizeForComputeMode();
5454
size_t getCmdSizeForMediaSampler(bool mediaSamplerRequired) const;
55-
void programCoherency(LinearStream &csr, DispatchFlags &dispatchFlags);
55+
void programComputeMode(LinearStream &csr, DispatchFlags &dispatchFlags);
5656

5757
void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, OsContext &osContext) override;
5858
const HardwareInfo &peekHwInfo() const { return hwInfo; }

runtime/command_stream/command_stream_receiver_hw.inl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
228228
csrSizeRequestFlags.coherencyRequestChanged = this->lastSentCoherencyRequest != static_cast<int8_t>(dispatchFlags.requiresCoherency);
229229
csrSizeRequestFlags.preemptionRequestChanged = this->lastPreemptionMode != dispatchFlags.preemptionMode;
230230
csrSizeRequestFlags.mediaSamplerConfigChanged = this->lastMediaSamplerConfig != static_cast<int8_t>(dispatchFlags.mediaSamplerRequired);
231+
csrSizeRequestFlags.numGrfRequiredChanged = this->lastSentNumGrfRequired != dispatchFlags.numGrfRequired;
231232

232233
size_t requiredScratchSizeInBytes = requiredScratchSize * device.getDeviceInfo().computeUnitsUsedForScratch;
233234

@@ -255,7 +256,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
255256
}
256257
initPageTableManagerRegisters(commandStreamCSR);
257258
programPreemption(commandStreamCSR, device, dispatchFlags);
258-
programCoherency(commandStreamCSR, dispatchFlags);
259+
programComputeMode(commandStreamCSR, dispatchFlags);
259260
programL3(commandStreamCSR, dispatchFlags, newL3Config);
260261
programPipelineSelect(commandStreamCSR, dispatchFlags);
261262
programPreamble(commandStreamCSR, device, dispatchFlags, newL3Config);
@@ -628,7 +629,7 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const Dispat
628629
size += sizeof(typename GfxFamily::MI_BATCH_BUFFER_START);
629630

630631
size += getCmdSizeForL3Config();
631-
size += getCmdSizeForCoherency();
632+
size += getCmdSizeForComputeMode();
632633
size += getCmdSizeForMediaSampler(dispatchFlags.mediaSamplerRequired);
633634
size += getCmdSizeForPipelineSelect();
634635
size += getCmdSizeForPreemption(dispatchFlags);

runtime/command_stream/csr_definitions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "runtime/memory_manager/memory_constants.h"
1010
#include "runtime/helpers/hw_info.h"
1111
#include "runtime/helpers/properties_helper.h"
12+
#include "runtime/kernel/grf_config.h"
1213
#include <limits>
1314

1415
namespace OCLRT {
@@ -43,6 +44,7 @@ struct DispatchFlags {
4344
FlushStampTrackingObj *flushStampReference = nullptr;
4445
PreemptionMode preemptionMode = PreemptionMode::Disabled;
4546
EventsRequest *outOfDeviceDependencies = nullptr;
47+
uint32_t numGrfRequired = GrfConfig::DefaultGrfNumber;
4648
};
4749

4850
struct CsrSizeRequestFlags {
@@ -51,5 +53,6 @@ struct CsrSizeRequestFlags {
5153
bool preemptionRequestChanged = false;
5254
bool mediaSamplerConfigChanged = false;
5355
bool hasSharedHandles = false;
56+
bool numGrfRequiredChanged = false;
5457
};
5558
} // namespace OCLRT

runtime/gen10/command_stream_receiver_hw_gen10.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ typedef CNLFamily Family;
1616
static auto gfxCore = IGFX_GEN10_CORE;
1717

1818
template <>
19-
size_t CommandStreamReceiverHw<Family>::getCmdSizeForCoherency() {
19+
size_t CommandStreamReceiverHw<Family>::getCmdSizeForComputeMode() {
2020
if (csrSizeRequestFlags.coherencyRequestChanged) {
2121
return sizeof(typename Family::MI_LOAD_REGISTER_IMM);
2222
}
2323
return 0;
2424
}
2525

2626
template <>
27-
void CommandStreamReceiverHw<Family>::programCoherency(LinearStream &stream, DispatchFlags &dispatchFlags) {
27+
void CommandStreamReceiverHw<Family>::programComputeMode(LinearStream &stream, DispatchFlags &dispatchFlags) {
2828
if (csrSizeRequestFlags.coherencyRequestChanged) {
2929
LriHelper<Family>::program(&stream, gen10HdcModeRegisterAddresss, DwordBuilder::build(4, true, !dispatchFlags.requiresCoherency));
3030
this->lastSentCoherencyRequest = static_cast<int8_t>(dispatchFlags.requiresCoherency);

runtime/gen8/command_stream_receiver_hw_gen8.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ typedef BDWFamily Family;
1515
static auto gfxCore = IGFX_GEN8_CORE;
1616

1717
template <>
18-
size_t CommandStreamReceiverHw<Family>::getCmdSizeForCoherency() {
18+
size_t CommandStreamReceiverHw<Family>::getCmdSizeForComputeMode() {
1919
return 0;
2020
}
2121

2222
template <>
23-
void CommandStreamReceiverHw<Family>::programCoherency(LinearStream &stream, DispatchFlags &dispatchFlags) {
23+
void CommandStreamReceiverHw<Family>::programComputeMode(LinearStream &stream, DispatchFlags &dispatchFlags) {
2424
}
2525

2626
template <>

runtime/gen9/command_stream_receiver_hw_gen9.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ typedef SKLFamily Family;
1515
static auto gfxCore = IGFX_GEN9_CORE;
1616

1717
template <>
18-
size_t CommandStreamReceiverHw<Family>::getCmdSizeForCoherency() {
18+
size_t CommandStreamReceiverHw<Family>::getCmdSizeForComputeMode() {
1919
return 0;
2020
}
2121

2222
template <>
23-
void CommandStreamReceiverHw<Family>::programCoherency(LinearStream &stream, DispatchFlags &dispatchFlags) {
23+
void CommandStreamReceiverHw<Family>::programComputeMode(LinearStream &stream, DispatchFlags &dispatchFlags) {
2424
}
2525

2626
template <>

runtime/kernel/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
set(RUNTIME_SRCS_KERNEL
88
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
99
${CMAKE_CURRENT_SOURCE_DIR}/dynamic_kernel_info.h
10+
${CMAKE_CURRENT_SOURCE_DIR}/grf_config.h
1011
${CMAKE_CURRENT_SOURCE_DIR}/image_transformer.cpp
1112
${CMAKE_CURRENT_SOURCE_DIR}/image_transformer.h
1213
${CMAKE_CURRENT_SOURCE_DIR}/kernel.cpp
1314
${CMAKE_CURRENT_SOURCE_DIR}/kernel.h
1415
${CMAKE_CURRENT_SOURCE_DIR}/kernel.inl
16+
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/kernel_reconfiguration.cpp
1517
)
1618
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_KERNEL})
1719
set_property(GLOBAL PROPERTY RUNTIME_SRCS_KERNEL ${RUNTIME_SRCS_KERNEL})

runtime/kernel/grf_config.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
namespace GrfConfig {
11+
constexpr uint32_t DefaultGrfNumber = 128u;
12+
}

0 commit comments

Comments
 (0)