Skip to content

Cover write_geotiff_gpu CPU-fallback codecs (#1706)#1709

Merged
brendancol merged 1 commit into
mainfrom
deep-sweep-test-coverage-geotiff-2026-05-12-1778611552
May 12, 2026
Merged

Cover write_geotiff_gpu CPU-fallback codecs (#1706)#1709
brendancol merged 1 commit into
mainfrom
deep-sweep-test-coverage-geotiff-2026-05-12-1778611552

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #1706.

Summary

The GPU writer documents nine compression= modes; only four (none, deflate, zstd, jpeg) had direct round-trip tests. The remaining five (lzw, packbits, lz4, lerc, jpeg2000/j2k) route through dedicated branches in gpu_compress_tiles (_gpu_decode.py:2974-3019) with CPU fallbacks (lerc_compress, jpeg2000_compress, cpu_compress) and had zero direct tests via write_geotiff_gpu. A regression in routing, tag-wiring, or fallback dispatch would ship silently because the internal reader uses the same compression-tag table.

Source unchanged; test-only addition.

Tests added

xrspatial/geotiff/tests/test_gpu_writer_cpu_fallback_codecs_2026_05_12.py -- 17 tests, all passing on a GPU host:

  • lzw, packbits, lz4: round-trip + TIFF Compression tag pin on uint16 input.
  • lerc: lossless round-trip on float32 and uint16 + tag pin (skipif lerc missing).
  • jpeg2000: uint8 single-band + RGB multi-band lossless round-trip, j2k-alias parity, tag pin (skipif glymur missing).
  • GPU-vs-CPU writer pixel parity for lzw/packbits.
  • to_geotiff(gpu=True, compression='lzw'/'packbits') dispatcher thread-through.

Test plan

  • All 17 new tests pass locally on a CUDA host
  • Existing test_gpu_writer_compression_modes_2026_05_11.py still passes alongside
  • Mutation tests confirm sensitivity (swap lzw bytes to zstd in cpu_compress; swap lerc bytes to deflate in lerc_compress; both flip round-trip tests red)
  • CI runs the new tests on a GPU host

Sweep metadata

Filed via the deep-sweep test-coverage workflow (pass 11). State CSV updated to reflect the new coverage.

@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 12, 2026
@brendancol brendancol requested a review from Copilot May 12, 2026 18:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds targeted regression tests to cover write_geotiff_gpu compression modes that route through CPU fallback branches (or CPU-only implementations), ensuring both round-trip pixel fidelity and correct on-disk TIFF Compression tag emission for interoperability.

Changes:

  • Add a new GPU-gated test module covering lzw, packbits, lz4, lerc, and jpeg2000/j2k through write_geotiff_gpu, including Compression-tag pinning via IFD parsing.
  • Add cross-backend decoded-pixel parity checks for lossless CPU-fallback codecs (lzw, packbits) and dispatch coverage for to_geotiff(gpu=True, ...).
  • Update sweep test-coverage state metadata to record the newly closed coverage gap.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
xrspatial/geotiff/tests/test_gpu_writer_cpu_fallback_codecs_2026_05_12.py New GPU-gated tests for CPU-fallback codec routing + TIFF Compression tag pinning + limited CPU/GPU parity checks.
.claude/sweep-test-coverage-state.csv Records sweep pass metadata indicating the new coverage for issue #1706.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The GPU writer documents nine compression= modes; only four
(none, deflate, zstd, jpeg) had direct round-trip coverage. The
remaining five (lzw, packbits, lz4, lerc, jpeg2000/j2k) route
through dedicated branches in gpu_compress_tiles with CPU
fallbacks that shipped without targeted tests.

17 new tests, all passing on a GPU host:

* lzw, packbits, lz4: round-trip + TIFF Compression tag pin on
  uint16 input.
* lerc: lossless round-trip on float32 and uint16 + tag pin.
* jpeg2000: uint8 single-band + RGB multi-band lossless round-trip,
  j2k-alias parity, tag pin (skipif glymur missing).
* GPU-vs-CPU writer pixel parity for lzw/packbits.
* to_geotiff(gpu=True, compression=lzw/packbits) dispatcher
  thread-through.

Mutation tests confirm sensitivity: swapping lzw bytes to zstd in
cpu_compress and lerc bytes to deflate in lerc_compress both flip
round-trip tests red.

State CSV updated with pass-11 notes.
@brendancol brendancol force-pushed the deep-sweep-test-coverage-geotiff-2026-05-12-1778611552 branch from 523c25e to 9adc39c Compare May 12, 2026 19:29
@brendancol brendancol merged commit 7720ea9 into main May 12, 2026
10 of 11 checks passed
@brendancol brendancol deleted the deep-sweep-test-coverage-geotiff-2026-05-12-1778611552 branch May 15, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test: cover write_geotiff_gpu CPU-fallback codecs (lzw/packbits/lz4/lerc/jpeg2000)

2 participants