SPU LLVM: Improve runtime SPU compilation preferences (#15250)

This commit is contained in:
Elad.Ash 2024-02-28 08:28:49 +02:00 committed by GitHub
parent 414a354511
commit 75ef154c12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 59 additions and 4 deletions

View file

@ -379,8 +379,8 @@ public:
return m_head != 0;
}
template <typename... Args>
void push(Args&&... args)
template <bool Notify = true, typename... Args>
bool push(Args&&... args)
{
auto oldv = m_head.load();
auto item = new lf_queue_item<T>(load(oldv), std::forward<Args>(args)...);
@ -390,9 +390,19 @@ public:
item->m_link = load(oldv);
}
if (!oldv)
if (!oldv && Notify)
{
// Notify only if queue was empty
notify(true);
}
return !oldv;
}
void notify(bool force = false)
{
if (force || operator bool())
{
utils::bless<atomic_t<u32>>(&m_head)[1].notify_one();
}
}