#904 Initial support for "cn-pico/trtl".
This commit is contained in:
parent
ca43d155d8
commit
36b01f136f
8 changed files with 141 additions and 35 deletions
|
@ -6,6 +6,7 @@
|
|||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -22,8 +23,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CRYPTONIGHT_CONSTANTS_H__
|
||||
#define __CRYPTONIGHT_CONSTANTS_H__
|
||||
#ifndef XMRIG_CRYPTONIGHT_CONSTANTS_H
|
||||
#define XMRIG_CRYPTONIGHT_CONSTANTS_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -49,11 +50,17 @@ constexpr const size_t CRYPTONIGHT_HEAVY_MEMORY = 4 * 1024 * 1024;
|
|||
constexpr const uint32_t CRYPTONIGHT_HEAVY_MASK = 0x3FFFF0;
|
||||
constexpr const uint32_t CRYPTONIGHT_HEAVY_ITER = 0x40000;
|
||||
|
||||
constexpr const size_t CRYPTONIGHT_PICO_MEMORY = 256 * 1024;
|
||||
constexpr const uint32_t CRYPTONIGHT_PICO_MASK = 0x1FFF0;
|
||||
constexpr const uint32_t CRYPTONIGHT_PICO_ITER = 0x40000;
|
||||
constexpr const uint32_t CRYPTONIGHT_TRTL_ITER = 0x10000;
|
||||
|
||||
|
||||
template<Algo ALGO> inline constexpr size_t cn_select_memory() { return 0; }
|
||||
template<> inline constexpr size_t cn_select_memory<CRYPTONIGHT>() { return CRYPTONIGHT_MEMORY; }
|
||||
template<> inline constexpr size_t cn_select_memory<CRYPTONIGHT_LITE>() { return CRYPTONIGHT_LITE_MEMORY; }
|
||||
template<> inline constexpr size_t cn_select_memory<CRYPTONIGHT_HEAVY>() { return CRYPTONIGHT_HEAVY_MEMORY; }
|
||||
template<> inline constexpr size_t cn_select_memory<CRYPTONIGHT_PICO>() { return CRYPTONIGHT_PICO_MEMORY; }
|
||||
|
||||
|
||||
inline size_t cn_select_memory(Algo algorithm)
|
||||
|
@ -69,6 +76,9 @@ inline size_t cn_select_memory(Algo algorithm)
|
|||
case CRYPTONIGHT_HEAVY:
|
||||
return CRYPTONIGHT_HEAVY_MEMORY;
|
||||
|
||||
case CRYPTONIGHT_PICO:
|
||||
return CRYPTONIGHT_PICO_MEMORY;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -81,6 +91,7 @@ template<Algo ALGO> inline constexpr uint32_t cn_select_mask() { retur
|
|||
template<> inline constexpr uint32_t cn_select_mask<CRYPTONIGHT>() { return CRYPTONIGHT_MASK; }
|
||||
template<> inline constexpr uint32_t cn_select_mask<CRYPTONIGHT_LITE>() { return CRYPTONIGHT_LITE_MASK; }
|
||||
template<> inline constexpr uint32_t cn_select_mask<CRYPTONIGHT_HEAVY>() { return CRYPTONIGHT_HEAVY_MASK; }
|
||||
template<> inline constexpr uint32_t cn_select_mask<CRYPTONIGHT_PICO>() { return CRYPTONIGHT_PICO_MASK; }
|
||||
|
||||
|
||||
inline uint32_t cn_select_mask(Algo algorithm)
|
||||
|
@ -96,6 +107,9 @@ inline uint32_t cn_select_mask(Algo algorithm)
|
|||
case CRYPTONIGHT_HEAVY:
|
||||
return CRYPTONIGHT_HEAVY_MASK;
|
||||
|
||||
case CRYPTONIGHT_PICO:
|
||||
return CRYPTONIGHT_PICO_MASK;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -118,6 +132,7 @@ template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_1>
|
|||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_0>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_XHV>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_TUBE>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_PICO, VARIANT_TRTL>() { return CRYPTONIGHT_TRTL_ITER; }
|
||||
|
||||
|
||||
inline uint32_t cn_select_iter(Algo algorithm, Variant variant)
|
||||
|
@ -130,6 +145,9 @@ inline uint32_t cn_select_iter(Algo algorithm, Variant variant)
|
|||
case VARIANT_RTO:
|
||||
return CRYPTONIGHT_XAO_ITER;
|
||||
|
||||
case VARIANT_TRTL:
|
||||
return CRYPTONIGHT_TRTL_ITER;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -164,9 +182,10 @@ template<> inline constexpr Variant cn_base_variant<VARIANT_XAO>() { return VA
|
|||
template<> inline constexpr Variant cn_base_variant<VARIANT_RTO>() { return VARIANT_1; }
|
||||
template<> inline constexpr Variant cn_base_variant<VARIANT_2>() { return VARIANT_2; }
|
||||
template<> inline constexpr Variant cn_base_variant<VARIANT_HALF>() { return VARIANT_2; }
|
||||
template<> inline constexpr Variant cn_base_variant<VARIANT_TRTL>() { return VARIANT_2; }
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* __CRYPTONIGHT_CONSTANTS_H__ */
|
||||
#endif /* XMRIG_CRYPTONIGHT_CONSTANTS_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue