test: improve aub tests - do not reset csrs

- CSRs do not need to be reset to Aub/Tbx csrs, they are already created
properly
- only AUBFixture in L0 and OCL is changed

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe 2023-11-20 14:49:53 +00:00 committed by Compute-Runtime-Automation
parent 5c7875bbb9
commit 70beb8834d
5 changed files with 36 additions and 49 deletions

View File

@ -26,15 +26,6 @@
namespace L0 {
AUBFixtureL0::AUBFixtureL0() = default;
AUBFixtureL0::~AUBFixtureL0() = default;
void AUBFixtureL0::prepareCopyEngines(NEO::MockDevice &device, const std::string &filename) {
for (auto i = 0u; i < device.allEngines.size(); i++) {
if (NEO::EngineHelpers::isBcs(device.allEngines[i].getEngineType())) {
NEO::CommandStreamReceiver *pBcsCommandStreamReceiver = nullptr;
pBcsCommandStreamReceiver = NEO::AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
device.resetCommandStreamReceiver(pBcsCommandStreamReceiver, i);
}
}
}
void AUBFixtureL0::setUp() {
setUp(NEO::defaultHwInfo.get(), false);
@ -67,14 +58,7 @@ void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEn
neoDevice = NEO::MockDevice::createWithExecutionEnvironment<NEO::MockDevice>(&hwInfo, executionEnvironment, 0u);
if (NEO::testMode == NEO::TestMode::AubTestsWithTbx) {
this->csr = NEO::TbxCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0, neoDevice->getDeviceBitfield());
} else {
this->csr = NEO::AUBCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0, neoDevice->getDeviceBitfield());
}
neoDevice->resetCommandStreamReceiver(this->csr);
prepareCopyEngines(*neoDevice, strfilename.str());
this->csr = neoDevice->getDefaultEngine().commandStreamReceiver;
NEO::DeviceVector devices;
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));

View File

@ -50,7 +50,6 @@ class AUBFixtureL0 {
void setUp();
void setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEnabled);
void tearDown();
static void prepareCopyEngines(NEO::MockDevice &device, const std::string &filename);
template <typename FamilyType>
NEO::CommandStreamReceiverSimulatedCommonHw<FamilyType> *getSimulatedCsr() const {

View File

@ -7,7 +7,9 @@
#include "opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.h"
#include "shared/source/command_stream/aub_command_stream_receiver.h"
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/command_stream/tbx_command_stream_receiver.h"
#include "shared/source/device/device.h"
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/gfx_core_helper.h"
@ -21,6 +23,31 @@
namespace NEO {
CommandStreamReceiver *AUBCommandStreamFixture::prepareComputeEngine(MockDevice &device, const std::string &filename) {
CommandStreamReceiver *pCommandStreamReceiver = nullptr;
if (testMode == TestMode::AubTestsWithTbx) {
pCommandStreamReceiver = TbxCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
} else {
pCommandStreamReceiver = AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
}
device.resetCommandStreamReceiver(pCommandStreamReceiver);
return pCommandStreamReceiver;
}
void AUBCommandStreamFixture::prepareCopyEngines(MockDevice &device, const std::string &filename) {
for (auto i = 0u; i < device.allEngines.size(); i++) {
if (EngineHelpers::isBcs(device.allEngines[i].getEngineType())) {
CommandStreamReceiver *pBcsCommandStreamReceiver = nullptr;
if (testMode == TestMode::AubTestsWithTbx) {
pBcsCommandStreamReceiver = TbxCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
} else {
pBcsCommandStreamReceiver = AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
}
device.resetCommandStreamReceiver(pBcsCommandStreamReceiver, i);
}
}
}
void AUBCommandStreamFixture::setUp(CommandQueue *pCmdQ) {
ASSERT_NE(pCmdQ, nullptr);
auto &device = reinterpret_cast<MockDevice &>(pCmdQ->getDevice());
@ -33,10 +60,10 @@ void AUBCommandStreamFixture::setUp(CommandQueue *pCmdQ) {
strfilename << ApiSpecificConfig::getAubPrefixForSpecificApi();
strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << gfxCoreHelper.getCsTraits(engineType).name;
pCommandStreamReceiver = AUBFixture::prepareComputeEngine(device, strfilename.str());
pCommandStreamReceiver = prepareComputeEngine(device, strfilename.str());
ASSERT_NE(nullptr, pCommandStreamReceiver);
AUBFixture::prepareCopyEngines(device, strfilename.str());
prepareCopyEngines(device, strfilename.str());
CommandStreamFixture::setUp(pCmdQ);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -15,6 +15,7 @@
#include "shared/source/memory_manager/memory_banks.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/mocks/mock_allocation_properties.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/tests_configuration.h"
#include "opencl/test/unit_test/command_stream/command_stream_fixture.h"
@ -26,6 +27,9 @@ class CommandStreamReceiver;
class AUBCommandStreamFixture : public CommandStreamFixture {
public:
static CommandStreamReceiver *prepareComputeEngine(MockDevice &device, const std::string &filename);
static void prepareCopyEngines(MockDevice &device, const std::string &filename);
void setUp(CommandQueue *pCommandQueue);
void tearDown();

View File

@ -7,7 +7,6 @@
#pragma once
#include "shared/source/aub_mem_dump/aub_mem_dump.h"
#include "shared/source/command_stream/aub_command_stream_receiver.h"
#include "shared/source/command_stream/aub_command_stream_receiver_hw.h"
#include "shared/source/command_stream/command_stream_receiver_with_aub_dump.h"
#include "shared/source/command_stream/tbx_command_stream_receiver_hw.h"
@ -29,30 +28,6 @@ namespace NEO {
class AUBFixture : public CommandQueueHwFixture {
public:
static CommandStreamReceiver *prepareComputeEngine(MockDevice &device, const std::string &filename) {
CommandStreamReceiver *pCommandStreamReceiver = nullptr;
if (testMode == TestMode::AubTestsWithTbx) {
pCommandStreamReceiver = TbxCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
} else {
pCommandStreamReceiver = AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
}
device.resetCommandStreamReceiver(pCommandStreamReceiver);
return pCommandStreamReceiver;
}
static void prepareCopyEngines(MockDevice &device, const std::string &filename) {
for (auto i = 0u; i < device.allEngines.size(); i++) {
if (EngineHelpers::isBcs(device.allEngines[i].getEngineType())) {
CommandStreamReceiver *pBcsCommandStreamReceiver = nullptr;
if (testMode == TestMode::AubTestsWithTbx) {
pBcsCommandStreamReceiver = TbxCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
} else {
pBcsCommandStreamReceiver = AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
}
device.resetCommandStreamReceiver(pBcsCommandStreamReceiver, i);
}
}
}
void setUp(const HardwareInfo *hardwareInfo) {
const HardwareInfo &hwInfo = hardwareInfo ? *hardwareInfo : *defaultHwInfo;
@ -78,9 +53,7 @@ class AUBFixture : public CommandQueueHwFixture {
auto pDevice = MockDevice::create<MockDevice>(executionEnvironment, rootDeviceIndex);
device = std::make_unique<MockClDevice>(pDevice);
this->csr = prepareComputeEngine(*pDevice, strfilename.str());
prepareCopyEngines(*pDevice, strfilename.str());
this->csr = pDevice->getDefaultEngine().commandStreamReceiver;
CommandQueueHwFixture::setUp(AUBFixture::device.get(), cl_command_queue_properties(0));
}