Cover GPU writer overview_resampling='mode' and compression_level= (#1740)#1743
Merged
brendancol merged 1 commit intoMay 12, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds missing GPU test coverage for GeoTIFF writing when overview_resampling='mode' and for the documented GPU-writer behavior that compression_level= is accepted but ignored (including out-of-range values), aligning with issue #1740 and strengthening regression protection around these public APIs.
Changes:
- Added a new GPU-gated test module covering
_block_reduce_2d_gpu(method='mode'), end-to-end COG overview generation usingmode, and CPU↔GPU pixel parity formodeoverviews. - Added GPU-gated tests pinning the “accepted-but-ignored”
compression_level=contract on the GPU writer (both in-range and out-of-range), plus a companion CPU-sideValueErrorassertion to lock the intended asymmetry. - Updated the sweep coverage state CSV to record the new coverage work (pass 12 / issue #1740).
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_overview_mode_and_compression_level_1740.py |
New GPU-gated end-to-end + unit tests for overview_resampling='mode' and GPU compression_level= acceptance contract. |
.claude/sweep-test-coverage-state.csv |
Records sweep metadata/state update reflecting the added coverage for issue #1740. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…el= (#1740) Closes #1740. Six of the seven overview_resampling modes had end-to-end coverage on the GPU writer path; mode was the odd one out. The dedicated branch in _block_reduce_2d_gpu (_gpu_decode.py:3051-3056) and the matching write_geotiff_gpu(cog=True, overview_resampling='mode') / to_geotiff(gpu=True, ..., overview_resampling='mode') paths had no targeted tests. test_mode_overview_perf.py exercises only the CPU _block_reduce_2d helper. write_geotiff_gpu(compression_level=) is documented as accepted-but- ignored (nvCOMP has no level control). The CPU writer rejects out-of- range levels with ValueError; the GPU writer is documented not to. No test pinned the asymmetry. Source unchanged; test-only addition. 19 tests, all passing on a GPU host: - _block_reduce_2d_gpu(method='mode') matches CPU output on 4x4 deterministic input, on a random 8x8 with many ties, and preserves dtype across u8/u16/i16/i32. - write_geotiff_gpu(cog=True, overview_resampling='mode') round-trips and the level-1 overview matches the closed-form 2x2 mode reduction. - to_geotiff(gpu=True, cog=True, overview_resampling='mode') dispatcher thread-through. - GPU-vs-CPU writer pixel parity on 8x8 random integer input. - write_geotiff_gpu(compression_level=N) accepted for in-range (zstd=1/22, deflate=1/9) and out-of-range (zstd=999/-5, deflate=50/0) with the file still round-tripping in every case. - to_geotiff(gpu=True, compression_level=999) dispatcher thread-through. - Companion CPU rejects-OOR pin to lock the documented asymmetry. Mutation testing: removing the mode branch from _block_reduce_2d_gpu flips 9 of the new tests red. Filed via the deep-sweep test-coverage workflow (pass 12).
f226de1 to
0059bf3
Compare
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.
Closes #1740.
Summary
Six of the seven
overview_resamplingmodes have end-to-end coverage on the GPU writer;modewas the odd one out. The dedicated branch in_block_reduce_2d_gpu(_gpu_decode.py:3051-3056) and the matchingwrite_geotiff_gpu(cog=True, overview_resampling='mode')/to_geotiff(gpu=True, ..., overview_resampling='mode')paths had no targeted tests.test_mode_overview_perf.pyexercises only the CPU_block_reduce_2dhelper.write_geotiff_gpu(compression_level=)is documented as accepted-but-ignored (nvCOMP has no level control). The CPU writer rejects out-of-range levels withValueError; the GPU writer is documented not to. No test pinned the asymmetry.Source unchanged; test-only addition.
Tests added
xrspatial/geotiff/tests/test_gpu_writer_overview_mode_and_compression_level_1740.py-- 19 tests, all passing on a GPU host:_block_reduce_2d_gpu(method='mode')CPU-parity on 4x4 deterministic input + random 8x8 with many ties + dtype-preserved across u8/u16/i16/i32.write_geotiff_gpu(cog=True, overview_resampling='mode')end-to-end round trip with overview matching the closed-form 2x2 mode reduction.to_geotiff(gpu=True, cog=True, overview_resampling='mode')dispatcher thread-through.modeon 8x8 random integer input.write_geotiff_gpu(compression_level=N)in-range (zstd=1/22,deflate=1/9) and out-of-range (zstd=999/-5,deflate=50/0) accepted without raising, file still round-trips.to_geotiff(gpu=True, compression_level=999)dispatcher thread-through.to_geotiff(compression_level=999)raisesValueErrorto lock the documented asymmetry.Test plan
test_overview_resampling_min_max_median_2026_05_11.py,test_mode_overview_perf.py, andtest_signature_parity_1631.pystill pass alongside (99 combined tests green)modebranch from_block_reduce_2d_gpuflips 9 mode tests redSweep metadata
Filed via the deep-sweep test-coverage workflow (pass 12). State CSV updated to reflect the new coverage.