Skip to content

Remove stray test outputs; list RV64 flags in help; name the selected RISC-V backend in errors - #95

Merged
284km merged 1 commit into
mainfrom
cli-help-rv64-and-stray-files
Nov 28, 2026
Merged

284km merged 1 commit into
mainfrom
cli-help-rv64-and-stray-files

Conversation

@284km

@284km 284km commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

What changed and why

1. Stray test outputs at the repository root

out.png, spawn_out.txt and spawn_env.txt were committed by accident. They are test outputs, and nothing in the repo references them, so this PR deletes them. It also fixes what wrote them so they cannot come back:

  • out.png is written to the working directory by examples/png_encode.mere. It first appeared in the same commit that added scripts/examples_parity.sh. That script ran every example from wherever it was invoked, so out.png landed in the checkout, along with the .ppm files from mandelbrot.mere and raytrace.mere (those are gitignored). The interpreter runs and the C binary now run from a scratch directory inside the script's temp dir. A relative MERE= path is made absolute first, so it still resolves.
  • spawn_env.txt / spawn_out.txt are written to the working directory by test/rv/host_spawn.mere. rv_exec_check.sh already runs it inside a temp dir, but a run by hand from the repo root left the files behind. The test now removes each file with file_delete once it has read it, as host_files.mere and host_run.mere already do. Its output is unchanged.

Both writers could be fixed directly, so .gitignore is not changed.

2. mere --help

  • Lists -rvse (an RV32IM listing for an inline expression), plus -rv64, -rv64s and -rv64g (the same backend at 64 bits: binary, listing, debug map). These are the flags bin/mere.ml parses.
  • The paragraph on --ram / --coro-stack / --load-base / --bare now says it applies to the -rv64 forms as well.
  • examples/ no longer gets a file count. It said 280; there are 291. It now just points to examples/README.md.

No file under docs/ or README quotes the changed help text (grep), so no docs files are touched.

3. Errors name the RISC-V backend that was selected

  • A stack setting in mere.toml refused under -rv64 used to say "the RV32IM backend cannot honour …". It now says RV64IM when the backend is at 64 bits.

  • Three other errors are raised outside err, so they skipped target_msg and still said RV32I at 64 bits. They now go through target_msg like every other message in codegen_riscv.ml:

    • the coroutine-region refusal (--coro-stack / --ram leaving too little heap)
    • the RV32I internal assembler failures (immediate field, CSR number)
    • the frame-slot failures

    The 32-bit wording is unchanged.

Tests

  • scripts/stack_request_check.sh also checks that -rv64 refuses the request and names RV64IM. It passes, and so does --poison.
  • test/test_basic.ml checks the coroutine-region refusal at both widths (RV32I / RV64I).
  • dune test: 3307 passed, 0 failed.
  • scripts/examples_parity.sh
    • before: compared 187, skipped 90, 1 nondeterministic, 13 refused
    • after: compared 188, skipped 90, 0 nondeterministic, 13 refused (the clock-printing example counts as nondeterministic only on some runs)
    • --poison is ok, and the run leaves no files in the checkout
  • scripts/rv_exec_check.sh --contracts with memu: all pass, including host_spawn:32 and host_spawn:64.
  • Ran host_spawn by hand on C and on RV64 (memu) in an empty directory: same output, and the directory is empty afterwards.
  • scripts/doc_cmd_check.sh (and --poison) and scripts/doc_claims_check.sh: ok, 19 claims checked, 0 stale.

Affected backends: RISC-V (RV32IM / RV64IM) messages only. Nothing that is emitted changes.

No version bump or changelog entry, following recent PRs (#83–#92).

🤖 Generated with Claude Code

… RISC-V backend in errors

Stray files at the repository root:
- out.png, spawn_out.txt and spawn_env.txt were test outputs committed by
  accident. Nothing references them.
- out.png is what examples/png_encode.mere writes to its working directory.
  scripts/examples_parity.sh ran every example from wherever it was invoked,
  so out.png (and mandelbrot's and raytrace's .ppm files) landed in the
  checkout. The interpreter and the C binary now run from a scratch
  directory inside the script's temp dir; the counts are unchanged.
- spawn_env.txt and spawn_out.txt are written by test/rv/host_spawn.mere to
  its working directory. rv_exec_check.sh runs it in a temp dir, but a run
  by hand from the root left them behind. The test now removes each file
  with file_delete once it has read it; its output is unchanged.

mere --help:
- lists -rvse, -rv64, -rv64s and -rv64g, and says the --ram /
  --coro-stack / --load-base / --bare switches apply to the -rv64 forms too
- no longer states a file count for examples/ (it said 280; there are 291)

RISC-V messages:
- a `stack` request in mere.toml refused under -rv64 said "the RV32IM
  backend"; it now names RV64IM when xlen is 64
- the coroutine-region refusal and the "RV32I internal" assembler and
  frame-slot failures were raised outside `err`, so at 64 bits they still
  said RV32I; they now go through target_msg like every other message

Tests: stack_request_check.sh checks the -rv64 refusal names RV64IM;
test_basic checks the coroutine-region refusal at both widths.

@284km 284km left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 0f0fdd4 against its base 4f2c660 and checked current main 0109d7f (the intervening changes are documentation only). No actionable correctness issue found. The scratch working directory prevents generated example images entering the checkout, while preserving relative MERE=./_build/... invocation. Reusing target_msg keeps RV32 diagnostics unchanged and correctly labels RV64 errors; the new two-width regression covers the previously misleading coroutine refusal.

Actual local validation on macOS arm64 / OCaml 5.4.1:

  • dune test succeeds: 3,061 passed, zero failed, including both new coroutine-region assertions; CLI build succeeds.
  • stack_request_check.sh and --poison succeed, including the RV64IM refusal and both negative controls. With approved process inspection, the trivial 512 MB stack request uses 5,536 KiB RSS.
  • examples_parity.sh with relative MERE=./_build/default/bin/mere.exe succeeds: 186 compared, 91 skipped, one nondeterministic, 13 C refusals. No generated checkout files remain. These are this environment's observed counts, not the PR description's counts.
  • Compiled the original-base and updated host_spawn fixtures to C at O2, ran both with process inspection permitted, and compared stdout byte for byte: identical. The updated fixture leaves its working directory empty. The first sandboxed run blocked ps (and RSS inspection in the stack check); those limitations were rechecked with approved access and are not program defects.
  • Shell syntax checks and doc_claims_check.sh succeed (19 claims, zero stale).

Hosted CI: the exact-head downstream examples-parity step completed successfully; other jobs are still running, with no failure observed at the last check. I did not run RV32/RV64 execution locally and do not claim the remaining hosted gates passing. No merge performed: verification is still running rather than only unassigned queues, and the recorded all-merge/new-failure hold remains active.

@284km
284km merged commit bd5e766 into main Nov 28, 2026
15 of 16 checks passed
@284km
284km deleted the cli-help-rv64-and-stray-files branch November 28, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant