Skip to content

Restore async: true across the test suite - #46

Merged
ausimian merged 1 commit into
mainfrom
tests-async
Apr 19, 2026
Merged

Restore async: true across the test suite#46
ausimian merged 1 commit into
mainfrom
tests-async

Conversation

@ausimian

Copy link
Copy Markdown
Owner

Summary

  • Stream-per-process (M14) + the async enif_send substrate (Phases 1–3) make concurrent Emily.Backend ops safe across BEAM processes. This PR flips the ExUnit modules that had been pinned to async: false for concurrency reasons back to async: true.
  • ConformanceHelper now sets Nx.default_backend/1 in a per-test setup (pdict-scoped) instead of Nx.global_default_backend/1 in setup_all. Conformance modules (qwen3, vit, whisper) and the *_full variants run async.
  • Training *_full tests and transform_test.exs got the same treatment — three MNIST modules now overlap on :training_full.
  • distilbert_test.exs keeps setup_all + global_default_backend + async: false, because its :distilbert_full test drives Nx.Serving.batched_run through a supervised serving process that can't see the caller's pdict.
  • Dropped the redundant on_exit restores on pdict-setting setup blocks — the test process exits anyway and on_exit runs in a different process, so there is nothing to restore.

Test plan

  • mix test (default suite) — 425 tests, 0 failures, 3.0s
  • mix test --only conformance — 17 tests, 0 failures, 5.6s (2.5s async)
  • mix test --only training_full — 3 tests, 0 failures, 66.1s all async
  • mix test --only qwen3_full --only qwen3_quant_full --only vit_full --only whisper_full --only distilbert_full — 9 tests, 0 failures, 16.4s
  • Full suite with every tag included — 453 tests, 0 failures, 78.8s (73.5s async, 5.3s sync)

Stream-per-process (M14) + the async enif_send substrate (Phase 1-3)
make concurrent Emily.Backend ops safe, so the ExUnit modules that were
pinned to async: false for concurrency reasons can now run in parallel.

- Refactor `ConformanceHelper` to set `Nx.default_backend/1` in a
  per-test `setup` (pdict-scoped) rather than `Nx.global_default_backend/1`
  in `setup_all`; conformance modules (qwen3, vit, whisper) and the
  `*_full` variants are now async: true.
- Refactor the training `*_full` tests and `transform_test.exs`
  similarly — three MNIST training modules now overlap on `:training_full`.
- `distilbert_test.exs` keeps its own `setup_all` + `global_default_backend`
  and stays async: false: its `:distilbert_full` test drives
  `Nx.Serving.batched_run` through a supervised serving process, which
  cannot see the caller's pdict.
- Flip the process-scoped modules (compiler, fast/*, stream, async_eval,
  debug_flags, bumblebee/fast_kernels, compiler_axon) to async: true.
- Drop the redundant `on_exit` restores on pdict-setting `setup` blocks —
  the test process exits anyway and on_exit runs in a different process.

Full suite (453 tests incl. all tags): 78.8s, 73.5s async, 5.3s sync.
@ausimian
ausimian merged commit 04b6d1a into main Apr 19, 2026
1 check passed
@ausimian
ausimian deleted the tests-async branch April 19, 2026 00:52
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