Repository navigation
Conversation
New tests for the gather/scatter work. Each pins today's output and documents the ideal output next to the checks, so the change that reaches it updates them: * gather-index-width: dword or qword gathers and scatters per index type, both addressing modes, with the original reproducer from ispc#1581. * gather-scale: scale immediate vs pre-shifted index (ispc#1256, ispc#1531). * inline-helper-gather: dword gathers and no llvm.stacksave for memory operations in large inline helpers (fails if the helpers are inlined after memory operations are lowered). * perf-warn-inline-location: location and deduplication of performance warnings raised in inline helpers. * pipeline-order: order of the memory operation passes and the inliner in --debug-pm output. * 304, 2720-1, 2778, 2901, and 2308, 2919, 2943 (discussions): today's code and warnings for the issue reproducers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rule key The four input arrays of the functional test harness (AOT and JIT) are now allocated next to an inaccessible page: vfloat and vdouble end right at a trailing guard page, vint and vint2 start right after a leading one. A gather, scatter or vector access that touches memory past the end or before the start of an input array now faults instead of passing silently. WebAssembly has no page protection and keeps plain aligned arrays. The full functional suite passes with the guards on sse4-i32x4, avx2-i32x8, avx2-i32x16, avx512skx-x16 and avx512skx-x64, with --jit and with --addressing=64. '// rule: run|skip on addressing=32|64' selects tests by the addressing mode ispc uses: the last --addressing flag of the ispc flags or of ISPC_ARGS on 64-bit architectures, 32 on 32-bit architectures and in JIT mode, 64 on xe64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…apes 23 tests for the gather/scatter work, using the guard pages of the functional test harness: * Footprint: masked gathers, scatters, loads and stores whose inactive lanes point into the guard page after or before an input array, tails of foreach loops that end at the array boundary, and coalescable gathers whose last element is the last element of the array (gather-guard-1/2, scatter-guard-1/2, masked-load-guard, masked-store-guard, coalesce-guard-1/2, guard-neg-1/2). * Index semantics: signed and unsigned 8-, 16-, 32- and 64-bit indices for every element type, negative indices, and byte offsets of 2^31 or more in both addressing modes (gather-index-1..4, scatter-index-1, gather-index-overflow-1/2). * Conflicts: duplicate scatter indices and loads across aliasing stores (scatter-dup, gather-alias-1/2). * Shapes: the RGBA8 kernel of discussion ispc#2943, byte struct copies of ispc#2778, and records read through inline helpers (rgba8-2943, struct-copy-2778, vector-gather-helper). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* 01_trivial/18_gather_scatter: gathers and scatters of int8, int32 and double elements through int32, uint32, int16 and uint16 index arrays, with partial masks and tails, and index patterns the compiler can see (broadcast of 4, reverse, stride 2 and 4). * 03_complex/01_gather_aos: moments of point records of 2, 3 and 4 floats read packed, strided and indexed, with gathers, transposes and wide loads. * 03_complex/02_inline_vector_gather: 16-byte records read and written through large inline helpers with an all-lanes-on fast path. * 03_complex/03_rgba8_diff: the RGBA8 kernel of discussion ispc#2943, with a uint32 reference. * 03_complex/04_bilinear_remap: the remap kernels of discussion ispc#2919, with a reference that deinterleaves the grid. * 03_complex/05_struct_copy: byte struct copies of ispc#2778, with integer references of the same size. The weekly dashboard shows them in the not gated section until they have a stable history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Switching off each transformation of the two passes one at a time showed six that no lit test noticed (scale extraction, GetMoreConst, global-array bases, 2- and 4-wide coalescing loads, all-off masked store removal) and seven that only one test noticed. The new and extended tests pin each of them, plus --wrap-signed-int, --opt=force-aligned-memory, 32-bit x86, x64 coalescing, barriers in the coalescing window and 32-bit offset narrowing; a functional test checks values around an atomic and across two bases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Description
Tests and benchmarks for the gather/scatter work (roadmap 2.2), ahead of rewriting
ImproveMemoryOpsandGatherCoalescePass. No compiler changes.Lit tests pinning today's codegen (
gather-index-width,gather-scale,inline-helper-gather,perf-warn-inline-location,pipeline-order, plus the reproducers of gather coalescing doesn't happen for simple program #304, Perform full vector stores when sequentially setting uniform values in multiples of the native vector width #2720, Gather/Scatter can be avoided if Source and Destination are of same type. #2778, Codegen for varying bytes #2901, Unexpected scatter performance warnings using soa #2308, How to process H,W,C effectively? #2919 and How to work with interleaved RGBA data #2943). Each case pins today's output and gives the ideal output in anIdeal:comment, so the change that reaches it updates the checks.Guard pages in the functional test harness. The input arrays (AOT and JIT) now sit next to an inaccessible page, so an access past the end or before the start of an input faults instead of passing silently. A new rule key,
// rule: run|skip on addressing=32|64, selects tests by addressing mode.23 functional tests for footprint (inactive lanes and tails next to the guard pages), index semantics (8- to 64-bit signed and unsigned indices, byte offsets of 2^31 or more), conflicts (duplicate scatter indices, loads across aliasing stores) and shapes (How to work with interleaved RGBA data #2943, Gather/Scatter can be avoided if Source and Destination are of same type. #2778).
Gather/scatter microbenchmarks:
01_trivial/18_gather_scatterand03_complex/01..05. They show in the not-gated section of the dashboard until they have a stable history.Lit tests for the transformations no test noticed. I switched off each transformation of the two passes, one at a time:
The new tests pin each of them. They also cover
--wrap-signed-int,--opt=force-aligned-memory, 32-bit x86, x64 coalescing, barriers in the coalescing window and 32-bit offset narrowing. Every pin was checked to pass on today's compiler and to fail with its transformation switched off.Bugs found along the way and filed separately: #3984 (GatherCoalescePass and negative offsets with
--addressing=32), #3985 (nswon unsigned index scaling), #3986 (crash after an undeclared symbol in a template).Testing
check-allpasses. The new and changed lit tests pass on LLVM 20, 21, 22, 23 and trunk.--jitand with--addressing=64.gather-alias-1/2/3).Related Issue
Checklist
clang-format(e.g.,clang-format -i src/ispc.cpp)🤖 Generated with Claude Code