Skip to content

Respect custom strides in scalar compound assignment - #2939

Open
CAOShurong wants to merge 1 commit into
xtensor-stack:masterfrom
CAOShurong:codex/fix-strided-scalar-assignment
Open

CAOShurong wants to merge 1 commit into
xtensor-stack:masterfrom
CAOShurong:codex/fix-strided-scalar-assignment

Conversation

@CAOShurong

Copy link
Copy Markdown

Checklist

  • The title and commit message(s) are descriptive.
  • Small commits made to fix your PR have been squashed to avoid history pollution.
  • Tests have been added for new features or bug fixes.
  • API of new functions and classes are documented (no public API changes).

Description

Fixes #2773.

Scalar compound assignment currently writes the storage prefix even when an adaptor has padded strides. Use logical iteration for non-dense strides, while preserving physical iteration for dense layouts, including custom axis permutations. Dense-layout traversal preserves the behavior of aliased scalars and stateful, noncopyable functors.

Tests cover padded rows and columns, empty adaptors, scalar aliasing and functor state for both dynamic- and fixed-rank adaptors.

Validation: 26 adaptor cases (114 assertions), installed CMake consumers, and 224 owned-buffer checks under AddressSanitizer passed. A partial broader run passed 1,219 cases from the 77 test modules that compile on MSVC 19.42; the full build encounters the same baseline errors in test_xfunction and test_xvectorize.

Local microbenchmarks found up to ~1.7 ns overhead for 16-element arrays; large-array candidate/baseline ratios reached 1.13x. Linux and macOS validation remains to CI.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buggy behaviour of non-contiguous xadaptor and scalar assignment

1 participant