Skip to content

Fix/732 preserve overlap copy semantics - #1417

Merged
godofecht merged 11 commits into
mainfrom
fix/732-preserve-overlap-copy-semantics
Oct 6, 2026
Merged

godofecht merged 11 commits into
mainfrom
fix/732-preserve-overlap-copy-semantics

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Intent

Linked issue or roadmap item:

What changed, and why is this the smallest useful change?

Overlap check

  • I searched open pull requests and recent commits for overlapping work.
  • This does not duplicate another active implementation, or the relationship is explained below.

Overlap / dependency notes:

Evidence

Baseline before this change:

Targeted proof that exercises the changed behaviour:

Why that proof would detect the old failure or regression:

Repository gate(s) run:

Generated/bootstrap state, if any:

Risk

Compatibility, performance, security, lifetime, backend, or release implications:

  • No unresolved language/API design decision is being implemented implicitly.
  • No unrelated generated artifacts or local state are included.
  • Docs changed when user-visible behaviour or syntax changed.
  • docs/project/Questions.md updated if this needs a language-design decision.

Compatibility

  • No user-visible compatibility change.
  • Compatibility change is documented in docs/project/CHANGELOG.md.

Agent handoff

Agent/provider/session, when applicable:

Any remaining blocker is recorded in GitHub rather than only in local/session state:

@godofecht
godofecht merged commit d3942f7 into main Oct 6, 2026
37 checks passed
@godofecht
godofecht deleted the fix/732-preserve-overlap-copy-semantics branch October 6, 2026 22:35
godofecht added a commit that referenced this pull request Oct 7, 2026
…om closed PRs

Salvaged from closed pull requests whose code already landed:

- #1360 (region inference, code merged as #1390): region-inference.md,
  the tests/cgen region_inference and region_unproven goldens, and the
  spec, book, spans, lifetime-domains, README, spec-index, nav and
  CHANGELOG lines.
- #1368 (noalias, code merged as #1388): the spans.md paragraph on
  restrict .data temporaries and its noalias.md link.
- #1380 (tail-resumptive effects, code merged as #1349): the spec-index
  row for effects-continuations.md.

#1417 landed after #1360 and keeps an unproven forward copy as an
ordered element loop. The region_inference golden and the docs now say
that, in place of the memmove the closed branch expected. The golden
fails on the pre-#1417 compiler, which emitted memmove.
godofecht added a commit that referenced this pull request Oct 7, 2026
…om closed PRs (#1425)

Salvaged from closed #1360 (region-inference.md, region_inference and region_unproven goldens, spec/book/index lines), #1368 (spans.md restrict .data paragraph) and #1380 (spec-index row for effects-continuations.md). The region_inference golden and docs follow #1417: an unproven parameter copy stays an ordered loop.
godofecht added a commit that referenced this pull request Oct 7, 2026
…739)

Folded into the rebased feature commit while resolving it against #1417:

- Span copies use memcpy through .data only when flowc_region_disjoint
  proves the regions disjoint; otherwise the ordered loop stays. The
  branch's memmove path would snapshot a shifted view (dst = src + 1)
  that the scalar loop treats as a recurrence.
- The scale, axpy and add vector_size kernels run only when every read
  base is the destination itself or proven disjoint from it, the scalar
  factor reads no memory and calls nothing (it is hoisted), all bases
  share the element type, and FLOWC_CHECKS is off (the kernels move whole
  lanes past the per-index bounds tests).
- Salvaged from closed #1396 (commit 2eedcac): flowc_cgen_if_is_select
  returns flowc_cgen_select_exprs_ok, and an if without else is never a
  select, so `if c { a[i] = v }` no longer reads a[i] when c is the
  bounds guard (test_hybrid_events, test_stdlib_regex).

Tests: for_simd_kernel_overlap (runtime recurrence on shifted views; the
branch's original compiler exits 1), for_simd_kernel_disjoint,
for_simd_kernel_checked, for_simd_select_noelse, and for_simd_span_copy
(parameters keep the loop, disjoint locals memcpy). All of them fail on
the branch's original compiler.
godofecht added a commit that referenced this pull request Oct 7, 2026
#pragma omp simd and GCC ivdep tell the C compiler that iterations are
independent. An indexed store does not prove that on its own: dst may be
src + 1. A loop body now gets them only when it is one statement that is
either a reduction or a store dst[i] = e where the noalias analysis made
dst restrict (#731) and e reads dst only at [i]. A reduction whose other
operand reads the accumulator (acc = acc + acc * 2) is a recurrence and
is no longer treated as a reduction. Other loops keep the clang vectorize
request. flowc_cgen_assign_is_index_store is removed as unused.

Carried from the SIMD half of the original #1416 branch; its copy half
landed as #1417.
godofecht added a commit that referenced this pull request Oct 7, 2026
Counted whiles rotate to a C for with the clang hint and GCC ivdep. Unit-stride span copies use one memcpy through .data when region inference proves the regions disjoint, otherwise the ordered loop stays (#1417). Clip/min-max if/else stores to one index become a ternary select; an if without else keeps the branch (folded from closed #1396). f32/f64 fill/scale/axpy/add/sum/dot use vector_size(16) kernels behind FLOWC_HAS_V128 only when every read base is the destination or proven disjoint, the scalar factor is pure, and FLOWC_CHECKS is off. Goldens: for_simd_kernel_overlap, for_simd_kernel_disjoint, for_simd_kernel_checked, for_simd_select_noelse, for_simd_span_copy, for_simd_while, for_simd_clip. Part of #739.
godofecht added a commit that referenced this pull request Oct 7, 2026
#pragma omp simd and GCC ivdep tell the C compiler that iterations are
independent. An indexed store does not prove that on its own: dst may be
src + 1. flowc_cgen_loop_omp_safe now accepts a body of `let` statements
followed by one statement that is either a reduction whose accumulator no
`let` reads, or a store or select `if` into dst[v] where the noalias
analysis made dst restrict (#731) and every expression reads dst only as
dst[v]. A reduction whose other operand reads the accumulator
(acc = acc + acc * 2) is a recurrence and no longer counts. The rotated
while loops from #1363 use the same predicate for their ivdep, and
flowc_cgen_body_omp_safe_skip is removed. Other loops keep the clang
vectorize request.

Carried from the SIMD half of the original #1416 branch; its copy half
landed as #1417.
godofecht added a commit that referenced this pull request Oct 7, 2026
#pragma omp simd and GCC ivdep tell the C compiler that iterations are
independent. An indexed store does not prove that on its own: dst may be
src + 1. flowc_cgen_loop_omp_safe now accepts a body of `let` statements
followed by one statement that is either a reduction whose accumulator no
`let` reads, or a store or select `if` into dst[v] where the noalias
analysis made dst restrict (#731) and every expression reads dst only as
dst[v]. A reduction whose other operand reads the accumulator
(acc = acc + acc * 2) is a recurrence and no longer counts. The rotated
while loops from #1363 use the same predicate for their ivdep, and
flowc_cgen_body_omp_safe_skip is removed. Other loops keep the clang
vectorize request.

Carried from the SIMD half of the original #1416 branch; its copy half
landed as #1417.
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.

1 participant