This is an archive of the discontinued LLVM Phabricator instance.

[SingleSource/Vectorizer] Add runtime checks tests for nested loops
ClosedPublic

Authored by david-arm on Jul 7 2023, 7:05 AM.

Details

Summary

This patch adds tests for nested loops like this:

for (int i = 0; i < N; i++) {
  for (int j = 0; j < N; j++) {
    a[(i * (N + 1)) + j] += b[(i * N) + j];
  }
}

where we generate runtime checks for the inner loop that do not
currently get hoisted above the outer loop.

Diff Detail

Repository
rT test-suite

Event Timeline

david-arm created this revision.Jul 7 2023, 7:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2023, 7:05 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
david-arm requested review of this revision.Jul 7 2023, 7:05 AM
fhahn added a comment.Jul 9 2023, 1:24 PM

Thanks for adding those. Do you think it would be relatively straight forward to add variants where the trip counts of both loops are different & maybe where the induction counts down?

SingleSource/UnitTests/Vectorizer/common.h
21

Does the helper need 3 pointer arguments? It looks like only A and B are used in the code below.

david-arm updated this revision to Diff 538625.Jul 10 2023, 6:58 AM
  • Added more test cases, such as allowing the trip counts to differ, and permitting decreasing outer loop induction variables.
david-arm marked an inline comment as done.Jul 10 2023, 6:59 AM

Thanks for adding those. Do you think it would be relatively straight forward to add variants where the trip counts of both loops are different & maybe where the induction counts down?

Both are good suggestions! I've added some to the file.

fhahn accepted this revision.Jul 19 2023, 10:27 AM

LGTM, thanks!

SingleSource/UnitTests/Vectorizer/common.h
20

nit: might be good to include the fact that this is for nested loops in the name

This revision is now accepted and ready to land.Jul 19 2023, 10:27 AM
This revision was landed with ongoing or failed builds.Jul 20 2023, 1:07 AM
This revision was automatically updated to reflect the committed changes.