2020-08-20 18:02:29 +08:00
|
|
|
/*
|
2021-01-21 20:10:13 +08:00
|
|
|
* Copyright (C) 2020-2021 Intel Corporation
|
2020-08-20 18:02:29 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "shared/source/os_interface/device_factory.h"
|
|
|
|
#include "shared/source/os_interface/os_context.h"
|
2021-01-21 20:10:13 +08:00
|
|
|
#include "shared/test/common/fixtures/device_fixture.h"
|
2021-08-12 01:36:00 +08:00
|
|
|
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
2020-08-20 18:02:29 +08:00
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
using namespace NEO;
|
|
|
|
|
2021-03-31 02:11:00 +08:00
|
|
|
namespace CpuIntrinsicsTests {
|
2020-08-20 18:02:29 +08:00
|
|
|
extern std::atomic<uintptr_t> lastClFlushedPtr;
|
2021-03-31 02:11:00 +08:00
|
|
|
}
|
2020-08-20 18:02:29 +08:00
|
|
|
|
|
|
|
struct DirectSubmissionFixture : public DeviceFixture {
|
|
|
|
void SetUp() {
|
|
|
|
DeviceFixture::SetUp();
|
|
|
|
DeviceFactory::prepareDeviceEnvironments(*pDevice->getExecutionEnvironment());
|
|
|
|
|
2021-08-12 01:36:00 +08:00
|
|
|
osContext.reset(OsContext::create(nullptr, 0u,
|
|
|
|
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::ThreadGroup, pDevice->getDeviceBitfield())));
|
2020-08-20 18:02:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<OsContext> osContext;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DirectSubmissionDispatchBufferFixture : public DirectSubmissionFixture {
|
|
|
|
void SetUp() {
|
|
|
|
DirectSubmissionFixture::SetUp();
|
|
|
|
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
|
|
|
const AllocationProperties commandBufferProperties{pDevice->getRootDeviceIndex(), 0x1000,
|
|
|
|
GraphicsAllocation::AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()};
|
|
|
|
commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandBufferProperties);
|
|
|
|
|
|
|
|
batchBuffer.endCmdPtr = &bbStart[0];
|
|
|
|
batchBuffer.commandBufferAllocation = commandBuffer;
|
|
|
|
batchBuffer.usedSize = 0x40;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TearDown() {
|
|
|
|
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
|
|
|
memoryManager->freeGraphicsMemory(commandBuffer);
|
|
|
|
|
|
|
|
DirectSubmissionFixture::TearDown();
|
|
|
|
}
|
|
|
|
|
|
|
|
BatchBuffer batchBuffer;
|
|
|
|
uint8_t bbStart[64];
|
|
|
|
GraphicsAllocation *commandBuffer;
|
|
|
|
};
|