Repository navigation
Low-planes untranspose for u8 pixels - #48
Merged
Merged
Conversation
A u8 block's eight bit-planes are what the low-planes values already transpose for u16 blocks below 256, so they now take u8 blocks too and write the values as bytes: the fused list replaces kcb plus the scalar collect on the sparse route and in plain sparsify (the dense route keeps kcb). Each kernel (vbmi, avx2, vsx, c) is instantiated per output type; the u16 vbmi kernel is the same machine code as before. Auto picks a low-planes value for u8 as for u16. Zen 4, silicon 2162x2068 clipped to u8, one core: sparsify 332 -> 1693 fps as recorded, 397 -> 13617 fps with pixels <= 4 zeroed; with the 1D matrix 296 -> 1094 fps. u16 unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BSLZ4_ALWAYS_INLINE is __forceinline on MSVC; the portable C collect used the gcc attribute and broke the MSVC build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
avx512cs (one byte compress for 64 pixels), avx2cs (the lane table, 32 pixels a step), sse2, vsx and neon now take u8 blocks, as they take u16 and u32: the dense route and kcb blocks no longer fall back to the scalar collect for u8, and auto picks them for u8. Tested against numpy for every collect value available, u8 now included, at every block size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f collect Skylake-SP and Cascade Lake have AVX-512 F/BW/VL but neither VBMI/VBMI2 nor GFNI, so they ran the AVX2 values. Two new values, appended so that the existing numbers keep their meaning: - untranspose lowplanes-avx512bw (u8/u16): the low-planes bit transpose by mask loads and masked adds (kcb's avx512bw kernel), 64 pixels at a time, with the fused collect skipping empty groups and compressing as dwords; also the u16 dense-route block. - collect avx512f (u8/u16/u32): compare at the pixel width, compress 16 pixels at a time as dwords and narrow; a scalar loop where a step has at most 2 pixels. BSLZ4_IS_LOWPLANES() replaces the range checks in the driver and registry. Auto tries them after the VBMI/VBMI2 values and before AVX2. Cascade Lake (Gold 6248), silicon, fps: sparsify lowplanes-avx512bw lowplanes-avx2 u16 as recorded 1180 1013 u8 as recorded 1045 1091 u16 zeroed <= 4 7768 5692 u8 zeroed <= 4 10271 6687 kcb + collect avx512f avx2cs u16 / u8 as recorded 622 / 920 555 / 827 u16 / u8 zeroed 1126 / 3004 931 / 2086 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The VSX fused collect reads each plane 8 bytes at a time but accepted any block of a multiple of 8 pixels: with ne % 64 != 0 the last word of a plane ran into the next plane and pixels that are not there were collected. u8 blocks of 1224 pixels (test_decode_matrix) showed it on POWER9; u16 blocks of such sizes had the same fault. Other block sizes now go to the fallback, as for the VBMI value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A u8 block's eight bit-planes are what the low-planes values already transpose for u16 blocks below 256, so they now take u8 blocks too and write the values as bytes: the fused list replaces kcb plus the scalar collect on the sparse route and in plain sparsify (the dense route keeps kcb). Each kernel (vbmi, avx2, vsx, c) is instantiated per output type; the u16 vbmi kernel is the same machine code as before. Auto picks a low-planes value for u8 as for u16.
Zen 4, silicon 2162x2068 clipped to u8, one core: sparsify 332 -> 1693 fps as recorded, 397 -> 13617 fps with pixels <= 4 zeroed; with the 1D matrix 296 -> 1094 fps. u16 unchanged.
Coded By Claude