Skip to content

release: v10.14.0 — JP3D parallel per-slice encode#450

Merged
SureshKViswanathan merged 1 commit into
mainfrom
v10.14.0-release-candidate
May 24, 2026
Merged

release: v10.14.0 — JP3D parallel per-slice encode#450
SureshKViswanathan merged 1 commit into
mainfrom
v10.14.0-release-candidate

Conversation

@SureshKViswanathan

Copy link
Copy Markdown
Contributor

Summary

  • JP3D encoder parallel per-sliceJP3DSliceStackCodec.encode splits the previously-sequential per-slice loop into sequential slices 0-1 (commits the M6/M7 Z-delta tile-mode decision) + parallel slices 2..N via TaskGroup.
  • JP3D encode wins (M2 release, in-process, 7 runs / 2 warmups, median): mr_3d_small 1.56×, ct_3d_small 1.30×, us_3d_small 1.44×, mr_3d_mid 1.09×, ct_3d_mid 1.20×, ct_3d_large 1.14× (−76 ms). All 6/6 fixtures clear the 3 ms acceptance threshold.
  • Encoder-only, codestream byte-identical to v10.13.0. First JP3D encoder speedup of the v10 arc.

Correctness gate (release mode)

Suite Tests Result
swift test --filter JP3D regression 519/519 PASS (codestream bytes-identical)
J2KMedicalCorpusEncodePerformanceTests 2/2 PASS
J2KMedicalCorpusPerformanceTests 2/2 PASS
J2KStrictCrossCodecValidationTests 3/3 PASS

Test plan

  • Mandatory pre-release gate (encode-perf + decode-perf + cross-codec parity)
  • JP3D regression sweep (519 tests; parallel encode = serial encode under same Z-delta gating)
  • JP3D encode A/B bench measurement
  • Codestream byte-equality vs v10.13.0

Companion documents

🤖 Generated with Claude Code

The first JP3D encoder speedup of the v10 arc. JP3DSliceStackCodec's
per-slice 2D encode loop was sequential since shipping; v10.14.0
splits it into sequential slices 0-1 (commits the M6/M7 Z-delta
tile-mode decision) + parallel slices 2..N via TaskGroup.

JP3D encode wins (M2 release, --jp3d bench, in-process, 7 runs / 2 warmups, median):

  Fixture          vx        enc ser    enc par    Δ ms     ratio
  ----------------------------------------------------------------
  mr_3d_small      262K       11.84       7.58    −4.27    1.56x
  ct_3d_small      1.05M      33.92      26.17    −7.75    1.30x
  us_3d_small      1.84M      58.58      40.73   −17.85    1.44x
  mr_3d_mid        2.10M      71.59      65.68    −5.91    1.09x
  ct_3d_mid        8.39M     295.58     246.98   −48.60    1.20x
  ct_3d_large      16.78M    615.94     539.95   −75.99    1.14x

All 6/6 fixtures clear the 3 ms acceptance threshold. Smallest
fixture shows the largest relative speedup (1.56× on mr_3d_small)
because the per-slice fixed cost amortises better; largest fixture
wins 76 ms absolute on the radiologist-relevant 16M-voxel CT.

Sub-linear vs N=8 cores because:
  - Z-delta probe is serialized
  - Slices 0-1 are sequential
  - Memory contention on the 16M-voxel CT writes 33 MB of output

Architectural change:
  - Per-slice body extracted into encodeOneSlice(...) instance
    method so sequential + parallel paths share the same logic.
  - From slice 2 onward neither tile-mode flag mutates, so the
    parallel closure captures the committed flags by value.
  - Z-delta correctness preserved: residual depends on raw INPUT
    bytes, not on the encoded codestream of the previous slice.

Combined with v10.11-v10.13 decode wins: round-trip on the
16M-voxel CT is ~3.5× faster vs v10.10.0.

Validation:
  - swift test --filter JP3D regression  519/519 PASS (codestream
    bytes-identical to v10.13.0; parallel encode = serial encode
    under the same Z-delta gating)
  - Mandatory commit gate (release mode)  7/7  PASS

Codestream bytes byte-identical to v10.13.0; decoder unchanged.
MINOR per RELEASING.md — internal refactor only, same encoder
API and output bytes.

Opt-out via J2K_JP3D_PARALLEL_ENCODE=0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@SureshKViswanathan SureshKViswanathan merged commit 8edb433 into main May 24, 2026
13 of 16 checks passed
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