Move definitions out of engine_node.h.

Change-Id: I18692a444663c11103f8991415b38000c633f24a
Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
Piotr Fusik 2019-03-25 13:21:48 +01:00
parent 83aa28e294
commit cc13045ddd
9 changed files with 31 additions and 23 deletions

View File

@ -18,11 +18,4 @@ enum EngineType : uint32_t {
NUM_ENGINES
};
namespace EngineInstanceConstants {
constexpr uint32_t lowPriorityGpgpuEngineIndex = 1;
constexpr uint32_t numGpgpuEngineInstances = 2;
} // namespace EngineInstanceConstants
constexpr uint32_t maxOsContextCount = EngineInstanceConstants::numGpgpuEngineInstances;
constexpr uint32_t maxHandleCount = 1u;
} // namespace OCLRT

View File

@ -175,7 +175,7 @@ bool Device::createEngines(const HardwareInfo *pHwInfo) {
DeviceBitfield deviceBitfield;
deviceBitfield.set(getDeviceIndex());
bool lowPriority = deviceCsrIndex == EngineInstanceConstants::lowPriorityGpgpuEngineIndex;
bool lowPriority = deviceCsrIndex == HwHelper::lowPriorityGpgpuEngineIndex;
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver, gpgpuEngines[deviceCsrIndex],
deviceBitfield, preemptionMode, lowPriority);
commandStreamReceiver->setupContext(*osContext);

View File

@ -60,6 +60,8 @@ class HwHelper {
virtual const std::vector<EngineType> getGpgpuEngineInstances() const = 0;
virtual bool getEnableLocalMemory(const HardwareInfo &hwInfo) const = 0;
static constexpr uint32_t lowPriorityGpgpuEngineIndex = 1;
protected:
HwHelper() = default;
};

View File

@ -14,6 +14,7 @@ set(RUNTIME_SRCS_MEMORY_MANAGER
${CMAKE_CURRENT_SOURCE_DIR}/deferrable_deletion.h
${CMAKE_CURRENT_SOURCE_DIR}/deferred_deleter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/deferred_deleter.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/engine_limits.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/storage_info.cpp
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/storage_info.h
${CMAKE_CURRENT_SOURCE_DIR}/gfx_partition.cpp

View File

@ -0,0 +1,17 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <cstdint>
namespace OCLRT {
constexpr uint32_t numGpgpuEngineInstances = 2u;
constexpr uint32_t maxOsContextCount = numGpgpuEngineInstances;
constexpr uint32_t maxHandleCount = 1u;
} // namespace OCLRT

View File

@ -17,6 +17,7 @@
#include "runtime/utilities/idlist.h"
#include "runtime/utilities/stackvec.h"
#include "engine_limits.h"
#include "storage_info.h"
#include <array>

View File

@ -6,21 +6,15 @@
*/
#pragma once
#include "engine_node.h"
#include "engine_limits.h"
#include <array>
#include <cinttypes>
#include <vector>
#include <cstdint>
namespace OCLRT {
struct ResidencyData {
ResidencyData() {
std::fill_n(resident, sizeof(resident), false);
}
~ResidencyData() = default;
bool resident[maxOsContextCount];
bool resident[maxOsContextCount] = {};
void updateCompletionData(uint64_t newFenceValue, uint32_t contextId);
uint64_t getFenceValueForContextId(uint32_t contextId);

View File

@ -58,7 +58,7 @@ TEST_F(DeviceTest, givenDeviceWhenEngineIsCreatedThenSetInitialValueForTag) {
TEST_F(DeviceTest, givenDeviceWhenAskedForSpecificEngineThenRetrunIt) {
auto &engines = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances();
for (uint32_t i = 0; i < engines.size(); i++) {
bool lowPriority = (EngineInstanceConstants::lowPriorityGpgpuEngineIndex == i);
bool lowPriority = (HwHelper::lowPriorityGpgpuEngineIndex == i);
auto &deviceEngine = pDevice->getEngine(engines[i], lowPriority);
EXPECT_EQ(deviceEngine.osContext->getEngineType(), engines[i]);
EXPECT_EQ(deviceEngine.osContext->isLowPriority(), lowPriority);

View File

@ -1472,8 +1472,8 @@ using GraphicsAllocationTests = ::testing::Test;
HWTEST_F(GraphicsAllocationTests, givenAllocationUsedOnlyByNonDefaultCsrWhenCheckingUsageBeforeDestroyThenStoreItAsTemporaryAllocation) {
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
auto nonDefaultOsContext = device->engines[EngineInstanceConstants::lowPriorityGpgpuEngineIndex].osContext;
auto nonDefaultCsr = reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(device->engines[EngineInstanceConstants::lowPriorityGpgpuEngineIndex].commandStreamReceiver);
auto nonDefaultOsContext = device->engines[HwHelper::lowPriorityGpgpuEngineIndex].osContext;
auto nonDefaultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(device->engines[HwHelper::lowPriorityGpgpuEngineIndex].commandStreamReceiver);
auto memoryManager = device->getExecutionEnvironment()->memoryManager.get();
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
@ -1519,9 +1519,9 @@ HWTEST_F(GraphicsAllocationTests, givenAllocationUsedByManyOsContextsWhenCheckin
memoryManager->multiContextResourceDestructor.reset(multiContextDestructor);
auto device = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(platformDevices[0], executionEnvironment, 0u));
auto nonDefaultOsContext = device->engines[EngineInstanceConstants::lowPriorityGpgpuEngineIndex].osContext;
auto nonDefaultCsr = reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(device->engines[EngineInstanceConstants::lowPriorityGpgpuEngineIndex].commandStreamReceiver);
auto defaultCsr = reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(device->getDefaultEngine().commandStreamReceiver);
auto nonDefaultOsContext = device->engines[HwHelper::lowPriorityGpgpuEngineIndex].osContext;
auto nonDefaultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(device->engines[HwHelper::lowPriorityGpgpuEngineIndex].commandStreamReceiver);
auto defaultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(device->getDefaultEngine().commandStreamReceiver);
auto defaultOsContext = device->getDefaultEngine().osContext;
EXPECT_FALSE(defaultOsContext->isLowPriority());