diff options
Diffstat (limited to 'research/experiments/040-against-c')
4 files changed, 18 insertions, 4 deletions
diff --git a/research/experiments/040-against-c/2026-10-18-counts-s32v6.jsonl b/research/experiments/040-against-c/2026-10-18-counts-s32v6.jsonl new file mode 100644 index 0000000..cfef4f6 --- /dev/null +++ b/research/experiments/040-against-c/2026-10-18-counts-s32v6.jsonl @@ -0,0 +1,2 @@ +{"serve": "pure-serve", "per_branch": {"instructions": 27064595, "cycles": 11936072}, "in_credit": {"instructions": 3508659, "cycles": 1627657}, "large": {"instructions": 1423198, "cycles": 625928}, "ranks": {"instructions": 24446380, "cycles": 15093091}, "none": {"instructions": 617123, "cycles": 236726}, "field": {"instructions": 9028796, "cycles": 3384389}, "found": {"instructions": 14180082, "cycles": 12075121}} +{"serve": "pure-serve", "per_branch": {"instructions": 27033728, "cycles": 11955217}, "in_credit": {"instructions": 3501713, "cycles": 1414960}, "large": {"instructions": 1423142, "cycles": 605214}, "ranks": {"instructions": 24429139, "cycles": 14872254}, "none": {"instructions": 617115, "cycles": 192865}, "field": {"instructions": 9028788, "cycles": 3346914}, "found": {"instructions": 14179473, "cycles": 10774389}} diff --git a/research/experiments/040-against-c/2026-10-18-counts-s33.jsonl b/research/experiments/040-against-c/2026-10-18-counts-s33.jsonl new file mode 100644 index 0000000..e1ed651 --- /dev/null +++ b/research/experiments/040-against-c/2026-10-18-counts-s33.jsonl @@ -0,0 +1,2 @@ +{"serve": "pure-serve", "per_branch": {"instructions": 26940620, "cycles": 11956474}, "in_credit": {"instructions": 3480396, "cycles": 1582124}, "large": {"instructions": 1429175, "cycles": 606440}, "ranks": {"instructions": 24391428, "cycles": 14777801}, "none": {"instructions": 617940, "cycles": 190815}, "field": {"instructions": 9090056, "cycles": 3297986}, "found": {"instructions": 14242161, "cycles": 11634241}} +{"serve": "pure-serve", "per_branch": {"instructions": 27162324, "cycles": 11942429}, "in_credit": {"instructions": 3530258, "cycles": 1604696}, "large": {"instructions": 1429143, "cycles": 613979}, "ranks": {"instructions": 24513498, "cycles": 14981857}, "none": {"instructions": 617940, "cycles": 192686}, "field": {"instructions": 9090159, "cycles": 3293663}, "found": {"instructions": 14242529, "cycles": 10703067}} diff --git a/research/experiments/040-against-c/runs.sh b/research/experiments/040-against-c/runs.sh index a265ac0..b3e95ba 100644 --- a/research/experiments/040-against-c/runs.sh +++ b/research/experiments/040-against-c/runs.sh @@ -27,7 +27,9 @@ build) git worktree add -f -q --detach "$builds/src-$2" "$3" make -s -C "$builds/src-$2" build/libpure.a mkdir -p "$builds/$2" - cc -O2 -g -std=c17 -I"$builds/src-$2/core" $here/suite-run.c "$builds/src-$2/build/libpure.a" -lm -o "$builds/$2/suite-run" + keyed="" + grep -q PURE_APP_PENDING "$builds/src-$2/core/module.h" && keyed=-DPURE_KEYED_MESSAGES # before 027's 4b + cc -O2 -g -std=c17 $keyed -I"$builds/src-$2/core" $here/suite-run.c "$builds/src-$2/build/libpure.a" -lm -o "$builds/$2/suite-run" git worktree remove --force "$builds/src-$2" for work in roots knapsack sort join words matmul; do ../aup/build/aup build $here/$work.aup -o "$builds/$2/$work.pmod"; done ../aup/build/aup build research/experiments/033-computing/graph.aup -o "$builds/$2/graph.pmod" ;; diff --git a/research/experiments/040-against-c/suite-run.c b/research/experiments/040-against-c/suite-run.c index f8c03e7..410b9dc 100644 --- a/research/experiments/040-against-c/suite-run.c +++ b/research/experiments/040-against-c/suite-run.c @@ -12,6 +12,14 @@ * Without NAMEs, all of them. PURE_JIT and PURE_AHEAD as the core reads them. */ #define _POSIX_C_SOURCE 200809L #include "module.h" +/* A message: before 027's 4b it took a key and a base revision too (runs.sh build gives -DPURE_KEYED_MESSAGES then). */ +static PureResult send_message(PureApp *app, uint32_t input, PureSpan payload) { +#ifdef PURE_KEYED_MESSAGES + return pure_app_message(app, input, NULL, -1, payload); +#else + return pure_app_message(app, input, payload); +#endif +} #include <stdbool.h> #include <stdint.h> #include <stdio.h> @@ -38,13 +46,13 @@ static bool load_graph(PureApp *app, const PureModule *m, uint32_t nodes, size_t size_t unique = graph_build(nodes, edges, &keys); unsigned char four[4]; memcpy(four, &nodes, 4); - if (pure_app_message(app, (uint32_t)pure_module_input(m, "size"), NULL, -1, (PureSpan){four, 4}) != PURE_OK) return false; + if (send_message(app, (uint32_t)pure_module_input(m, "size"), (PureSpan){four, 4}) != PURE_OK) return false; enum { CHUNK = 65536 }; double *rows = malloc(CHUNK * 2 * sizeof(*rows)); for (size_t at = 0; at < unique; at += CHUNK) { size_t n = unique - at < CHUNK ? unique - at : CHUNK; for (size_t k = 0; k < n; ++k) rows[2 * k] = (double)keys[at + k], rows[2 * k + 1] = (double)(keys[at + k] & 0xFFFFF); - if (pure_app_message(app, (uint32_t)pure_module_input(m, "load"), NULL, -1, (PureSpan){(unsigned char *)rows, n * 16}) != + if (send_message(app, (uint32_t)pure_module_input(m, "load"), (PureSpan){(unsigned char *)rows, n * 16}) != PURE_OK) return false; } @@ -94,7 +102,7 @@ static int run(const char *dir, const Work *w, unsigned rounds) { unsigned char bytes[8]; memcpy(bytes, args, 4 * w->argc); double a = now_ms(); - PureResult result = pure_app_message(&app, (uint32_t)input, NULL, -1, (PureSpan){bytes, 4 * w->argc}); + PureResult result = send_message(&app, (uint32_t)input, (PureSpan){bytes, 4 * w->argc}); double b = now_ms(); if (result != PURE_OK) { fprintf(stderr, "%s failed: %s\n", w->name, pure_fault_name(app.fault)); return 1; } double out[4] = {0}; |
