Fixed wrong OpenCL platform on macOS.

This commit is contained in:
XMRig 2020-02-15 04:32:32 +07:00
parent 5e444553b1
commit 311d3e1c18
No known key found for this signature in database
GPG key ID: 446A53638BE94409
3 changed files with 29 additions and 8 deletions

View file

@ -4,6 +4,7 @@
- [#1551](https://github.com/xmrig/xmrig/pull/1551) Added RandomX JIT for AMD Navi GPUs.
- Added health information for AMD GPUs (clocks/power/fan/temperature) via ADL (Windows) and sysfs (Linux).
- Fixed possible nicehash nonce overflow in some conditions.
- Fixed wrong OpenCL platform on macOS, option `platform` now ignored on this OS.
# v5.5.3
- [#1529](https://github.com/xmrig/xmrig/pull/1529) Fixed crash on Bulldozer CPUs.

View file

@ -35,14 +35,17 @@
namespace xmrig {
static const char *kAMD = "AMD";
static const char *kCache = "cache";
static const char *kDevicesHint = "devices-hint";
static const char *kEnabled = "enabled";
static const char *kINTEL = "INTEL";
static const char *kLoader = "loader";
#ifndef XMRIG_OS_APPLE
static const char *kAMD = "AMD";
static const char *kINTEL = "INTEL";
static const char *kNVIDIA = "NVIDIA";
static const char *kPlatform = "platform";
#endif
#ifdef XMRIG_FEATURE_ADL
static const char *kAdl = "adl";
@ -55,10 +58,11 @@ extern template class Threads<OclThreads>;
}
xmrig::OclConfig::OclConfig() :
m_platformVendor(kAMD)
{
}
#ifndef XMRIG_OS_APPLE
xmrig::OclConfig::OclConfig() : m_platformVendor(kAMD) {}
#else
xmrig::OclConfig::OclConfig() = default;
#endif
xmrig::OclPlatform xmrig::OclConfig::platform() const
@ -68,6 +72,7 @@ xmrig::OclPlatform xmrig::OclConfig::platform() const
return {};
}
# ifndef XMRIG_OS_APPLE
if (!m_platformVendor.isEmpty()) {
String search;
String vendor = m_platformVendor;
@ -97,6 +102,9 @@ xmrig::OclPlatform xmrig::OclConfig::platform() const
}
return {};
# else
return platforms[0];
# endif
}
@ -110,7 +118,10 @@ rapidjson::Value xmrig::OclConfig::toJSON(rapidjson::Document &doc) const
obj.AddMember(StringRef(kEnabled), m_enabled, allocator);
obj.AddMember(StringRef(kCache), m_cache, allocator);
obj.AddMember(StringRef(kLoader), m_loader.toJSON(), allocator);
# ifndef XMRIG_OS_APPLE
obj.AddMember(StringRef(kPlatform), m_platformVendor.isEmpty() ? Value(m_platformIndex) : m_platformVendor.toJSON(), allocator);
# endif
# ifdef XMRIG_FEATURE_ADL
obj.AddMember(StringRef(kAdl), m_adl, allocator);
@ -160,7 +171,10 @@ void xmrig::OclConfig::read(const rapidjson::Value &value)
m_cache = Json::getBool(value, kCache, m_cache);
m_loader = Json::getString(value, kLoader);
# ifndef XMRIG_OS_APPLE
setPlatform(Json::getValue(value, kPlatform));
# endif
setDevicesHint(Json::getString(value, kDevicesHint));
# ifdef XMRIG_FEATURE_ADL
@ -226,6 +240,7 @@ void xmrig::OclConfig::setDevicesHint(const char *devicesHint)
}
#ifndef XMRIG_OS_APPLE
void xmrig::OclConfig::setPlatform(const rapidjson::Value &platform)
{
if (platform.IsString()) {
@ -236,3 +251,4 @@ void xmrig::OclConfig::setPlatform(const rapidjson::Value &platform)
m_platformIndex = platform.GetUint();
}
}
#endif

View file

@ -58,16 +58,20 @@ public:
private:
void generate();
void setDevicesHint(const char *devicesHint);
void setPlatform(const rapidjson::Value &platform);
bool m_cache = true;
bool m_enabled = false;
bool m_shouldSave = false;
std::vector<uint32_t> m_devicesHint;
String m_loader;
String m_platformVendor;
Threads<OclThreads> m_threads;
# ifndef XMRIG_OS_APPLE
void setPlatform(const rapidjson::Value &platform);
String m_platformVendor;
uint32_t m_platformIndex = 0;
# endif
# ifdef XMRIG_FEATURE_ADL
bool m_adl = true;