mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 00:37:46 +00:00
Merge branch 'dev' of github.com:xmrig/xmrig into dev
This commit is contained in:
commit
e76e75cdff
7 changed files with 38 additions and 14 deletions
|
@ -40,6 +40,12 @@ bool ocl_generic_rx_generator(const OclDevice &device, const Algorithm &algorith
|
|||
return false;
|
||||
}
|
||||
|
||||
// Mobile Ryzen APUs
|
||||
if (device.type() == OclDevice::Raven) {
|
||||
threads.add(OclThread(device.index(), (device.computeUnits() > 4) ? 256 : 128, 8, 1, true, true, 6));
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t mem = device.globalMemSize();
|
||||
auto config = RxAlgo::base(algorithm);
|
||||
bool gcnAsm = false;
|
||||
|
|
|
@ -52,7 +52,7 @@ xmrig::OclRxBaseRunner::OclRxBaseRunner(size_t index, const OclLaunchData &data)
|
|||
m_worksize = 8;
|
||||
}
|
||||
|
||||
if (data.device.type() == OclDevice::Vega_10 || data.device.type() == OclDevice::Vega_20) {
|
||||
if (data.device.type() == OclDevice::Vega_10 || data.device.type() == OclDevice::Vega_20 || data.device.type() == OclDevice::Raven) {
|
||||
m_gcn_version = 14;
|
||||
}
|
||||
|
||||
|
|
|
@ -300,6 +300,10 @@ namespace randomx {
|
|||
code = allocatedCode + (codeOffset.fetch_add(59 * 64) % CodeSize);
|
||||
memcpy(code, codePrologue, prologueSize);
|
||||
memcpy(code + epilogueOffset, codeEpilogue, epilogueSize);
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
mainLoopBounds.first = code + prologueSize;
|
||||
mainLoopBounds.second = code + epilogueOffset;
|
||||
# endif
|
||||
}
|
||||
|
||||
JitCompilerX86::~JitCompilerX86() {
|
||||
|
@ -386,7 +390,7 @@ namespace randomx {
|
|||
}
|
||||
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
xmrig::Rx::setMainLoopBounds(code + prologueSize, code + epilogueOffset);
|
||||
xmrig::Rx::setMainLoopBounds(mainLoopBounds);
|
||||
# endif
|
||||
|
||||
codePos = prologueSize;
|
||||
|
|
|
@ -69,6 +69,9 @@ namespace randomx {
|
|||
int registerUsage[RegistersCount];
|
||||
uint8_t* allocatedCode;
|
||||
uint8_t* code;
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
std::pair<const void*, const void*> mainLoopBounds;
|
||||
# endif
|
||||
int32_t codePos;
|
||||
uint32_t vm_flags;
|
||||
|
||||
|
|
|
@ -58,18 +58,13 @@ public:
|
|||
static void init(IRxListener *listener);
|
||||
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
static inline const std::pair<const void*, const void*> &mainLoopBounds() { return m_mainLoopBounds; }
|
||||
static inline void setMainLoopBounds(const void* loopBegin, const void* loopEnd) { m_mainLoopBounds.first = loopBegin; m_mainLoopBounds.second = loopEnd; }
|
||||
static void setMainLoopBounds(const std::pair<const void*, const void*>& bounds);
|
||||
# endif
|
||||
|
||||
private:
|
||||
static void msrInit(const RxConfig &config);
|
||||
static void msrDestroy();
|
||||
static void setupMainLoopExceptionFrame();
|
||||
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
static thread_local std::pair<const void*, const void*> m_mainLoopBounds;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -180,6 +180,9 @@ static bool wrmsr(const MsrItems &preset, bool save)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FIX_RYZEN
|
||||
static thread_local std::pair<const void*, const void*> mainLoopBounds = { nullptr, nullptr };
|
||||
|
||||
static void MainLoopHandler(int sig, siginfo_t *info, void *ucontext)
|
||||
{
|
||||
ucontext_t *ucp = (ucontext_t*) ucontext;
|
||||
|
@ -187,7 +190,7 @@ static void MainLoopHandler(int sig, siginfo_t *info, void *ucontext)
|
|||
LOG_VERBOSE(YELLOW_BOLD("%s at %p"), (sig == SIGSEGV) ? "SIGSEGV" : "SIGILL", ucp->uc_mcontext.gregs[REG_RIP]);
|
||||
|
||||
void* p = reinterpret_cast<void*>(ucp->uc_mcontext.gregs[REG_RIP]);
|
||||
const std::pair<const void*, const void*>& loopBounds = Rx::mainLoopBounds();
|
||||
const std::pair<const void*, const void*>& loopBounds = mainLoopBounds;
|
||||
|
||||
if ((loopBounds.first <= p) && (p < loopBounds.second)) {
|
||||
ucp->uc_mcontext.gregs[REG_RIP] = reinterpret_cast<size_t>(loopBounds.second);
|
||||
|
@ -197,8 +200,11 @@ static void MainLoopHandler(int sig, siginfo_t *info, void *ucontext)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
thread_local std::pair<const void*, const void*> Rx::m_mainLoopBounds = { nullptr, nullptr };
|
||||
void Rx::setMainLoopBounds(const std::pair<const void*, const void*>& bounds)
|
||||
{
|
||||
mainLoopBounds = bounds;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
@ -235,9 +241,11 @@ void xmrig::Rx::msrDestroy()
|
|||
|
||||
void xmrig::Rx::setupMainLoopExceptionFrame()
|
||||
{
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
struct sigaction act = {};
|
||||
act.sa_sigaction = MainLoopHandler;
|
||||
act.sa_flags = SA_RESTART | SA_SIGINFO;
|
||||
sigaction(SIGSEGV, &act, nullptr);
|
||||
sigaction(SIGILL, &act, nullptr);
|
||||
# endif
|
||||
}
|
||||
|
|
|
@ -303,6 +303,9 @@ static bool wrmsr(const MsrItems &preset, bool save)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FIX_RYZEN
|
||||
static thread_local std::pair<const void*, const void*> mainLoopBounds = { nullptr, nullptr };
|
||||
|
||||
static LONG WINAPI MainLoopHandler(_EXCEPTION_POINTERS *ExceptionInfo)
|
||||
{
|
||||
if (ExceptionInfo->ExceptionRecord->ExceptionCode == 0xC0000005) {
|
||||
|
@ -320,7 +323,7 @@ static LONG WINAPI MainLoopHandler(_EXCEPTION_POINTERS *ExceptionInfo)
|
|||
}
|
||||
|
||||
void* p = reinterpret_cast<void*>(ExceptionInfo->ContextRecord->Rip);
|
||||
const std::pair<const void*, const void*>& loopBounds = Rx::mainLoopBounds();
|
||||
const std::pair<const void*, const void*>& loopBounds = mainLoopBounds;
|
||||
|
||||
if ((loopBounds.first <= p) && (p < loopBounds.second)) {
|
||||
ExceptionInfo->ContextRecord->Rip = reinterpret_cast<DWORD64>(loopBounds.second);
|
||||
|
@ -330,8 +333,11 @@ static LONG WINAPI MainLoopHandler(_EXCEPTION_POINTERS *ExceptionInfo)
|
|||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
|
||||
thread_local std::pair<const void*, const void*> Rx::m_mainLoopBounds = { nullptr, nullptr };
|
||||
void Rx::setMainLoopBounds(const std::pair<const void*, const void*>& bounds)
|
||||
{
|
||||
mainLoopBounds = bounds;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
@ -368,5 +374,7 @@ void xmrig::Rx::msrDestroy()
|
|||
|
||||
void xmrig::Rx::setupMainLoopExceptionFrame()
|
||||
{
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
AddVectoredExceptionHandler(1, MainLoopHandler);
|
||||
# endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue