Fix stale trace count in test_mcmc_parallel_chain and run it in CI#2223
Merged
Conversation
PR pyro-ppl#1910 merged postprocess_fn into the fori_collect loop, adding two extra model traces for deterministic values, and updated test_mcmc_one_chain accordingly (4 -> 5) but left test_mcmc_parallel_chain asserting 4. The parallel-chain path has the same two extra calls, so the test fails with `assert 5 == 4` on any host with two or more devices. This went unnoticed because CI only runs test/test_compile.py without XLA_FLAGS=--xla_force_host_platform_device_count=2, so the skipif marker always skips the parallel-chain test. Update the assertion to 5 and add the file to the multi-device "Test chains" batch so it actually runs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…t` passing Signed-off-by: Eli Sennesh <elisennesh@astera.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test/test_compile.py::test_mcmc_parallel_chain[True]fails withassert 5 == 4on any host withjax.device_count() >= 2.#1910 merged
postprocess_fninto thefori_collectloop, which adds two extra model traces when the model has deterministic sites (transform the init state + transform states during the loop). That PR updatedtest_mcmc_one_chain's expected count from 4 to 5 accordingly, buttest_mcmc_parallel_chainwas left asserting 4 — and the parallel-chain (pmap) path has the same two extra calls, so the model is now traced 5 times there too.This went unnoticed for so long because CI never actually runs the test:
test/test_compile.pyis only executed in the batch withoutXLA_FLAGS="--xla_force_host_platform_device_count=2", sojax.device_count()is 1 and theskipifmarker always skips it.Bisection confirms this is independent of the JAX version: the test passes at 0e7bd20~1 and fails at 0e7bd20 (#1910) with the same jax 0.4.35, and current
masterfails identically on jax 0.7.2 through 0.10.2.Changes made
test_mcmc_parallel_chain's deterministic trace-count assertion from 4 to 5, with the same explanatory comment Merge postprocess_fn into the fori_collect loop #1910 added totest_mcmc_one_chain.test/test_compile.py -k "chain"to the multi-device "Test chains" CI batch so the test actually runs in CI instead of being silently skipped.Links to related issues/PRs
Tests
XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/test_compile.py -k "chain"— 6 passed (previouslytest_mcmc_parallel_chain[True]failed withassert 5 == 4).pytest test/test_compile.py(single device) — 6 passed, 2 skipped, unchanged.Dependencies
🤖 Generated with Claude Code