mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Correct root device index in SBA programming (2)
Add ULT Related-To: NEO-3691 Change-Id: I61f6ba9b988b5245a2657c38c7bb0b94fbb3a295 Signed-off: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
b1ef2f70d6
commit
29464fb9ad
@@ -56,6 +56,9 @@ struct Mock<CommandQueue> : public CommandQueue {
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
struct MockCommandQueueHw : public L0::CommandQueueHw<gfxCoreFamily> {
|
||||
using BaseClass = ::L0::CommandQueueHw<gfxCoreFamily>;
|
||||
using BaseClass::commandStream;
|
||||
|
||||
MockCommandQueueHw(L0::Device *device, NEO::CommandStreamReceiver *csr, const ze_command_queue_desc_t *desc) : L0::CommandQueueHw<gfxCoreFamily>(device, csr, desc) {
|
||||
}
|
||||
ze_result_t synchronize(uint32_t timeout) override {
|
||||
|
||||
@@ -5,10 +5,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/state_base_address.h"
|
||||
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/helpers/default_hw_info.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "level_zero/core/source/cmdqueue/cmdqueue_imp.h"
|
||||
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_memory_manager.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
@@ -40,5 +46,62 @@ TEST_F(CommandQueueCreate, whenCreatingCommandQueueThenItIsInitialized) {
|
||||
commandQueue->destroy();
|
||||
}
|
||||
|
||||
using CommandQueueSBASupport = IsWithinProducts<IGFX_SKYLAKE, IGFX_TIGERLAKE_LP>;
|
||||
|
||||
struct MockMemoryManagerCommandQueueSBA : public MemoryManagerMock {
|
||||
MockMemoryManagerCommandQueueSBA(NEO::ExecutionEnvironment &executionEnvironment) : MemoryManagerMock(const_cast<NEO::ExecutionEnvironment &>(executionEnvironment)) {}
|
||||
MOCK_METHOD1(getInternalHeapBaseAddress, uint64_t(uint32_t rootDeviceIndex));
|
||||
};
|
||||
|
||||
struct CommandQueueProgramSBATest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
|
||||
for (uint32_t i = 0; i < numRootDevices; i++) {
|
||||
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(NEO::defaultHwInfo.get());
|
||||
}
|
||||
|
||||
memoryManager = new ::testing::NiceMock<MockMemoryManagerCommandQueueSBA>(*executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
|
||||
neoDevice = NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, rootDeviceIndex);
|
||||
std::vector<std::unique_ptr<NEO::Device>> devices;
|
||||
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
|
||||
|
||||
driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
|
||||
driverHandle->initialize(std::move(devices));
|
||||
|
||||
device = driverHandle->devices[0];
|
||||
}
|
||||
void TearDown() override {
|
||||
}
|
||||
|
||||
NEO::ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;
|
||||
NEO::MockDevice *neoDevice = nullptr;
|
||||
L0::Device *device = nullptr;
|
||||
MockMemoryManagerCommandQueueSBA *memoryManager = nullptr;
|
||||
const uint32_t rootDeviceIndex = 1u;
|
||||
const uint32_t numRootDevices = 2u;
|
||||
};
|
||||
|
||||
HWTEST2_F(CommandQueueProgramSBATest, whenCreatingCommandQueueThenItIsInitialized, CommandQueueSBASupport) {
|
||||
ze_command_queue_desc_t desc = {};
|
||||
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
|
||||
auto csr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver());
|
||||
auto commandQueue = new MockCommandQueueHw<gfxCoreFamily>(device, csr.get(), &desc);
|
||||
commandQueue->initialize();
|
||||
|
||||
uint32_t alignedSize = 4096u;
|
||||
NEO::LinearStream child(commandQueue->commandStream->getSpace(alignedSize), alignedSize);
|
||||
|
||||
EXPECT_CALL(*memoryManager, getInternalHeapBaseAddress(rootDeviceIndex))
|
||||
.Times(1);
|
||||
|
||||
commandQueue->programGeneralStateBaseAddress(0u, child);
|
||||
|
||||
commandQueue->destroy();
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user