mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 18:44:06 +08:00
fix: use std::thread detach instead of astd::async for init builtin async
Resolves: GSD-7023 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f3a3ba5cb2
commit
7bd33af394
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2023 Intel Corporation
|
* Copyright (C) 2020-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -184,7 +184,14 @@ void BuiltinFunctionsLibImpl::initBuiltinImageKernel(ImageBuiltin func) {
|
|||||||
BuiltinFunctionsLibImpl::BuiltinFunctionsLibImpl(Device *device, NEO::BuiltIns *builtInsLib) : device(device), builtInsLib(builtInsLib) {
|
BuiltinFunctionsLibImpl::BuiltinFunctionsLibImpl(Device *device, NEO::BuiltIns *builtInsLib) : device(device), builtInsLib(builtInsLib) {
|
||||||
if (initBuiltinsAsyncEnabled(device)) {
|
if (initBuiltinsAsyncEnabled(device)) {
|
||||||
this->initAsyncComplete = false;
|
this->initAsyncComplete = false;
|
||||||
this->initAsync = std::async(std::launch::async, &BuiltinFunctionsLibImpl::initBuiltinKernel, this, Builtin::fillBufferImmediate);
|
|
||||||
|
auto initFunc = [this]() {
|
||||||
|
this->initBuiltinKernel(Builtin::fillBufferImmediate);
|
||||||
|
this->initAsync.store(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
std::thread initAsyncThread(initFunc);
|
||||||
|
initAsyncThread.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +276,8 @@ std::unique_ptr<BuiltinFunctionsLibImpl::BuiltinData> BuiltinFunctionsLibImpl::l
|
|||||||
|
|
||||||
void BuiltinFunctionsLibImpl::ensureInitCompletion() {
|
void BuiltinFunctionsLibImpl::ensureInitCompletion() {
|
||||||
if (!this->initAsyncComplete) {
|
if (!this->initAsyncComplete) {
|
||||||
this->initAsync.wait();
|
while (!this->initAsync.load()) {
|
||||||
|
}
|
||||||
this->initAsyncComplete = true;
|
this->initAsyncComplete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2023 Intel Corporation
|
* Copyright (C) 2020-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -47,8 +47,8 @@ struct BuiltinFunctionsLibImpl : BuiltinFunctionsLib {
|
|||||||
Device *device;
|
Device *device;
|
||||||
NEO::BuiltIns *builtInsLib;
|
NEO::BuiltIns *builtInsLib;
|
||||||
|
|
||||||
std::future<void> initAsync = {};
|
|
||||||
bool initAsyncComplete = true;
|
bool initAsyncComplete = true;
|
||||||
|
std::atomic_bool initAsync = false;
|
||||||
};
|
};
|
||||||
struct BuiltinFunctionsLibImpl::BuiltinData {
|
struct BuiltinFunctionsLibImpl::BuiltinData {
|
||||||
MOCKABLE_VIRTUAL ~BuiltinData();
|
MOCKABLE_VIRTUAL ~BuiltinData();
|
||||||
|
|||||||
Reference in New Issue
Block a user