Repository navigation
Commit a17bca9
committed
Review the row framework: fix the docs, close the test gaps
A review pass over the row scalar-function framework in three parts. **The
author-facing API is unchanged.** Every proposal that would have altered it was
implemented, run against the suite, and then backed out, because none of them
prevents a bug and this branch's open work is settling the API rather than
churning it. What lands is cleanup, corrected documentation, and test coverage.
The emitted IR of every `visit_prepared_into` monomorph is identical to the
parent commit.
Corrections, each of which was a claim in a doc comment that is not true:
- The dense-retry path does not filter unconditionally because a deferred sink
cannot skip rows. `ERRORS_ARE_DEFERRED` and `SUPPORTS_SKIPPED_ROWS` are
independent consts and a sink may legally set both; the real reason is that
`execute_dense` is never handed the `branch` closure.
- `CheckedSink`'s `SUPPORTS_SKIPPED_ROWS = false` is load-bearing, not a
restatement of the policy. A deferred result reaches valid-only execution
whenever its arguments are not dense-safe, so the sink's own `false` is what
keeps its uninitialized slots sound.
- `scalar_fn`'s trait-choice doc listed `vortex.byte_length` as a `RowFn` when it
is a `ScalarFnVTable`. It is now the worked example of row-determined being
necessary but not sufficient: it measured 7.6x slower as a row function,
because the length is a field of the view and the row loop paid to resolve
bytes it never read.
- `contains_route`'s bump guidance pointed at `constant_operands_agree_with_columns`
as the check that catches a moved row. That test covers four of the ten
container types. `routes_agree_with_geo_for_every_container` now covers all
ten against plain `a.contains(b)` in every constant arrangement.
- The workspace `geo` requirement admits every 0.31.x, which `cargo update`
takes with no diff to review, so the lockfile is the real boundary rather than
the version line.
Cleanup:
- Delete `InputElement::decode_null_tolerant` overrides that only restated the
default, from the primitive, bool and `TensorRow` elements. `GeometryRow`'s is
the only real one, and the doc now says a dense-safe element should not
override.
- Keep one `l2_norm_row`. Cosine's prepared and per-row arms must agree bit for
bit, which holds only while both accumulate in the same order, so the second
copy was an invitation to break the property its comments defend.
- Zip the cosine `reduce_encoded` loops instead of indexing three slices per row,
and record why it materializes where `InnerProduct` stays lazy.
- Collapse the checked-arithmetic macros so each predicate is written once.
`impl_checked_integer!` owns the shape; the unsigned and signed wrappers own
their add/sub/div; only `mul_failure` varies per width. Delete
`CheckedArithmetic::mul_error`, which had no caller once `CheckedMul` reported
through `mul_failure`.
- Share `resolve_validity` between `execute_filtered` and the forced-strategy
test seam so the mask shortcuts cannot drift apart.
- Record on `ElementTuple` why it carries arities past the widest function in
tree: it is sealed, so those are the only ones a downstream crate can have.
Coverage:
- `reduce_encoded_is_probed_before_and_after_filtering` pins that the rewrite is
offered the original arrays at full length and then the filtered ones at the
surviving count. Both probes matter, which is why the #9130 follow-up to skip
the first one should be struck rather than implemented: it is the only probe
that sees the arrays still encoded.
`SCALAR_FN_HANDOFF.md` records the five changes proposed and reverted, so they
are decided rather than re-attempted: three API changes now posed as questions
for #9129, the `ElementTuple` arity trim, and making
`CheckedSink` safe with `BufferMut::zeroed`. That last one measured 1.65 to 1.71x
slower than the `MaybeUninit` storage it replaced, across every batch size from
8 KiB to 2 MiB, because `alloc_zeroed` does not avoid the write pass the row loop
then duplicates. The notes also state the IR gate's blind spot, which is what let
that regression pass it: the IR of a row loop cannot show an allocator call
outside the loop.
Verification: 3319 vortex-array, 179 vortex-tensor and 241 vortex-geo tests, 72
doctests, clippy over the three crates with `--all-targets --all-features`,
nightly fmt, and `git diff --check`.
Signed-off-by: "Connor Tsui" <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014mwiAahcxc5xBfTrhDK11L1 parent f430847 commit a17bca9
16 files changed
Lines changed: 545 additions & 282 deletions
File tree
- vortex-array/src/scalar_fn
- fns/binary/numeric
- row
- element
- tests
- vortex-geo/src/scalar_fn
- vortex-tensor/src/scalar_fns
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
163 | 167 | | |
164 | 168 | | |
165 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
281 | 415 | | |
282 | 416 | | |
283 | 417 | | |
| |||
0 commit comments