Add StateComputeModeProperties to StreamProperties

Related-To: NEO-4940, NEO-4574


Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2021-05-18 02:46:21 +00:00
committed by Compute-Runtime-Automation
parent 3d7b1abe80
commit d693d24f27
36 changed files with 368 additions and 77 deletions

View File

@@ -9,6 +9,7 @@
#include "shared/source/command_container/cmdcontainer.h"
#include "shared/source/command_stream/preemption_mode.h"
#include "shared/source/command_stream/stream_properties.h"
#include "level_zero/core/source/cmdqueue/cmdqueue.h"
#include "level_zero/core/source/device/device.h"
@@ -16,8 +17,6 @@
#include <level_zero/ze_api.h>
#include <level_zero/zet_api.h>
#include "stream_properties.h"
#include <vector>
struct _ze_command_list_handle_t {};

View File

@@ -7,11 +7,12 @@
#pragma once
#include "shared/source/command_stream/stream_properties.h"
#include "level_zero/core/source/builtin/builtin_functions_lib.h"
#include "level_zero/core/source/cmdlist/cmdlist_imp.h"
#include "igfxfmid.h"
#include "stream_properties.h"
namespace NEO {
enum class ImageType;
@@ -219,7 +220,7 @@ struct CommandListCoreFamily : CommandListImp {
bool isCooperative);
ze_result_t appendLaunchKernelSplit(ze_kernel_handle_t hKernel, const ze_group_count_t *pThreadGroupDimensions, ze_event_handle_t hEvent);
ze_result_t prepareIndirectParams(const ze_group_count_t *pThreadGroupDimensions);
void updateStreamProperties(Kernel &kernel);
void updateStreamProperties(Kernel &kernel, bool isMultiOsContextCapable);
void clearCommandsToPatch();
void applyMemoryRangesBarrier(uint32_t numRanges, const size_t *pRangeSizes,

View File

@@ -1847,7 +1847,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::prepareIndirectParams(const ze
}
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel) {
void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel, bool isMultiOsContextCapable) {
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using VFE_STATE_TYPE = typename GfxFamily::VFE_STATE_TYPE;
@@ -1855,7 +1855,6 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
requiredStreamState.setCooperativeKernelProperties(kernel.usesSyncBuffer(), device->getHwInfo());
finalStreamState = requiredStreamState;
containsAnyKernel = true;
return;
}
auto &hwInfo = device->getHwInfo();
@@ -1867,6 +1866,17 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
NEO::AdditionalKernelExecInfo::NotApplicable, finalStreamState);
commandsToPatch.push_back({pVfeStateAddress, pVfeState, CommandToPatch::FrontEndState});
}
auto &kernelAttributes = kernel.getKernelDescriptor().kernelAttributes;
auto &neoDevice = *device->getNEODevice();
finalStreamState.setStateComputeModeProperties(false, kernelAttributes.numGrfRequired, isMultiOsContextCapable,
kernelAttributes.flags.useGlobalAtomics,
(neoDevice.getNumAvailableDevices() > 1));
if (finalStreamState.stateComputeMode.isDirty()) {
NEO::EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(neoDevice, *commandContainer.getCommandStream(), true);
NEO::EncodeComputeMode<GfxFamily>::adjustComputeMode(*commandContainer.getCommandStream(), nullptr, finalStreamState.stateComputeMode);
NEO::EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(neoDevice, *commandContainer.getCommandStream(), false);
}
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@@ -101,7 +101,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(z
kernel->getKernelDescriptor().kernelMetadata.kernelName.c_str());
}
updateStreamProperties(*kernel);
updateStreamProperties(*kernel, false);
NEO::EncodeDispatchKernel<GfxFamily>::encode(commandContainer,
reinterpret_cast<const void *>(pThreadGroupDimensions),

View File

@@ -8,6 +8,7 @@
#pragma once
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/command_stream/scratch_space_controller.h"
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/command_stream/submissions_aggregator.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/memory_manager/graphics_allocation.h"
@@ -16,7 +17,6 @@
#include "level_zero/core/source/cmdqueue/cmdqueue_imp.h"
#include "igfxfmid.h"
#include "stream_properties.h"
namespace L0 {

View File

@@ -13,6 +13,7 @@
#include "shared/source/command_stream/command_stream_receiver_hw.h"
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/command_stream/preemption.h"
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/command_stream/thread_arbitration_policy.h"
#include "shared/source/device/device.h"
#include "shared/source/helpers/hw_helper.h"
@@ -34,7 +35,6 @@
#include "level_zero/tools/source/metrics/metric.h"
#include "pipe_control_args.h"
#include "stream_properties.h"
#include <limits>
#include <thread>

View File

@@ -132,11 +132,12 @@ HWTEST_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenAp
const auto stream = commandContainer.getCommandStream();
const auto streamCpu = stream->getCpuBase();
ze_group_count_t groupCount{1, 1, 1};
commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
auto available = stream->getAvailableSpace();
stream->getSpace(available - sizeof(MI_BATCH_BUFFER_END) - 16);
auto bbEndPosition = stream->getSpace(0);
ze_group_count_t groupCount{1, 1, 1};
commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr);
auto usedSpaceAfter = commandContainer.getCommandStream()->getUsed();