Refactor passing GlobalFenceAllocation to DirectSubmission

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-04-07 13:03:01 +00:00
committed by Compute-Runtime-Automation
parent 6f0f15a0b8
commit fc4eaa1894
19 changed files with 154 additions and 157 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,7 +9,7 @@
namespace NEO {
template <typename GfxFamily, typename Dispatcher>
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext) {
return std::make_unique<DrmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext);
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation) {
return std::make_unique<DrmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext, globalFenceAllocation);
}
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,11 +10,11 @@
namespace NEO {
template <typename GfxFamily, typename Dispatcher>
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext) {
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation) {
if (device.getRootDeviceEnvironment().osInterface->getDriverModel()->getDriverModelType() == DriverModelType::DRM) {
return std::make_unique<DrmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext);
return std::make_unique<DrmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext, globalFenceAllocation);
} else {
return std::make_unique<WddmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext);
return std::make_unique<WddmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext, globalFenceAllocation);
}
}
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,7 +9,7 @@
namespace NEO {
template <typename GfxFamily, typename Dispatcher>
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext) {
return std::make_unique<WddmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext);
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation) {
return std::make_unique<WddmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext, globalFenceAllocation);
}
} // namespace NEO

View File

@@ -60,8 +60,7 @@ class OsContext;
template <typename GfxFamily, typename Dispatcher>
class DirectSubmissionHw {
public:
DirectSubmissionHw(Device &device,
OsContext &osContext);
DirectSubmissionHw(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation);
virtual ~DirectSubmissionHw();
@@ -73,7 +72,7 @@ class DirectSubmissionHw {
MOCKABLE_VIRTUAL bool dispatchCommandBuffer(BatchBuffer &batchBuffer, FlushStampTracker &flushStamp);
static std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> create(Device &device, OsContext &osContext);
static std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> create(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation);
protected:
static constexpr size_t prefetchSize = 8 * MemoryConstants::cacheLineSize;
@@ -148,6 +147,7 @@ class DirectSubmissionHw {
Device &device;
OsContext &osContext;
const HardwareInfo *hwInfo = nullptr;
const GraphicsAllocation *globalFenceAllocation = nullptr;
GraphicsAllocation *ringBuffer = nullptr;
GraphicsAllocation *ringBuffer2 = nullptr;
GraphicsAllocation *semaphores = nullptr;

View File

@@ -30,9 +30,8 @@
namespace NEO {
template <typename GfxFamily, typename Dispatcher>
DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(Device &device,
OsContext &osContext)
: device(device), osContext(osContext) {
DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation)
: device(device), osContext(osContext), globalFenceAllocation(globalFenceAllocation) {
hwInfo = &device.getHardwareInfo();
auto hwInfoConfig = HwInfoConfig::get(hwInfo->platform.eProductFamily);
@@ -618,11 +617,8 @@ size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getDiagnosticModeSection() {
template <typename GfxFamily, typename Dispatcher>
void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSystemMemoryFenceAddress() {
auto &engineControl = device.getEngine(this->osContext.getEngineType(), this->osContext.getEngineUsage());
UNRECOVERABLE_IF(engineControl.osContext->getContextId() != engineControl.osContext->getContextId());
EncodeMemoryFence<GfxFamily>::encodeSystemMemoryFence(ringCommandStream, engineControl.commandStreamReceiver->getGlobalFenceAllocation());
UNRECOVERABLE_IF(!this->globalFenceAllocation);
EncodeMemoryFence<GfxFamily>::encodeSystemMemoryFence(ringCommandStream, this->globalFenceAllocation);
}
template <typename GfxFamily, typename Dispatcher>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,8 +16,7 @@ class DrmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
using DirectSubmissionHw<GfxFamily, Dispatcher>::ringCommandStream;
using DirectSubmissionHw<GfxFamily, Dispatcher>::switchRingBuffersAllocations;
DrmDirectSubmission(Device &device,
OsContext &osContext);
DrmDirectSubmission(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation);
~DrmDirectSubmission();

View File

@@ -20,9 +20,8 @@
namespace NEO {
template <typename GfxFamily, typename Dispatcher>
DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(Device &device,
OsContext &osContext)
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext) {
DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation)
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext, globalFenceAllocation) {
this->disableMonitorFence = true;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -19,8 +19,7 @@ class Wddm;
template <typename GfxFamily, typename Dispatcher>
class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
public:
WddmDirectSubmission(Device &device,
OsContext &osContext);
WddmDirectSubmission(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation);
~WddmDirectSubmission();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -23,9 +23,8 @@ namespace NEO {
DECLARE_COMMAND_BUFFER(CommandBufferHeader, UMD_OCL, FALSE, FALSE, PERFTAG_OCL);
template <typename GfxFamily, typename Dispatcher>
WddmDirectSubmission<GfxFamily, Dispatcher>::WddmDirectSubmission(Device &device,
OsContext &osContext)
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext) {
WddmDirectSubmission<GfxFamily, Dispatcher>::WddmDirectSubmission(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation)
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext, globalFenceAllocation) {
osContextWin = reinterpret_cast<OsContextWin *>(&osContext);
wddm = osContextWin->getWddm();
commandBufferHeader = std::make_unique<COMMAND_BUFFER_HEADER_REC>();