ashvardanian / ashvardanian/NumKong
Feature: Poison misaligned tails in PyTest
- Dominant language
- C
- Stars
- 1.9k
- Forks
- 130
- Avg merge
- 18h 28m
- Merged PRs (30d)
- 3
Description
### Describe what you are looking for
While our C++ `nk_test` suite focuses on numerical stability, the PyTest is more focused on structural shape-related bugs and cross-referencing with third-party frameworks. It already covers a broad range of input sizes, but in the next phase of hardening - we should over-allocate larger buffers and poison their tails with infinite values to affect the resulting values if some of our tail or stride handling is broken.
```py
_nk_possible_dimensions: list[int | PoisonedSize] = [
1, 2, 3, 4, 5, 7, 8, 9,
15, 16, 17, 31, 32, 33,
63, 64, 65, 97, 128,
# Poisoned sizes — logical+padding, triggers poison fill in allocators
PoisonedSize(4, 8),
PoisonedSize(7, 8),
PoisonedSize(17, 32),
PoisonedSize(63, 64),
PoisonedSize(65, 128),
]
```
Possibly the cleanest approach is to:
1. extend input shapes to include "poisoned shapes",
2. generalize our random generators to natively handle non-integer shapes.
### Can you contribute to the implementation?
- [x] I can contribute
### Is your feature request specific to a certain interface?
It applies to everything
### Contact Details
_No response_
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start in the PyTest suite around _nk_possible_dimensions and inspect how input shapes and random generators are currently represented. Trace the allocator paths used by these tests before deciding how PoisonedSize should flow through them. Done means poisoned shapes over-allocate buffers, fill their tails with infinite values, and the PyTest coverage exercises the listed padded dimensions without breaking existing shape cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100