diff --git a/icicle/backend/cpu/src/field/cpu_vec_ops.cpp b/icicle/backend/cpu/src/field/cpu_vec_ops.cpp index 1cd85443c..22c257023 100644 --- a/icicle/backend/cpu/src/field/cpu_vec_ops.cpp +++ b/icicle/backend/cpu/src/field/cpu_vec_ops.cpp @@ -368,7 +368,7 @@ class VectorOpTask : public TaskBase public: T m_intermidiate_res; // pointer to the output. Can be a vector or scalar pointer uint64_t m_idx_in_batch; // index in the batch. Used in intermediate res tasks -}; // class VectorOpTask +}; // class VectorOpTask #define NOF_OPERATIONS_PER_TASK 512 #define CONFIG_NOF_THREADS_KEY "n_threads" diff --git a/icicle/backend/cpu/src/hash/cpu_merkle_tree.cpp b/icicle/backend/cpu/src/hash/cpu_merkle_tree.cpp index d84d97a3a..180742218 100644 --- a/icicle/backend/cpu/src/hash/cpu_merkle_tree.cpp +++ b/icicle/backend/cpu/src/hash/cpu_merkle_tree.cpp @@ -50,9 +50,9 @@ namespace icicle { } } - ~CPUMerkleTreeBackend() { - for (auto& pair : m_map_segment_id_2_inputs) - { + ~CPUMerkleTreeBackend() + { + for (auto& pair : m_map_segment_id_2_inputs) { delete pair.second; // Ensure all dynamically allocated memory is freed } } diff --git a/icicle/include/icicle/fields/quartic_extension.h b/icicle/include/icicle/fields/quartic_extension.h index 344e9c8fd..43038d588 100644 --- a/icicle/include/icicle/fields/quartic_extension.h +++ b/icicle/include/icicle/fields/quartic_extension.h @@ -241,7 +241,7 @@ class QuarticExtensionField FF::reduce( (CONFIG::nonresidue_is_negative ? (FF::mul_wide(xs.real, x0) + FF::template mul_unsigned(FF::mul_wide(xs.im2, x2))) - : (FF::mul_wide(xs.real, x0))-FF::template mul_unsigned(FF::mul_wide(xs.im2, x2)))), + : (FF::mul_wide(xs.real, x0)) - FF::template mul_unsigned(FF::mul_wide(xs.im2, x2)))), FF::reduce( (CONFIG::nonresidue_is_negative ? FWide::neg(FF::template mul_unsigned(FF::mul_wide(xs.im3, x2))) diff --git a/icicle/include/icicle/fields/storage.h b/icicle/include/icicle/fields/storage.h index 097db881f..76245db16 100644 --- a/icicle/include/icicle/fields/storage.h +++ b/icicle/include/icicle/fields/storage.h @@ -16,7 +16,8 @@ struct #ifdef __CUDA_ARCH__ __align__(LIMBS_ALIGNMENT(1)) #endif - storage<1> { + storage<1> +{ static constexpr unsigned LC = 1; uint32_t limbs[1]; }; @@ -27,7 +28,8 @@ struct #ifdef __CUDA_ARCH__ __align__(LIMBS_ALIGNMENT(1)) #endif - storage<3> { + storage<3> +{ static constexpr unsigned LC = 3; uint32_t limbs[3]; }; @@ -38,7 +40,8 @@ struct #ifdef __CUDA_ARCH__ __align__(LIMBS_ALIGNMENT(LIMBS_COUNT)) #endif - storage { + storage +{ static_assert(LIMBS_COUNT % 2 == 0, "odd number of limbs is not supported\n"); static constexpr unsigned LC = LIMBS_COUNT; union { // works only with even LIMBS_COUNT @@ -52,6 +55,7 @@ struct #ifdef __CUDA_ARCH__ __align__(LIMBS_ALIGNMENT(LIMBS_COUNT)) #endif - storage_array { + storage_array +{ storage storages[OMEGAS_COUNT]; }; \ No newline at end of file diff --git a/icicle/tests/test_hash_api.cpp b/icicle/tests/test_hash_api.cpp index 7c1aeacc9..5f9a7e5db 100644 --- a/icicle/tests/test_hash_api.cpp +++ b/icicle/tests/test_hash_api.cpp @@ -460,8 +460,8 @@ void test_merkle_tree( << "Explicit leaf size should only be given when the given leaves array is a bytes array."; unsigned leaf_size = explicit_leaf_size > 1 ? explicit_leaf_size : sizeof(T); - auto prover_tree = MerkleTree::create(hashes, leaf_size, output_store_min_layer); - auto verifier_tree = MerkleTree::create(hashes, leaf_size, output_store_min_layer); + auto prover_tree = MerkleTree::create(hashes, leaf_size, output_store_min_layer); + auto verifier_tree = MerkleTree::create(hashes, leaf_size, output_store_min_layer); // assert that incorrect size fails if (config.padding_policy == PaddingPolicy::None) { @@ -913,7 +913,8 @@ TEST_F(HashApiTest, MerkleTreeLeavesOnDeviceTreeOnHost) } } -void deep_copy_byte_array_to_vec(const std::byte* src, std::size_t size, std::vector& dest) { +void deep_copy_byte_array_to_vec(const std::byte* src, std::size_t size, std::vector& dest) +{ dest.resize(size); std::memcpy(dest.data(), src, size); } @@ -966,15 +967,15 @@ TEST_F(HashApiTest, MerkleTreeLarge) // test non-pruned path MerkleProof merkle_proof{}; bool verification_valid = false; - ICICLE_CHECK( - prover_tree.get_merkle_proof(device_leaves, total_input_size, leaf_idx, false /*=pruned*/, config, merkle_proof)); + ICICLE_CHECK(prover_tree.get_merkle_proof( + device_leaves, total_input_size, leaf_idx, false /*=pruned*/, config, merkle_proof)); ICICLE_CHECK(verifier_tree.verify(merkle_proof, verification_valid)); ASSERT_TRUE(verification_valid); // test pruned path verification_valid = false; - ICICLE_CHECK( - prover_tree.get_merkle_proof(device_leaves, total_input_size, leaf_idx, true /*=pruned*/, config, merkle_proof)); + ICICLE_CHECK(prover_tree.get_merkle_proof( + device_leaves, total_input_size, leaf_idx, true /*=pruned*/, config, merkle_proof)); ICICLE_CHECK(verifier_tree.verify(merkle_proof, verification_valid)); ASSERT_TRUE(verification_valid); } @@ -982,19 +983,19 @@ TEST_F(HashApiTest, MerkleTreeLarge) } // Check valid tree of each device by comparing their roots - for (int i = 1; i < device_roots.size(); i++) - { - std::vector& first_root = device_roots[0]; - std::vector& root = device_roots[i]; + for (int i = 1; i < device_roots.size(); i++) { + std::vector& first_root = device_roots[0]; + std::vector& root = device_roots[i]; ASSERT_EQ(first_root.size(), root.size()); auto size = root.size(); - for (int j = 0; j < size; j++) - { - ASSERT_EQ (first_root[j], root[j]) << "Different tree roots:\n" - << s_registered_devices[0] << " =\t0x" << HashApiTest::voidPtrToHexString(first_root.data(), size)<< "\n" - << s_registered_devices[i] << " =\t0x" << HashApiTest::voidPtrToHexString(root.data(), size); + for (int j = 0; j < size; j++) { + ASSERT_EQ(first_root[j], root[j]) << "Different tree roots:\n" + << s_registered_devices[0] << " =\t0x" + << HashApiTest::voidPtrToHexString(first_root.data(), size) << "\n" + << s_registered_devices[i] << " =\t0x" + << HashApiTest::voidPtrToHexString(root.data(), size); } - } + } } #ifdef POSEIDON