diff --git a/barretenberg/cpp/CMakePresets.json b/barretenberg/cpp/CMakePresets.json index 1bab33d1186..b0bfd929265 100644 --- a/barretenberg/cpp/CMakePresets.json +++ b/barretenberg/cpp/CMakePresets.json @@ -184,20 +184,17 @@ } }, { - "name": "xray-1thread-verbose", + "name": "xray-verbose", "displayName": "Build with single-threaded XRay Profiling", "description": "Build with Clang and enable single-threaded LLVM XRay for profiling", "generator": "Unix Makefiles", "inherits": "clang16", "environment": { - "CFLAGS": "-fxray-instrument -fxray-instruction-threshold=100 -mllvm -finline-max-stacksize=150", - "CXXFLAGS": "-fxray-instrument -fxray-instruction-threshold=100 -mllvm -finline-max-stacksize=150", - "LDFLAGS": "-fxray-instrument -fxray-instruction-threshold=100 -mllvm -finline-max-stacksize=150" + "CFLAGS": "-fxray-instrument -fxray-instruction-threshold=100 -finline-max-stacksize=150", + "CXXFLAGS": "-fxray-instrument -fxray-instruction-threshold=100 -finline-max-stacksize=150", + "LDFLAGS": "-fxray-instrument -fxray-instruction-threshold=100 -finline-max-stacksize=150" }, - "cacheVariables": { - "MULTITHREADING": "OFF" - }, - "binaryDir": "build-xray-1thread-verbose" + "binaryDir": "build-xray-verbose" }, { "name": "xray-1thread", @@ -320,8 +317,8 @@ "targets": ["barretenberg.wasm"] }, { - "name": "xray-1thread-verbose", - "configurePreset": "xray-1thread-verbose", + "name": "xray-verbose", + "configurePreset": "xray-verbose", "inherits": "default" }, { diff --git a/barretenberg/cpp/scripts/collect_profile_information.sh b/barretenberg/cpp/scripts/collect_profile_information.sh index 1262bb63b82..0b7d79ef8ed 100755 --- a/barretenberg/cpp/scripts/collect_profile_information.sh +++ b/barretenberg/cpp/scripts/collect_profile_information.sh @@ -41,6 +41,6 @@ llvm-xray-16 stack xray-log.honk_bench_main_simple.* \ --instr_map=./bin/honk_bench_main_simple --stack-format=flame --aggregate-threads --aggregation-type=time --all-stacks \ | node ../scripts/llvm_xray_stack_flame_corrector.js \ | shorten_cpp_names \ - | ../scripts/flamegraph.pl --width 2000 --fontsize 10 \ + | ../scripts/flamegraph.pl --width 1200 --fontsize 10 \ > xray.svg echo "Profiling complete, now you can do e.g. 'scp mainframe:`readlink -f xray.svg` .' on a local terminal and open the SVG in a browser." diff --git a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/main.simple.cpp b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/main.simple.cpp index a20b68c9e5f..b33d5a57097 100644 --- a/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/main.simple.cpp +++ b/barretenberg/cpp/src/barretenberg/benchmark/honk_bench/main.simple.cpp @@ -46,7 +46,7 @@ template void generate_sha256_test_circuit(Builder& builder, BBERG_INSTRUMENT BBERG_NOINLINE void sumcheck_profiling(honk::UltraProver& ext_prover) { ext_prover.construct_proof(); - for (size_t i = 0; i < 10000; i++) { + for (size_t i = 0; i < 200; i++) { // Bench sumcheck ext_prover.execute_relation_check_rounds(); } @@ -60,7 +60,8 @@ void construct_proof_ultra() noexcept barretenberg::srs::init_crs_factory("../srs_db/ignition"); // Constuct circuit and prover; don't include this part in measurement honk::UltraComposer::CircuitBuilder builder; - generate_sha256_test_circuit(builder, 100); + generate_sha256_test_circuit(builder, 1); + std::cout << "gates: " << builder.get_total_circuit_size() << std::endl; honk::UltraComposer composer; std::shared_ptr instance = composer.create_instance(builder); diff --git a/barretenberg/cpp/src/barretenberg/common/parallel_for_mutex_pool.cpp b/barretenberg/cpp/src/barretenberg/common/parallel_for_mutex_pool.cpp index c8fb4ebf5ec..beb9ab35e5a 100644 --- a/barretenberg/cpp/src/barretenberg/common/parallel_for_mutex_pool.cpp +++ b/barretenberg/cpp/src/barretenberg/common/parallel_for_mutex_pool.cpp @@ -50,7 +50,7 @@ class ThreadPool { std::condition_variable complete_condition_; bool stop = false; - void worker_loop(size_t thread_index); + [[clang::xray_never_instrument]] void worker_loop(size_t thread_index); void do_iterations() { diff --git a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp index b8348c819d2..e2f2cb335ac 100644 --- a/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp +++ b/barretenberg/cpp/src/barretenberg/honk/sumcheck/sumcheck.hpp @@ -139,12 +139,14 @@ template class SumcheckProver { void partially_evaluate(auto& polynomials, size_t round_size, FF round_challenge) { // after the first round, operate in place on partially_evaluated_polynomials - for (size_t j = 0; j < polynomials.size(); ++j) { + parallel_for(polynomials.size(), [&](size_t j) { for (size_t i = 0; i < round_size; i += 2) { + auto x = polynomials[j][i]; + std::cout << polynomials[j][i] << std::endl; partially_evaluated_polynomials[j][i >> 1] = polynomials[j][i] + round_challenge * (polynomials[j][i + 1] - polynomials[j][i]); } - } + }); }; };