Skip to content

[LV] Cherry-picked changes for loop interleaving algorithm #8320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

nilanjana87
Copy link

@nilanjana87 nilanjana87 commented Mar 2, 2024

This PR cherry-picks commits related to changes in Loop Interleaving algorithm from upstream LLVM that started with llvm#67725.

…ation (llvm#70272)

Added tests for evaluating changes to loop interleaving count computation and for removing loop interleaving threshold in subsequent patches.
…utation (llvm#74689)

Added more pre-commit tests for evaluating changes to loop interleaving count computation in (llvm#73766). The new set of tests address the change in IC computation to minimize the remainder TC of the vectorized loop while maximizing the IC when the
remainder TC is the same.
[LV] Change loops' interleave count computation

A set of microbenchmarks in llvm-test-suite (llvm/llvm-test-suite#56), when tested on a AArch64 platform, demonstrates that loop interleaving is beneficial when the vector loop runs at least twice or when the epilogue loop trip count (TC) is minimal. Therefore, we choose interleaving count (IC) between TC/VF & TC/2*VF (VF = vectorization factor), such that remainder TC for the epilogue loop is minimum while the IC is maximum in case the remainder TC is same for both.

The initial tests for this change were submitted in PRs:
llvm#70272 and llvm#74689.
…count computation for loops that need to run scalar iterations (llvm#79640)

This patch contains a set of pre-commit tests for changing the loop interleaving count computation in a subsequent patch in order to address loops that need to execute at least a single scalar iteration in the epilogue.
…needs to run at least once (llvm#79651)

Update loop interleaving count computation to address loops that require at least one scalar iteration in the epilogue loop. For this case, the available trip count for interleaving the loop is one less.
…ave a loop (llvm#67725)

A set of microbenchmarks (llvm/llvm-test-suite#26) showed that loop interleaving can be beneficial for loops with low trip count as well. Loop interleaving count computation is updated accordingly in prior patches while this patch removes the loop trip count threshold for interleaving.
Removed target-triple in target-independent test case to fix failing test caused by llvm#67725.
This test triple was removed earlier to fix build errors. To preserve the original test intention the triple is re-added with an explicit target requirement.
Recent set of changes (PR llvm#67725) in loop interleaving algorithm caused removal of the loop trip count threshold for allowing interleaving. Therefore configuration option interleave-small-loop-scalar-reduction is no longer needed.
@nilanjana87 nilanjana87 requested a review from fhahn March 2, 2024 01:42
@fhahn
Copy link

fhahn commented Mar 2, 2024

@swift-ci please test

@fhahn
Copy link

fhahn commented Mar 2, 2024

@swift-ci please test llvm

@fhahn
Copy link

fhahn commented Mar 4, 2024

@swift-ci please test

@fhahn
Copy link

fhahn commented Mar 4, 2024

LLVM test failures should be unrelated to the patch:

Failed Tests (1):
  Clang :: ClangScanDeps/diagnostics.c

@fhahn
Copy link

fhahn commented Mar 4, 2024

@swift-ci please test

Copy link

@fhahn fhahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@nilanjana87 nilanjana87 merged commit c385bf3 into swiftlang:stable/20230725 Mar 5, 2024
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.

2 participants