test: add a property-based kernel test with CPU and GPU backends#4142
Merged
Conversation
Check awkward_BitMaskedArray_to_ByteMaskedArray against its pure-Python reference implementation from kernel-specification.yml over Hypothesis-generated inputs, on the CPU kernel and (with `-m cuda`) the CUDA kernel. Example budget and deadline come from the central profile in scikit-hep#4128. This is a pilot on a single kernel; if it works well, the approach will be extended to the remaining kernels. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
TaiSakuma
force-pushed
the
test/hypothesis-kernels
branch
from
June 18, 2026 18:19
4f9717b to
6fc4e22
Compare
Member
Author
|
After #4128 was merged, all tests in this PR passed. |
ianna
approved these changes
Jun 19, 2026
ianna
left a comment
Member
There was a problem hiding this comment.
@TaiSakuma -,this is great! Thank you. Please go ahead and merge it if you are done with it. Thanks
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.
Summary
As discussed in the awkward–uproot meeting, this is a pilot for property-based testing of the compiled kernels. Instead of the frozen samples in
kernel-test-data.json, inputs are Hypothesis-generated and the kernel is checked against its pure-Python reference implementation inkernel-specification.yml(the single source of truth).This starts with one kernel,
awkward_BitMaskedArray_to_ByteMaskedArray, plus the CPU/GPU infrastructure. If the approach works well, it will be extended to the remaining kernels.What's here
tests/properties/kernels/test_BitMaskedArray_to_ByteMaskedArray.py— parametrized over backends:cpu: compiled kernel viaawkward_cpp.cpu_kernels(ctypes), always run.cuda: compiled kernel via the CuPy backend, added only when a GPU is present and marked@pytest.mark.cuda.The reference implementation is loaded from
kernel-specification.yml, so the test does not depend on the generatedawkward-cpp/tests-spec/kernels.py.pyproject.toml— registers thecudamarker (--strict-markers).reusable-test.yml— new GPU steppytest tests/properties -m cuda, gated onrun-gpu-kernel-tests.reusable-change-detection.yml—tests/properties/**added to the GPU change filter, so property-test changes trigger the GPU job.requirements —
hypothesis-awkward+PyYAMLinrequirements-test-gpu.txt;PyYAMLinrequirements-test-full.txt.Dependency on #4128
This test intentionally carries no
@settings(nomax_examples, nodeadline). The example budget and per-example deadline are expected to come from the central Hypothesis profile in #4128. Until that lands, the GPU run uses Hypothesis defaults (200 ms deadline), which GPU launch latency can exceed; #4128 is the intended source of a GPU-appropriate profile.Test plan
pytest tests/properties/kernels—cpuparam passes.pytest tests/properties/kernels -m cudadeselects cleanly with no GPU;cudamarker registered.🤖 Generated with Claude Code