mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Refactor of programComputeMode in CommandStreamReceiverHw
Change-Id: If3ca7e89fe9f2fff371cd88224fe3a669d17f000 Signed-off-by: Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
@@ -19,6 +19,7 @@ set(RUNTIME_SRCS_COMMAND_STREAM
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_bdw_plus.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tgllp_plus.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_with_aub_dump.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_with_aub_dump.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/create_command_stream_impl.cpp
|
||||
|
||||
@@ -55,6 +55,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
size_t getCmdSizeForMediaSampler(bool mediaSamplerRequired) const;
|
||||
size_t getCmdSizeForEngineMode(const DispatchFlags &dispatchFlags) const;
|
||||
void programComputeMode(LinearStream &csr, DispatchFlags &dispatchFlags);
|
||||
void adjustComputeMode(LinearStream &csr, DispatchFlags &dispatchFlags, void *const stateComputeMode);
|
||||
|
||||
void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) override;
|
||||
const HardwareInfo &peekHwInfo() const { return *executionEnvironment.getHardwareInfo(); }
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/helpers/state_base_address.h"
|
||||
#include "runtime/helpers/state_compute_mode_helper.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/indirect_heap/indirect_heap.h"
|
||||
#include "runtime/memory_manager/internal_allocation_storage.h"
|
||||
@@ -218,8 +219,9 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
csrSizeRequestFlags.coherencyRequestChanged = this->lastSentCoherencyRequest != static_cast<int8_t>(dispatchFlags.requiresCoherency);
|
||||
csrSizeRequestFlags.preemptionRequestChanged = this->lastPreemptionMode != dispatchFlags.preemptionMode;
|
||||
csrSizeRequestFlags.mediaSamplerConfigChanged = this->lastMediaSamplerConfig != static_cast<int8_t>(dispatchFlags.pipelineSelectArgs.mediaSamplerRequired);
|
||||
csrSizeRequestFlags.numGrfRequiredChanged = this->lastSentNumGrfRequired != dispatchFlags.numGrfRequired;
|
||||
csrSizeRequestFlags.specialPipelineSelectModeChanged = this->lastSpecialPipelineSelectMode != dispatchFlags.pipelineSelectArgs.specialPipelineSelectMode;
|
||||
csrSizeRequestFlags.numGrfRequiredChanged = this->lastSentNumGrfRequired != dispatchFlags.numGrfRequired;
|
||||
lastSentNumGrfRequired = dispatchFlags.numGrfRequired;
|
||||
|
||||
auto force32BitAllocations = getMemoryManager()->peekForce32BitAllocations();
|
||||
bool stateBaseAddressDirty = false;
|
||||
|
||||
@@ -53,6 +53,9 @@ void CommandStreamReceiverHw<GfxFamily>::programPipelineSelect(LinearStream &com
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void CommandStreamReceiverHw<GfxFamily>::adjustComputeMode(LinearStream &csr, DispatchFlags &dispatchFlags, void *const stateComputeMode) {}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void CommandStreamReceiverHw<GfxFamily>::createScratchSpaceController() {
|
||||
scratchSpaceController = std::make_unique<ScratchSpaceControllerBase>(executionEnvironment, *internalAllocationStorage.get());
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/command_stream_receiver_hw.h"
|
||||
|
||||
namespace NEO {
|
||||
template <typename GfxFamily>
|
||||
void CommandStreamReceiverHw<GfxFamily>::programComputeMode(LinearStream &stream, DispatchFlags &dispatchFlags) {
|
||||
using STATE_COMPUTE_MODE = typename GfxFamily::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
||||
using FORCE_NON_COHERENT = typename STATE_COMPUTE_MODE::FORCE_NON_COHERENT;
|
||||
|
||||
if (csrSizeRequestFlags.coherencyRequestChanged || csrSizeRequestFlags.hasSharedHandles || csrSizeRequestFlags.numGrfRequiredChanged ||
|
||||
StateComputeModeHelper<GfxFamily>::isStateComputeModeRequired(csrSizeRequestFlags, this->lastSentThreadArbitrationPolicy != this->requiredThreadArbitrationPolicy)) {
|
||||
auto stateComputeMode = stream.getSpaceForCmd<STATE_COMPUTE_MODE>();
|
||||
*stateComputeMode = GfxFamily::cmdInitStateComputeMode;
|
||||
|
||||
FORCE_NON_COHERENT coherencyValue = !dispatchFlags.requiresCoherency ? FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT : FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_DISABLED;
|
||||
stateComputeMode->setForceNonCoherent(coherencyValue);
|
||||
this->lastSentCoherencyRequest = static_cast<int8_t>(dispatchFlags.requiresCoherency);
|
||||
|
||||
stateComputeMode->setMaskBits(GfxFamily::stateComputeModeForceNonCoherentMask);
|
||||
|
||||
if (csrSizeRequestFlags.hasSharedHandles) {
|
||||
auto pc = stream.getSpaceForCmd<PIPE_CONTROL>();
|
||||
*pc = GfxFamily::cmdInitPipeControl;
|
||||
}
|
||||
adjustComputeMode(stream, dispatchFlags, stateComputeMode);
|
||||
}
|
||||
}
|
||||
} // namespace NEO
|
||||
@@ -61,6 +61,11 @@ macro(macro_for_each_gen)
|
||||
foreach(SRC_IT ${RUNTIME_SRCS_GENX_H_BASE})
|
||||
list(APPEND RUNTIME_SRCS_${GEN_TYPE}_H_BASE ${GENX_PREFIX}/${SRC_IT})
|
||||
endforeach()
|
||||
foreach(SRC_IT "state_compute_mode_helper_${GEN_TYPE_LOWER}.cpp")
|
||||
if(EXISTS ${GENX_PREFIX}/${SRC_IT})
|
||||
list(APPEND RUNTIME_SRCS_${GEN_TYPE}_H_BASE ${GENX_PREFIX}/${SRC_IT})
|
||||
endif()
|
||||
endforeach()
|
||||
if(EXISTS "${CORE_GENX_PREFIX}/hw_cmds_generated.inl")
|
||||
list(APPEND RUNTIME_SRCS_${GEN_TYPE}_H_BASE "${CORE_GENX_PREFIX}/hw_cmds_generated.inl")
|
||||
endif()
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/command_stream_receiver_hw_bdw_plus.inl"
|
||||
#include "runtime/command_stream/command_stream_receiver_hw_tgllp_plus.inl"
|
||||
#include "runtime/command_stream/device_command_stream.h"
|
||||
#include "runtime/gen12lp/helpers_gen12lp.h"
|
||||
#include "runtime/gen12lp/hw_cmds.h"
|
||||
@@ -38,7 +39,7 @@ size_t CommandStreamReceiverHw<Family>::getCmdSizeForComputeMode() {
|
||||
}
|
||||
|
||||
size_t size = 0;
|
||||
if (csrSizeRequestFlags.coherencyRequestChanged || csrSizeRequestFlags.hasSharedHandles) {
|
||||
if (csrSizeRequestFlags.coherencyRequestChanged || csrSizeRequestFlags.hasSharedHandles || csrSizeRequestFlags.numGrfRequiredChanged) {
|
||||
size += sizeof(typename Family::STATE_COMPUTE_MODE);
|
||||
if (csrSizeRequestFlags.hasSharedHandles) {
|
||||
size += sizeof(typename Family::PIPE_CONTROL);
|
||||
@@ -47,27 +48,6 @@ size_t CommandStreamReceiverHw<Family>::getCmdSizeForComputeMode() {
|
||||
return size;
|
||||
}
|
||||
|
||||
template <>
|
||||
void CommandStreamReceiverHw<Family>::programComputeMode(LinearStream &stream, DispatchFlags &dispatchFlags) {
|
||||
typedef typename Family::STATE_COMPUTE_MODE STATE_COMPUTE_MODE;
|
||||
typedef typename Family::PIPE_CONTROL PIPE_CONTROL;
|
||||
|
||||
if (csrSizeRequestFlags.coherencyRequestChanged || csrSizeRequestFlags.hasSharedHandles) {
|
||||
auto stateComputeMode = stream.getSpaceForCmd<STATE_COMPUTE_MODE>();
|
||||
*stateComputeMode = Family::cmdInitStateComputeMode;
|
||||
STATE_COMPUTE_MODE::FORCE_NON_COHERENT coherencyValue = !dispatchFlags.requiresCoherency ? STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT : STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_DISABLED;
|
||||
stateComputeMode->setForceNonCoherent(coherencyValue);
|
||||
stateComputeMode->setMaskBits(Family::stateComputeModeForceNonCoherentMask);
|
||||
|
||||
this->lastSentCoherencyRequest = static_cast<int8_t>(dispatchFlags.requiresCoherency);
|
||||
|
||||
if (csrSizeRequestFlags.hasSharedHandles) {
|
||||
auto pc = stream.getSpaceForCmd<PIPE_CONTROL>();
|
||||
*pc = Family::cmdInitPipeControl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
void populateFactoryTable<CommandStreamReceiverHw<Family>>() {
|
||||
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[IGFX_MAX_CORE];
|
||||
|
||||
13
runtime/gen12lp/state_compute_mode_helper_gen12lp.cpp
Normal file
13
runtime/gen12lp/state_compute_mode_helper_gen12lp.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/helpers/state_compute_mode_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
template <>
|
||||
bool StateComputeModeHelper<TGLLPFamily>::isStateComputeModeRequired(CsrSizeRequestFlags &csrSizeRequestFlags, bool isThreadArbitionPolicyProgrammed) { return false; }
|
||||
} // namespace NEO
|
||||
@@ -75,6 +75,7 @@ set(RUNTIME_SRCS_HELPERS_BASE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_bdw_plus.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state_compute_mode_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/string_helpers.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/surface_formats.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/surface_formats.h
|
||||
|
||||
18
runtime/helpers/state_compute_mode_helper.h
Normal file
18
runtime/helpers/state_compute_mode_helper.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/command_stream/csr_definitions.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
namespace NEO {
|
||||
template <typename GfxFamily>
|
||||
struct StateComputeModeHelper {
|
||||
static bool isStateComputeModeRequired(CsrSizeRequestFlags &csrSizeRequestFlags, bool isThreadArbitionPolicyProgrammed);
|
||||
};
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user