Do not rely on default engine while programming command buffers

Change-Id: Ib341695bf0449a1236b29411e41ab88a5a1e8b94
Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
Pawel Wilma
2020-02-06 16:06:00 +01:00
committed by sys_ocldev
parent c739500047
commit d5a1eee8fa
14 changed files with 37 additions and 31 deletions

View File

@@ -48,7 +48,7 @@ void PreambleHelper<ICLFamily>::programPipelineSelect(LinearStream *pCommandStre
}
template <>
void PreambleHelper<ICLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo) {
void PreambleHelper<ICLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, aub_stream::EngineType engineType) {
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControl = ICLFamily::cmdInitPipeControl;
pipeControl->setCommandStreamerStallEnable(true);

View File

@@ -6,6 +6,7 @@
*/
#include "core/command_stream/csr_definitions.h"
#include "core/helpers/engine_node_helper.h"
#include "core/helpers/preamble_bdw_plus.inl"
#include "runtime/gen12lp/helpers_gen12lp.h"
#include "runtime/helpers/hardware_commands_helper.h"
@@ -53,12 +54,12 @@ void PreambleHelper<TGLLPFamily>::programPipelineSelect(LinearStream *pCommandSt
}
template <>
void PreambleHelper<TGLLPFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo) {
void PreambleHelper<TGLLPFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, aub_stream::EngineType engineType) {
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControl = TGLLPFamily::cmdInitPipeControl;
pipeControl->setCommandStreamerStallEnable(true);
if (hwInfo->workaroundTable.waSendMIFLUSHBeforeVFE) {
if (hwInfo->capabilityTable.defaultEngineType != aub_stream::ENGINE_CCS) {
if (!EngineHelpers::isCcs(engineType)) {
pipeControl->setRenderTargetCacheFlushEnable(true);
pipeControl->setDepthCacheFlushEnable(true);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,7 +10,7 @@
namespace NEO {
template <>
void PreambleHelper<BDWFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo) {
void PreambleHelper<BDWFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, aub_stream::EngineType engineType) {
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControl = BDWFamily::cmdInitPipeControl;
pipeControl->setCommandStreamerStallEnable(true);

View File

@@ -49,7 +49,7 @@ void PreambleHelper<SKLFamily>::programPipelineSelect(LinearStream *pCommandStre
}
template <>
void PreambleHelper<SKLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo) {
void PreambleHelper<SKLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, aub_stream::EngineType engineType) {
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControl = SKLFamily::cmdInitPipeControl;
pipeControl->setCommandStreamerStallEnable(true);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,6 +8,7 @@
#pragma once
#include "core/helpers/pipeline_select_helper.h"
#include "engine_node.h"
#include "igfxfmid.h"
#include <cstddef>
@@ -35,12 +36,13 @@ struct PreambleHelper {
static uint32_t getDefaultThreadArbitrationPolicy();
static void programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy);
static void programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr);
static void addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo);
static void addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, aub_stream::EngineType engineType);
static uint64_t programVFEState(LinearStream *pCommandStream,
const HardwareInfo &hwInfo,
int scratchSize,
uint64_t scratchAddress,
uint32_t maxFrontEndThreads);
uint32_t maxFrontEndThreads,
aub_stream::EngineType engineType);
static void programAdditionalFieldsInVfeState(VFE_STATE_TYPE *mediaVfeState, const HardwareInfo &hwInfo);
static void programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr, GraphicsAllocation *perDssBackedBuffer);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -30,10 +30,11 @@ uint64_t PreambleHelper<GfxFamily>::programVFEState(LinearStream *pCommandStream
const HardwareInfo &hwInfo,
int scratchSize,
uint64_t scratchAddress,
uint32_t maxFrontEndThreads) {
uint32_t maxFrontEndThreads,
aub_stream::EngineType engineType) {
using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE;
addPipeControlBeforeVfeCmd(pCommandStream, &hwInfo);
addPipeControlBeforeVfeCmd(pCommandStream, &hwInfo, engineType);
auto scratchSpaceAddressOffset = static_cast<uint64_t>(pCommandStream->getUsed() + MEDIA_VFE_STATE::PATCH_CONSTANTS::SCRATCHSPACEBASEPOINTER_BYTEOFFSET);
auto pMediaVfeState = reinterpret_cast<MEDIA_VFE_STATE *>(pCommandStream->getSpace(sizeof(MEDIA_VFE_STATE)));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -58,7 +58,7 @@ GEN11TEST_F(Gen11PreambleVfeState, WaOff) {
typedef typename ICLFamily::PIPE_CONTROL PIPE_CONTROL;
testWaTable->waSendMIFLUSHBeforeVFE = 0;
LinearStream &cs = linearStream;
PreambleHelper<ICLFamily>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u);
PreambleHelper<ICLFamily>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS);
parseCommands<ICLFamily>(cs);
@@ -76,7 +76,7 @@ GEN11TEST_F(Gen11PreambleVfeState, WaOn) {
typedef typename ICLFamily::PIPE_CONTROL PIPE_CONTROL;
testWaTable->waSendMIFLUSHBeforeVFE = 1;
LinearStream &cs = linearStream;
PreambleHelper<ICLFamily>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u);
PreambleHelper<ICLFamily>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS);
parseCommands<ICLFamily>(cs);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -60,7 +60,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, WaOff) {
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
testWaTable->waSendMIFLUSHBeforeVFE = 0;
LinearStream &cs = linearStream;
PreambleHelper<FamilyType>::programVFEState(&linearStream, *pPlatform->peekExecutionEnvironment()->getHardwareInfo(), 0, 0, 672u);
PreambleHelper<FamilyType>::programVFEState(&linearStream, *pPlatform->peekExecutionEnvironment()->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS);
parseCommands<FamilyType>(cs);
@@ -79,9 +79,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, givenCcsEngineWhenWaIsSetThenAppropriatePip
testWaTable->waSendMIFLUSHBeforeVFE = 1;
LinearStream &cs = linearStream;
EXPECT_EQ(aub_stream::ENGINE_CCS, platformDevices[0]->capabilityTable.defaultEngineType);
PreambleHelper<FamilyType>::programVFEState(&linearStream, *pPlatform->peekExecutionEnvironment()->getHardwareInfo(), 0, 0, 672u);
PreambleHelper<FamilyType>::programVFEState(&linearStream, *pPlatform->peekExecutionEnvironment()->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_CCS);
parseCommands<FamilyType>(cs);
@@ -100,10 +98,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, givenRcsEngineWhenWaIsSetThenAppropriatePip
testWaTable->waSendMIFLUSHBeforeVFE = 1;
LinearStream &cs = linearStream;
HardwareInfo hwInfo = const_cast<HardwareInfo &>(pPlatform->getDevice(0)->getHardwareInfo());
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_RCS;
PreambleHelper<FamilyType>::programVFEState(&linearStream, hwInfo, 0, 0, 672u);
PreambleHelper<FamilyType>::programVFEState(&linearStream, *pPlatform->peekExecutionEnvironment()->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS);
parseCommands<FamilyType>(cs);

View File

@@ -94,7 +94,7 @@ BDWTEST_F(PreambleVfeState, basic) {
typedef BDWFamily::PIPE_CONTROL PIPE_CONTROL;
LinearStream &cs = linearStream;
PreambleHelper<BDWFamily>::programVFEState(&linearStream, **platformDevices, 0, 0, 168u);
PreambleHelper<BDWFamily>::programVFEState(&linearStream, **platformDevices, 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS);
parseCommands<BDWFamily>(cs);

View File

@@ -107,7 +107,7 @@ GEN9TEST_F(PreambleVfeState, WaOff) {
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
testWaTable->waSendMIFLUSHBeforeVFE = 0;
LinearStream &cs = linearStream;
PreambleHelper<FamilyType>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u);
PreambleHelper<FamilyType>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS);
parseCommands<FamilyType>(cs);
@@ -125,7 +125,7 @@ GEN9TEST_F(PreambleVfeState, WaOn) {
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
testWaTable->waSendMIFLUSHBeforeVFE = 1;
LinearStream &cs = linearStream;
PreambleHelper<FamilyType>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u);
PreambleHelper<FamilyType>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 168u, aub_stream::EngineType::ENGINE_RCS);
parseCommands<FamilyType>(cs);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -198,6 +198,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, PreambleTest, givenPreambleHelperWhenMediaVfeStateIs
FlatBatchBufferHelperHw<FamilyType> helper(*mockDevice->getExecutionEnvironment());
uint64_t addressToPatch = 0xC0DEC0DE;
auto offset = PreambleHelper<FamilyType>::programVFEState(&preambleStream, mockDevice->getHardwareInfo(), 1024u, addressToPatch, 10u);
auto offset = PreambleHelper<FamilyType>::programVFEState(&preambleStream, mockDevice->getHardwareInfo(), 1024u, addressToPatch, 10u, aub_stream::EngineType::ENGINE_RCS);
EXPECT_NE(0u, offset);
}