mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Define GPGPU engines per gen
Change-Id: Ie0e565d11184c5355b5bf09f5b10a567deb5c106 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
84d35c8951
commit
06600f169b
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "engine_node.h"
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
#include "runtime/os_interface/linux/drm_memory_manager.h"
|
||||
#include "runtime/os_interface/linux/drm_neo.h"
|
||||
#include "unit_tests/helpers/gtest_helpers.h"
|
||||
@@ -270,7 +271,7 @@ class DrmMockCustom : public Drm {
|
||||
|
||||
DrmMockCustom() : Drm(mockFd) {
|
||||
reset();
|
||||
ioctl_expected.contextCreate = OCLRT::EngineInstanceConstants::numGpgpuEngineInstances;
|
||||
ioctl_expected.contextCreate = static_cast<int>(OCLRT::HwHelper::get(OCLRT::platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances().size());
|
||||
ioctl_expected.contextDestroy = ioctl_expected.contextCreate.load();
|
||||
}
|
||||
int getErrno() override {
|
||||
|
||||
@@ -41,13 +41,13 @@ class DrmCommandStreamFixture {
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment.osInterface->get()->setDrm(mock.get());
|
||||
|
||||
osContext = std::make_unique<OsContext>(executionEnvironment.osInterface.get(), 0u, gpgpuEngineInstances[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
osContext = std::make_unique<OsContext>(executionEnvironment.osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
|
||||
csr = new DrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], executionEnvironment,
|
||||
gemCloseWorkerMode::gemCloseWorkerActive);
|
||||
ASSERT_NE(nullptr, csr);
|
||||
executionEnvironment.commandStreamReceivers.resize(1);
|
||||
executionEnvironment.commandStreamReceivers[0][0].reset(csr);
|
||||
executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr<CommandStreamReceiver>(csr));
|
||||
csr->setupContext(*osContext);
|
||||
|
||||
// Memory manager creates pinBB with ioctl, expect one call
|
||||
@@ -254,7 +254,7 @@ TEST_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdToAllExecBuff
|
||||
.RetiresOnSaturation();
|
||||
|
||||
osContext = std::make_unique<OsContext>(executionEnvironment.osInterface.get(), 1,
|
||||
gpgpuEngineInstances[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
csr->setupContext(*osContext);
|
||||
|
||||
auto &cs = csr->getCS();
|
||||
|
||||
@@ -570,7 +570,7 @@ TEST_F(DrmMemoryManagerTest, getMinimumSystemSharedMemory) {
|
||||
mock->ioctl_expected.contextGetParam = 2;
|
||||
EXPECT_EQ(hostMemorySize, systemSharedMemorySize);
|
||||
mock->testIoctls();
|
||||
mock->ioctl_expected.contextDestroy = OCLRT::EngineInstanceConstants::numGpgpuEngineInstances;
|
||||
mock->ioctl_expected.contextDestroy = static_cast<int>(memoryManager->getCommandStreamReceivers()[0].size());
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, BoWaitFailure) {
|
||||
@@ -1298,7 +1298,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreatedAn
|
||||
|
||||
injectFailures(method);
|
||||
mock->reset();
|
||||
mock->ioctl_expected.contextDestroy = OCLRT::EngineInstanceConstants::numGpgpuEngineInstances;
|
||||
mock->ioctl_expected.contextDestroy = static_cast<int>(memoryManager->getCommandStreamReceivers()[0].size());
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreatedFromHostPtrThenallocateGraphicsMemoryForImageIsUsed) {
|
||||
@@ -1561,7 +1561,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenAllocationFails
|
||||
|
||||
injectFailures(method);
|
||||
mock->reset();
|
||||
mock->ioctl_expected.contextDestroy = OCLRT::EngineInstanceConstants::numGpgpuEngineInstances;
|
||||
mock->ioctl_expected.contextDestroy = static_cast<int>(memoryManager->getCommandStreamReceivers()[0].size());
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndThreeOsHandlesWhenReuseCreatesAreCalledThenGraphicsAllocationsAreReturned) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -146,6 +146,8 @@ TEST(DrmTest, GivenDrmWhenAskedForContextThatFailsThenFalseIsReturned) {
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
constexpr EngineInstanceT defaultEngine{ENGINE_RCS, 0};
|
||||
|
||||
TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext) {
|
||||
DrmMock drmMock;
|
||||
uint32_t drmContextId1 = 123;
|
||||
@@ -153,13 +155,13 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext)
|
||||
|
||||
{
|
||||
drmMock.StoredCtxId = drmContextId1;
|
||||
OsContextLinux osContext1(drmMock, gpgpuEngineInstances[0]);
|
||||
OsContextLinux osContext1(drmMock, defaultEngine);
|
||||
EXPECT_EQ(drmContextId1, osContext1.getDrmContextId());
|
||||
EXPECT_EQ(0u, drmMock.receivedDestroyContextId);
|
||||
|
||||
{
|
||||
drmMock.StoredCtxId = drmContextId2;
|
||||
OsContextLinux osContext2(drmMock, gpgpuEngineInstances[1]);
|
||||
OsContextLinux osContext2(drmMock, defaultEngine);
|
||||
EXPECT_EQ(drmContextId2, osContext2.getDrmContextId());
|
||||
EXPECT_EQ(0u, drmMock.receivedDestroyContextId);
|
||||
}
|
||||
@@ -175,16 +177,16 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext
|
||||
drmMock.StoredCtxId = 123;
|
||||
drmMock.preemptionSupported = false;
|
||||
|
||||
OsContextLinux osContext1(drmMock, gpgpuEngineInstances[0]);
|
||||
OsContextLinux osContext2(drmMock, gpgpuEngineInstances[EngineInstanceConstants::lowPriorityGpgpuEngineIndex]);
|
||||
OsContextLinux osContext1(drmMock, defaultEngine);
|
||||
OsContextLinux osContext2(drmMock, lowPriorityGpgpuEngine);
|
||||
EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount);
|
||||
|
||||
drmMock.preemptionSupported = true;
|
||||
|
||||
OsContextLinux osContext3(drmMock, gpgpuEngineInstances[0]);
|
||||
OsContextLinux osContext3(drmMock, defaultEngine);
|
||||
EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount);
|
||||
|
||||
OsContextLinux osContext4(drmMock, gpgpuEngineInstances[EngineInstanceConstants::lowPriorityGpgpuEngineIndex]);
|
||||
OsContextLinux osContext4(drmMock, lowPriorityGpgpuEngine);
|
||||
EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount);
|
||||
EXPECT_EQ(drmMock.StoredCtxId, drmMock.receivedContextParamRequest.ctx_id);
|
||||
EXPECT_EQ(static_cast<uint64_t>(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -27,7 +27,7 @@ TEST(OsContextTest, givenDrmWhenOsContextIsCreatedThenImplIsAvailable) {
|
||||
OSInterface osInterface;
|
||||
osInterface.get()->setDrm(&drmMock);
|
||||
|
||||
auto osContext = std::make_unique<OsContext>(&osInterface, 0u, gpgpuEngineInstances[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
auto osContext = std::make_unique<OsContext>(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
EXPECT_NE(nullptr, osContext->get());
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
||||
Reference in New Issue
Block a user