Compare commits
4 commits
20e42ee85b
...
f2e4c2c180
Author | SHA1 | Date | |
---|---|---|---|
f2e4c2c180 | |||
020ad29a8c | |||
4982dcfaa5 | |||
677148bdca |
6 changed files with 20 additions and 111 deletions
|
@ -1,11 +0,0 @@
|
|||
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_search_module(sirit QUIET IMPORTED_TARGET sirit)
|
||||
find_package_handle_standard_args(sirit
|
||||
REQUIRED_VARS sirit_LINK_LIBRARIES
|
||||
VERSION_VAR sirit_VERSION
|
||||
)
|
2
externals/cpmfile.json
vendored
2
externals/cpmfile.json
vendored
|
@ -10,7 +10,7 @@
|
|||
"repo": "eden-emulator/sirit",
|
||||
"sha": "db1f1e8ab5",
|
||||
"hash": "73eb3a042848c63a10656545797e85f40d142009dfb7827384548a385e1e28e1ac72f42b25924ce530d58275f8638554281e884d72f9c7aaf4ed08690a414b05",
|
||||
"find_args": "MODULE",
|
||||
"find_args": "CONFIG",
|
||||
"options": [
|
||||
"SIRIT_USE_SYSTEM_SPIRV_HEADERS ON"
|
||||
]
|
||||
|
|
|
@ -32,7 +32,6 @@ add_library(
|
|||
atomic_ops.h
|
||||
bit_cast.h
|
||||
bit_field.h
|
||||
bit_set.h
|
||||
bit_util.h
|
||||
bounded_threadsafe_queue.h
|
||||
cityhash.cpp
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <bit>
|
||||
|
||||
#include "common/alignment.h"
|
||||
#include "common/bit_util.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
namespace impl {
|
||||
|
||||
template <typename Storage, size_t N>
|
||||
class BitSet {
|
||||
|
||||
public:
|
||||
constexpr BitSet() = default;
|
||||
|
||||
constexpr void SetBit(size_t i) {
|
||||
this->words[i / FlagsPerWord] |= GetBitMask(i % FlagsPerWord);
|
||||
}
|
||||
|
||||
constexpr void ClearBit(size_t i) {
|
||||
this->words[i / FlagsPerWord] &= ~GetBitMask(i % FlagsPerWord);
|
||||
}
|
||||
|
||||
constexpr size_t CountLeadingZero() const {
|
||||
for (size_t i = 0; i < NumWords; i++) {
|
||||
if (this->words[i]) {
|
||||
return FlagsPerWord * i + CountLeadingZeroImpl(this->words[i]);
|
||||
}
|
||||
}
|
||||
return FlagsPerWord * NumWords;
|
||||
}
|
||||
|
||||
constexpr size_t GetNextSet(size_t n) const {
|
||||
for (size_t i = (n + 1) / FlagsPerWord; i < NumWords; i++) {
|
||||
Storage word = this->words[i];
|
||||
if (!IsAligned(n + 1, FlagsPerWord)) {
|
||||
word &= GetBitMask(n % FlagsPerWord) - 1;
|
||||
}
|
||||
if (word) {
|
||||
return FlagsPerWord * i + CountLeadingZeroImpl(word);
|
||||
}
|
||||
}
|
||||
return FlagsPerWord * NumWords;
|
||||
}
|
||||
|
||||
private:
|
||||
static_assert(std::is_unsigned_v<Storage>);
|
||||
static_assert(sizeof(Storage) <= sizeof(u64));
|
||||
|
||||
static constexpr size_t FlagsPerWord = BitSize<Storage>();
|
||||
static constexpr size_t NumWords = AlignUp(N, FlagsPerWord) / FlagsPerWord;
|
||||
|
||||
static constexpr auto CountLeadingZeroImpl(Storage word) {
|
||||
return std::countl_zero(static_cast<unsigned long long>(word)) -
|
||||
(BitSize<unsigned long long>() - FlagsPerWord);
|
||||
}
|
||||
|
||||
static constexpr Storage GetBitMask(size_t bit) {
|
||||
return Storage(1) << (FlagsPerWord - 1 - bit);
|
||||
}
|
||||
|
||||
std::array<Storage, NumWords> words{};
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
template <size_t N>
|
||||
using BitSet8 = impl::BitSet<u8, N>;
|
||||
|
||||
template <size_t N>
|
||||
using BitSet16 = impl::BitSet<u16, N>;
|
||||
|
||||
template <size_t N>
|
||||
using BitSet32 = impl::BitSet<u32, N>;
|
||||
|
||||
template <size_t N>
|
||||
using BitSet64 = impl::BitSet<u64, N>;
|
||||
|
||||
} // namespace Common
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
@ -5,10 +8,11 @@
|
|||
|
||||
#include <array>
|
||||
#include <bit>
|
||||
#include <bitset>
|
||||
#include <concepts>
|
||||
#include <cstddef>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/bit_set.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/concepts.h"
|
||||
|
||||
|
@ -159,7 +163,7 @@ public:
|
|||
}
|
||||
|
||||
if (m_queues[priority].PushBack(core, member)) {
|
||||
m_available_priorities[core].SetBit(priority);
|
||||
m_available_priorities[core].set(std::size_t(priority));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +176,7 @@ public:
|
|||
}
|
||||
|
||||
if (m_queues[priority].PushFront(core, member)) {
|
||||
m_available_priorities[core].SetBit(priority);
|
||||
m_available_priorities[core].set(std::size_t(priority));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,14 +189,14 @@ public:
|
|||
}
|
||||
|
||||
if (m_queues[priority].Remove(core, member)) {
|
||||
m_available_priorities[core].ClearBit(priority);
|
||||
m_available_priorities[core].reset(std::size_t(priority));
|
||||
}
|
||||
}
|
||||
|
||||
constexpr Member* GetFront(s32 core) const {
|
||||
ASSERT(IsValidCore(core));
|
||||
|
||||
const s32 priority = static_cast<s32>(m_available_priorities[core].CountLeadingZero());
|
||||
const s32 priority = s32((~m_available_priorities[core]).count());
|
||||
if (priority <= LowestPriority) {
|
||||
return m_queues[priority].GetFront(core);
|
||||
} else {
|
||||
|
@ -216,11 +220,14 @@ public:
|
|||
|
||||
Member* next = member->GetPriorityQueueEntry(core).GetNext();
|
||||
if (next == nullptr) {
|
||||
const s32 priority = static_cast<s32>(
|
||||
m_available_priorities[core].GetNextSet(member->GetPriority()));
|
||||
if (priority <= LowestPriority) {
|
||||
next = m_queues[priority].GetFront(core);
|
||||
}
|
||||
s32 priority = member->GetPriority() + 1;
|
||||
do {
|
||||
if (m_available_priorities[core][priority]) {
|
||||
next = m_queues[priority].GetFront(core);
|
||||
break;
|
||||
}
|
||||
++priority;
|
||||
} while (priority <= LowestPriority && priority < s32(m_available_priorities[core].size()));
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
@ -250,7 +257,7 @@ public:
|
|||
|
||||
private:
|
||||
std::array<KPerCoreQueue, NumPriority> m_queues{};
|
||||
std::array<Common::BitSet64<NumPriority>, NumCores> m_available_priorities{};
|
||||
std::array<std::bitset<NumPriority>, NumCores> m_available_priorities{};
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -374,7 +374,7 @@ endif()
|
|||
|
||||
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||
target_link_libraries(dynarmic
|
||||
PRIVATE
|
||||
PUBLIC
|
||||
fmt::fmt
|
||||
merry::mcl
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue