feature: switch to new aubstream createHardwareContext2 interface

Related-To: NEO-12257

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2024-08-26 12:12:07 +00:00
committed by Compute-Runtime-Automation
parent a47ca96a42
commit 3f6fc1d4d2
2 changed files with 12 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 Intel Corporation
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -12,13 +12,18 @@
#include "shared/source/os_interface/os_context.h"
#include "aubstream/allocation_params.h"
#include "aubstream/aubstream.h"
using namespace NEO;
HardwareContextController::HardwareContextController(aub_stream::AubManager &aubManager, OsContext &osContext, uint32_t flags) {
auto deviceBitfield = osContext.getDeviceBitfield();
for (uint32_t deviceIndex = 0; deviceIndex < deviceBitfield.size(); deviceIndex++) {
if (deviceBitfield.test(deviceIndex)) {
hardwareContexts.emplace_back(aubManager.createHardwareContext(deviceIndex, osContext.getEngineType(), flags));
aub_stream::CreateHardwareContext2Params params = {osContext.getContextId(), aub_stream::hardwareContextId::invalidContextId};
if (osContext.getPrimaryContext()) {
params.primaryContextId = osContext.getPrimaryContext()->getContextId();
}
hardwareContexts.emplace_back(aubManager.createHardwareContext2(params, deviceIndex, osContext.getEngineType(), flags));
}
}
}

View File

@@ -84,6 +84,11 @@ class MockAubManager : public aub_stream::AubManager {
return new MockHardwareContext(device);
}
HardwareContext *createHardwareContext2(const aub_stream::CreateHardwareContext2Params &params, uint32_t device, uint32_t engine, uint32_t flags) override {
contextFlags = flags;
return new MockHardwareContext(device);
}
bool releaseHardwareContext(HardwareContext *context) override {
delete context;
return true;