Skip to content

Commit

Permalink
tiny-keccak for Kas and Astrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tritonn204 committed Sep 29, 2024
1 parent 99459ae commit 703db8e
Show file tree
Hide file tree
Showing 23 changed files with 1,194 additions and 383 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ if (WITH_HIP)
# target_link_libraries(${PROJECT_NAME}-${PROJECT_VERSION} ${CMAKE_BINARY_DIR}/tnn_hip.lib)
# target_link_libraries(${PROJECT_NAME}-${PROJECT_VERSION} ${CMAKE_BINARY_DIR}/libtnn_hip.a)
else()
set(TNN_OUTPUT_NAME "tnn-miner-${INTERNAL_TNN_VERSION}_cpu")
# set(TNN_OUTPUT_NAME "tnn-miner-${INTERNAL_TNN_VERSION}_cpu")
set(TNN_OUTPUT_NAME "tnn-miner-cpu")
add_executable(${TNN_OUTPUT_NAME} ${SOURCES_CORE} ${SOURCES_NET} ${SOURCES_CRYPTO} ${HEADERS_CRYPTO})

setup_target_libraries(${TNN_OUTPUT_NAME})
Expand All @@ -504,4 +505,6 @@ else()
# Set output name
set_target_properties(${TNN_OUTPUT_NAME} PROPERTIES OUTPUT_NAME ${TNN_OUTPUT_NAME})

endif()
endif()

unset(HIP_LANG CACHE)
4 changes: 3 additions & 1 deletion cmake/hip-crypto/hip-crypto.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ if (WITH_HIP)
# DESTINATION ${CMAKE_INSTALL_PREFIX}
# )

if (CMAKE_HIP_PLATFORM MATCHES nvidia OR CMAKE_HIP_PLATFORM MATCHES nvcc)
if (HIP_PLATFORM MATCHES nvidia OR HIP_PLATFORM MATCHES nvcc)
# set(TNN_RDC "-rdc=false")
else()
set(TNN_RDC "-fno-gpu-rdc")
endif()

set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} ${TNN_RDC}")
unset(TNN_RDC CACHE)

list(APPEND SOURCES_CRYPTO
${hipSources}
)
Expand Down
2 changes: 0 additions & 2 deletions include/hex.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// #include <cuda.h>
// #include <cuda_runtime.h>

// __host__ __forceinline__ CUDA hints
inline std::string hexStr(const unsigned char *data, int len)
{
static const char characters[] = "0123456789abcdef";
Expand Down Expand Up @@ -38,7 +37,6 @@ inline std::string hexStr(const unsigned char *data, int len)
// return result;
// }

// __host__ __device__ __forceinline__ CUDA hints
inline void hexstrToBytes(std::string s, unsigned char *b)
{
for (unsigned int i = 0; i < s.length(); i += 2)
Expand Down
11 changes: 5 additions & 6 deletions include/terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,10 @@ inline po::options_description get_prog_opts()
("test-randomx", "Run Tevador's reference RandomX tests")
;

// po::options_description astrix("Astrix", col_width);
// astrix.add_options()
// ("astrix", "Required for mining to Xatum pools on Xelis")
// ("xelis-bench", "Run a benchmark of xelis-hash with 1 thread")
// ("test-xelis", "Run the xelis-hash tests from the official source code")
// ;
po::options_description astrix("Astrix", col_width);
astrix.add_options()
("test-astrix", "Run a basic astrix-hash validation test")
;

po::options_description advanced("Advanced", col_width);
advanced.add_options()
Expand All @@ -203,6 +201,7 @@ inline po::options_description get_prog_opts()
general.add(spectre);
general.add(xelis);
general.add(randomX);
general.add(astrix);
general.add(advanced);
general.add(debug);
return general;
Expand Down
6 changes: 6 additions & 0 deletions include/tnn-common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ extern int64_t difficultyDev;
extern double doubleDiff;
extern double doubleDiffDev;

extern std::string HIP_names[32];
extern std::vector<std::atomic<int64_t>> HIP_counters;
extern std::vector<std::vector<int64_t>> HIP_rates5min;
extern std::vector<std::vector<int64_t>> HIP_rates1min;
extern std::vector<std::vector<int64_t>> HIP_rates30sec;

extern std::vector<int64_t> rate5min;
extern std::vector<int64_t> rate1min;
extern std::vector<int64_t> rate30sec;
Expand Down
Loading

0 comments on commit 703db8e

Please sign in to comment.