Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ message("-- CXX LINKER FLAGS : ${CMAKE_EXE_LINKER_FLAGS}")
message("-- CXX FLAGS : ${CMAKE_CXX_FLAGS}")
message("-- CXX FLAGS D : ${CMAKE_CXX_FLAGS_DEBUG} ")
message("-- CXX FLAGS R : ${CMAKE_CXX_FLAGS_RELEASE}")
if (WIN32)
message("-- VS Version : ${VISUAL_STUDIO_VERSION}")
endif()
message("*********************************************************************")
message("-- CPP Checker : ${CPPCHECK_EXECUTABLE}")
message("-- Clang Tidy : ${CLANG_TIDY_EXECUTABLE}")
Expand Down
4 changes: 0 additions & 4 deletions documentation/build/BUILD_LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
This guide builds the miner natively on Linux with the GPU SDKs and libraries
installed manually on the host.

> **Just want a binary?** See [Docker — Linux](BUILD_DOCKER_LINUX.md) instead — it
> builds the miner in a container and needs none of the manually installed
> libraries/compilers below.

## Libraries

- cuda 13.1
Expand Down
4 changes: 0 additions & 4 deletions documentation/build/BUILD_WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
This guide builds the miner natively on Windows with Visual Studio and the GPU SDKs
and libraries installed manually on the host.

> **Just want a binary?** See [Docker — Windows (cross-compile)](BUILD_DOCKER_WINDOWS.md)
> instead — it cross-compiles `miner.exe` from a Linux container and needs none of the
> manually installed libraries/compilers below.

## Libraries

- cuda 13.1
Expand Down
4 changes: 4 additions & 0 deletions sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ if (BUILD_NVIDIA AND BUILD_EXE_BENCHMARK)
benchmark/cuda/keccak/keccak_f800_lm7.cu
benchmark/cuda/keccak/keccak_f800_lm8.cu
benchmark/cuda/keccak/keccak_f800_lm9.cu
benchmark/cuda/noisy_gemm/noisy_gemm_naive_p1.cu
benchmark/cuda/noisy_gemm/noisy_gemm_naive_p2.cu
benchmark/cuda/noisy_gemm/noisy_gemm_naive_p3.cu
)

# Same gate as the crypto CUDA lib: clang-direct on the cross path (cuda_add_library
Expand Down Expand Up @@ -205,6 +208,7 @@ set(SOURCES_ALGO_CRYPTO ${SOURCES_ALGO_CRYPTO} PARENT_SCOPE)
set(SOURCES_ALGO_CRYPTO_TESTS ${SOURCES_ALGO_CRYPTO_TESTS} PARENT_SCOPE)
set(SOURCES_ALGO_ETHASH ${SOURCES_ALGO_ETHASH} PARENT_SCOPE)
set(SOURCES_ALGO_ETHASH_TESTS ${SOURCES_ALGO_ETHASH_TESTS} PARENT_SCOPE)
set(SOURCES_ALGO_NOISY_GEMM ${SOURCES_ALGO_NOISY_GEMM} PARENT_SCOPE)
set(SOURCES_ALGO_PROGPOW ${SOURCES_ALGO_PROGPOW} PARENT_SCOPE)
set(SOURCES_ALGO_TESTS ${SOURCES_ALGO_TESTS} PARENT_SCOPE)
set(SOURCES_API ${SOURCES_API} PARENT_SCOPE)
Expand Down
1 change: 1 addition & 0 deletions sources/algo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ add_subdirectory(blake3)
add_subdirectory(crypto)
add_subdirectory(ethash)
add_subdirectory(kheavyhash)
add_subdirectory(noisy_gemm)
add_subdirectory(progpow)
add_subdirectory(tests)

Expand Down
9 changes: 8 additions & 1 deletion sources/algo/blake3/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
# PoW oracle (algo/blake3/blake3_pow.cpp) and the shared crypto BLAKE3 KAT
# (algo/crypto/opencl/tests); any consumer can link the canonical blake3_ref target.
# blake3_neon.c is ARM-only and excluded on x86.
project(blake3_ref C)
project(blake3_ref CXX)

set_source_files_properties(
blake3.c
blake3_portable.c
blake3_dispatch.c
PROPERTIES LANGUAGE CXX
)

add_library(blake3_ref STATIC
blake3.c
Expand Down
19 changes: 10 additions & 9 deletions sources/algo/blake3/cpu/blake3.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ INLINE size_t chunk_state_fill_buf(blake3_chunk_state *self,

INLINE uint8_t chunk_state_maybe_start_flag(const blake3_chunk_state *self) {
if (self->blocks_compressed == 0) {
return CHUNK_START;
return static_cast<uint8_t>(Blake3Flags::CHUNK_START);
} else {
return 0;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ INLINE void output_root_bytes(const output_t *self, uint64_t seek, uint8_t *out,
uint8_t wide_buf[64];
while (out_len > 0) {
blake3_compress_xof(self->input_cv, self->block, self->block_len,
output_block_counter, self->flags | ROOT, wide_buf);
output_block_counter, self->flags | static_cast<uint8_t>(Blake3Flags::ROOT), wide_buf);
size_t available_bytes = 64 - offset_within_block;
size_t memcpy_len;
if (out_len > available_bytes) {
Expand Down Expand Up @@ -146,14 +146,14 @@ INLINE void chunk_state_update(blake3_chunk_state *self, const uint8_t *input,

INLINE output_t chunk_state_output(const blake3_chunk_state *self) {
uint8_t block_flags =
self->flags | chunk_state_maybe_start_flag(self) | CHUNK_END;
self->flags | chunk_state_maybe_start_flag(self) | static_cast<uint8_t>(Blake3Flags::CHUNK_END);
return make_output(self->cv, self->buf, self->buf_len, self->chunk_counter,
block_flags);
}

INLINE output_t parent_output(const uint8_t block[BLAKE3_BLOCK_LEN],
const uint32_t key[8], uint8_t flags) {
return make_output(key, block, BLAKE3_BLOCK_LEN, 0, flags | PARENT);
return make_output(key, block, BLAKE3_BLOCK_LEN, 0, flags | static_cast<uint8_t>(Blake3Flags::PARENT));
}

// Given some input larger than one chunk, return the number of bytes that
Expand Down Expand Up @@ -190,7 +190,8 @@ INLINE size_t compress_chunks_parallel(const uint8_t *input, size_t input_len,

blake3_hash_many(chunks_array, chunks_array_len,
BLAKE3_CHUNK_LEN / BLAKE3_BLOCK_LEN, key, chunk_counter,
true, flags, CHUNK_START, CHUNK_END, out);
true, flags, static_cast<uint8_t>(Blake3Flags::CHUNK_START),
static_cast<uint8_t>(Blake3Flags::CHUNK_END), out);

// Hash the remaining partial chunk, if there is one. Note that the empty
// chunk (meaning the empty message) is a different codepath.
Expand Down Expand Up @@ -233,7 +234,7 @@ INLINE size_t compress_parents_parallel(const uint8_t *child_chaining_values,

blake3_hash_many(parents_array, parents_array_len, 1, key,
0, // Parents always use counter 0.
false, flags | PARENT,
false, flags | static_cast<uint8_t>(Blake3Flags::PARENT),
0, // Parents have no start flags.
0, // Parents have no end flags.
out);
Expand Down Expand Up @@ -377,19 +378,19 @@ void blake3_hasher_init_keyed(blake3_hasher *self,
const uint8_t key[BLAKE3_KEY_LEN]) {
uint32_t key_words[8];
load_key_words(key, key_words);
hasher_init_base(self, key_words, KEYED_HASH);
hasher_init_base(self, key_words, static_cast<uint8_t>(Blake3Flags::KEYED_HASH));
}

void blake3_hasher_init_derive_key_raw(blake3_hasher *self, const void *context,
size_t context_len) {
blake3_hasher context_hasher;
hasher_init_base(&context_hasher, IV, DERIVE_KEY_CONTEXT);
hasher_init_base(&context_hasher, IV, static_cast<uint8_t>(Blake3Flags::DERIVE_KEY_CONTEXT));
blake3_hasher_update(&context_hasher, context, context_len);
uint8_t context_key[BLAKE3_KEY_LEN];
blake3_hasher_finalize(&context_hasher, context_key, BLAKE3_KEY_LEN);
uint32_t context_key_words[8];
load_key_words(context_key, context_key_words);
hasher_init_base(self, context_key_words, DERIVE_KEY_MATERIAL);
hasher_init_base(self, context_key_words, static_cast<uint8_t>(Blake3Flags::DERIVE_KEY_MATERIAL));
}

void blake3_hasher_init_derive_key(blake3_hasher *self, const char *context) {
Expand Down
2 changes: 1 addition & 1 deletion sources/algo/blake3/cpu/blake3.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef BLAKE3_H
#if !defined(BLAKE3_H)
#define BLAKE3_H

#include <stddef.h>
Expand Down
Loading
Loading