Add shared vector linear-recurrence optimization for multi-array NaturalArray loops#91
Merged
DanexCodr merged 13 commits intoApr 12, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/4e0ce258-ef41-4a6f-be38-ffa472d9e8b4 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/4e0ce258-ef41-4a6f-be38-ffa472d9e8b4 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/4e0ce258-ef41-4a6f-be38-ffa472d9e8b4 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/4e0ce258-ef41-4a6f-be38-ffa472d9e8b4 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/4e0ce258-ef41-4a6f-be38-ffa472d9e8b4 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/4e0ce258-ef41-4a6f-be38-ffa472d9e8b4 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/4e0ce258-ef41-4a6f-be38-ffa472d9e8b4 Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/6399c570-b95d-4d37-a5ef-4f2b988df11d Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/6399c570-b95d-4d37-a5ef-4f2b988df11d Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/6399c570-b95d-4d37-a5ef-4f2b988df11d Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/6399c570-b95d-4d37-a5ef-4f2b988df11d Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/6399c570-b95d-4d37-a5ef-4f2b988df11d Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/6399c570-b95d-4d37-a5ef-4f2b988df11d Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
DanexCodr
April 12, 2026 21:41
View session
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.
This change extends recurrence optimization from single-array linear recurrences to N interconnected recurrences in one loop. It detects multi-assignment recurrence systems, builds a shared vector recurrence model, and evaluates per-array terms via shared rolling state for sequential access.
Vector recurrence model (new formula type)
VectorRecurrenceFormulato represent coupled recurrences across multiple arrays.m(number of arrays/sequences)k(max lag)i -> i+1evaluation.NaturalArray integration
NaturalArray(formula + sequenceIndex).Loop optimizer: vector detection + extraction
LoopOptimizationHandlerto detect loop bodies with multiple assignments of formarr[i] = ....Pattern application
PatternHandlerwithVECTOR_LINEAR_RECURRENCE.VectorRecurrenceFormulaper detected system and attaches it to all target arrays with stable sequence indices.Coverage
VectorLinearRecurrenceOptimization.codwith coupled recurrence systems (including mixed lags and constant terms).This loop is now recognized as a single vector recurrence system and optimized as shared state instead of independent per-array fallback evaluation.