From 42817bab52e1c96c214e4760f56ae220a1e9451c Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Tue, 21 Apr 2026 22:35:17 +0200 Subject: [PATCH] decrease loop iterations in sum sample --- ggplot2_a.png | 3 +++ ggplot2_b.png | 3 +++ targets/wasm-module/sum0_base.cpp | 4 ++-- targets/wasm-module/sum1_repl_naive_late.cpp | 4 ++-- targets/wasm-module/sum2_repl_cored_late.cpp | 4 ++-- targets/wasm-module/sum3_repl_naive_early.cpp | 4 ++-- targets/wasm-module/sum4_repl_cored_early.cpp | 4 ++-- 7 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 ggplot2_a.png create mode 100644 ggplot2_b.png diff --git a/ggplot2_a.png b/ggplot2_a.png new file mode 100644 index 0000000..1ec8b63 --- /dev/null +++ b/ggplot2_a.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:625664aa5c091044d54a920ee74a1fc5eb3c1f2d49d2c7fe886b65b213bc6868 +size 1033527 diff --git a/ggplot2_b.png b/ggplot2_b.png new file mode 100644 index 0000000..30f9141 --- /dev/null +++ b/ggplot2_b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a67364c4cdd5305da5d3ea3d3ef21520b3a24ca4267f13e8341694e662377b29 +size 1214646 diff --git a/targets/wasm-module/sum0_base.cpp b/targets/wasm-module/sum0_base.cpp index 262d7c2..135b99c 100644 --- a/targets/wasm-module/sum0_base.cpp +++ b/targets/wasm-module/sum0_base.cpp @@ -8,7 +8,7 @@ static plain_t sum_out[REPLICA_COUNT]; template static INLINE void sum(void) { int sum = 0; - for (int i = 0; i < 100; ++i) { + for (int i = 0; i < 5; ++i) { sum += 1; } @@ -24,7 +24,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) { fail_stop_trace(); - if (X == 100) { + if (X == 5) { HOST_PRINT("result correct.\n"); fail_marker_positive(); return 0; diff --git a/targets/wasm-module/sum1_repl_naive_late.cpp b/targets/wasm-module/sum1_repl_naive_late.cpp index c85c6b4..2f03c0b 100644 --- a/targets/wasm-module/sum1_repl_naive_late.cpp +++ b/targets/wasm-module/sum1_repl_naive_late.cpp @@ -24,7 +24,7 @@ static void naive_vote(void) { template static INLINE void sum(void) { int sum = 0; - for (int i = 0; i < 100; ++i) { + for (int i = 0; i < 5; ++i) { sum += 1; } @@ -46,7 +46,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) { fail_stop_trace(); - if (vote_res == 100) { + if (vote_res == 5) { HOST_PRINT("vote success.\n"); fail_marker_positive(); return 0; diff --git a/targets/wasm-module/sum2_repl_cored_late.cpp b/targets/wasm-module/sum2_repl_cored_late.cpp index abe4edc..5bb4142 100644 --- a/targets/wasm-module/sum2_repl_cored_late.cpp +++ b/targets/wasm-module/sum2_repl_cored_late.cpp @@ -57,7 +57,7 @@ static sign_t cored_vote(void) { template static INLINE void sum(void) { int sum = 0; - for (int i = 0; i < 100; ++i) { + for (int i = 0; i < 5; ++i) { sum += 1; } @@ -105,7 +105,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) { } plain_t res = decode(cored_res, THE_A, vote_result_sig); - if (res == 100) { + if (res == 5) { HOST_PRINT("cored success.\n"); fail_marker_positive(); return 0; diff --git a/targets/wasm-module/sum3_repl_naive_early.cpp b/targets/wasm-module/sum3_repl_naive_early.cpp index 57c9ee2..2e87373 100644 --- a/targets/wasm-module/sum3_repl_naive_early.cpp +++ b/targets/wasm-module/sum3_repl_naive_early.cpp @@ -24,7 +24,7 @@ static void naive_vote(void) { template static INLINE void sum(void) { int sum = 0; - for (int i = 0; i < 100; ++i) { + for (int i = 0; i < 5; ++i) { sum += 1; } @@ -46,7 +46,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) { fail_stop_trace(); - if (vote_res == 100) { + if (vote_res == 5) { HOST_PRINT("vote success.\n"); fail_marker_positive(); return 0; diff --git a/targets/wasm-module/sum4_repl_cored_early.cpp b/targets/wasm-module/sum4_repl_cored_early.cpp index c0e6f87..bf9f133 100644 --- a/targets/wasm-module/sum4_repl_cored_early.cpp +++ b/targets/wasm-module/sum4_repl_cored_early.cpp @@ -57,7 +57,7 @@ static sign_t cored_vote(void) { template static INLINE void sum(void) { int sum = 0; - for (int i = 0; i < 100; ++i) { + for (int i = 0; i < 5; ++i) { sum += 1; } @@ -105,7 +105,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) { } plain_t res = decode(cored_res, THE_A, vote_result_sig); - if (res == 100) { + if (res == 5) { HOST_PRINT("cored success.\n"); fail_marker_positive(); return 0;