mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
Merge pull request #1243 from komatom/evo_globalmemsize_fix
Fixes OclDevice::globalMemSize() that sometimes returns 0
This commit is contained in:
commit
ea6d9073b7
2 changed files with 9 additions and 21 deletions
|
@ -132,6 +132,8 @@ xmrig::OclDevice::OclDevice(uint32_t index, cl_device_id id, cl_platform_id plat
|
|||
m_board(OclLib::getString(id, 0x4038 /* CL_DEVICE_BOARD_NAME_AMD */)),
|
||||
m_name(OclLib::getString(id, CL_DEVICE_NAME)),
|
||||
m_vendor(OclLib::getString(id, CL_DEVICE_VENDOR)),
|
||||
m_maxMemoryAlloc(OclLib::getUlong(id, CL_DEVICE_MAX_MEM_ALLOC_SIZE)),
|
||||
m_globalMemory(OclLib::getUlong(id, CL_DEVICE_GLOBAL_MEM_SIZE)),
|
||||
m_computeUnits(OclLib::getUint(id, CL_DEVICE_MAX_COMPUTE_UNITS, 1)),
|
||||
m_index(index)
|
||||
{
|
||||
|
@ -155,24 +157,6 @@ xmrig::OclDevice::OclDevice(uint32_t index, cl_device_id id, cl_platform_id plat
|
|||
}
|
||||
|
||||
|
||||
size_t xmrig::OclDevice::freeMemSize() const
|
||||
{
|
||||
return std::min(maxMemAllocSize(), globalMemSize());
|
||||
}
|
||||
|
||||
|
||||
size_t xmrig::OclDevice::globalMemSize() const
|
||||
{
|
||||
return OclLib::getUlong(id(), CL_DEVICE_GLOBAL_MEM_SIZE);
|
||||
}
|
||||
|
||||
|
||||
size_t xmrig::OclDevice::maxMemAllocSize() const
|
||||
{
|
||||
return OclLib::getUlong(id(), CL_DEVICE_MAX_MEM_ALLOC_SIZE);
|
||||
}
|
||||
|
||||
|
||||
xmrig::String xmrig::OclDevice::printableName() const
|
||||
{
|
||||
const size_t size = m_board.size() + m_name.size() + 64;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "backend/opencl/wrappers/OclVendor.h"
|
||||
#include "base/tools/String.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using cl_device_id = struct _cl_device_id *;
|
||||
using cl_platform_id = struct _cl_platform_id *;
|
||||
|
@ -62,9 +63,6 @@ public:
|
|||
OclDevice() = delete;
|
||||
OclDevice(uint32_t index, cl_device_id id, cl_platform_id platform);
|
||||
|
||||
size_t freeMemSize() const;
|
||||
size_t globalMemSize() const;
|
||||
size_t maxMemAllocSize() const;
|
||||
String printableName() const;
|
||||
uint32_t clock() const;
|
||||
void generate(const Algorithm &algorithm, OclThreads &threads) const;
|
||||
|
@ -78,6 +76,9 @@ public:
|
|||
inline OclVendor vendorId() const { return m_vendorId; }
|
||||
inline Type type() const { return m_type; }
|
||||
inline uint32_t computeUnits() const { return m_computeUnits; }
|
||||
inline size_t freeMemSize() const { return std::min(maxMemAllocSize(), globalMemSize()); }
|
||||
inline size_t globalMemSize() const { return m_globalMemory; }
|
||||
inline size_t maxMemAllocSize() const { return m_maxMemoryAlloc; }
|
||||
inline uint32_t index() const { return m_index; }
|
||||
|
||||
# ifdef XMRIG_FEATURE_API
|
||||
|
@ -90,6 +91,9 @@ private:
|
|||
const String m_board;
|
||||
const String m_name;
|
||||
const String m_vendor;
|
||||
const size_t m_freeMemory = 0;
|
||||
const size_t m_maxMemoryAlloc = 0;
|
||||
const size_t m_globalMemory = 0;
|
||||
const uint32_t m_computeUnits = 1;
|
||||
const uint32_t m_index = 0;
|
||||
OclVendor m_vendorId = OCL_VENDOR_UNKNOWN;
|
||||
|
|
Loading…
Reference in a new issue