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:
parent
b1ef2f70d6
commit
29464fb9ad
|
@ -41,8 +41,8 @@ void CommandQueueHw<gfxCoreFamily>::programGeneralStateBaseAddress(uint64_t gsba
|
|||
pcCmd->setDcFlushEnable(true);
|
||||
pcCmd->setCommandStreamerStallEnable(true);
|
||||
|
||||
auto gmmHelper = device->getNEODevice()->getGmmHelper();
|
||||
NEO::EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(*device->getNEODevice(), commandStream, true);
|
||||
NEO::Device *neoDevice = device->getNEODevice();
|
||||
NEO::EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(*neoDevice, commandStream, true);
|
||||
|
||||
NEO::StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(commandStream,
|
||||
nullptr,
|
||||
|
@ -51,9 +51,9 @@ void CommandQueueHw<gfxCoreFamily>::programGeneralStateBaseAddress(uint64_t gsba
|
|||
gsba,
|
||||
true,
|
||||
(device->getMOCS(true, false) >> 1),
|
||||
device->getDriverHandle()->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex()),
|
||||
neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex()),
|
||||
true,
|
||||
gmmHelper,
|
||||
neoDevice->getGmmHelper(),
|
||||
false);
|
||||
|
||||
gsbaInit = true;
|
||||
|
|
|
@ -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
|
|
@ -98,7 +98,7 @@ class MemoryManager {
|
|||
virtual uint64_t getLocalMemorySize(uint32_t rootDeviceIndex) = 0;
|
||||
|
||||
uint64_t getMaxApplicationAddress() { return is64bit ? MemoryConstants::max64BitAppAddress : MemoryConstants::max32BitAppAddress; };
|
||||
uint64_t getInternalHeapBaseAddress(uint32_t rootDeviceIndex) { return getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY); }
|
||||
MOCKABLE_VIRTUAL uint64_t getInternalHeapBaseAddress(uint32_t rootDeviceIndex) { return getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY); }
|
||||
uint64_t getExternalHeapBaseAddress(uint32_t rootDeviceIndex) { return getGfxPartition(rootDeviceIndex)->getHeapBase(HeapIndex::HEAP_EXTERNAL); }
|
||||
|
||||
bool isLimitedRange(uint32_t rootDeviceIndex) { return getGfxPartition(rootDeviceIndex)->isLimitedRange(); }
|
||||
|
|
Loading…
Reference in New Issue