This is an archive of the discontinued LLVM Phabricator instance.

[Polly] Introduce metadata for splitting of scop statement.
ClosedPublic

Authored by nandini12396 on Aug 7 2017, 8:09 AM.

Details

Summary

This patch allows annotating of metadata in ir instruction (with "polly_split_after"), which specifies where to split a particular scop statement.

Diff Detail

Repository
rL LLVM

Event Timeline

nandini12396 created this revision.Aug 7 2017, 8:09 AM
grosser edited edge metadata.Aug 7 2017, 11:44 PM

Did you make any progress in debugging this issue? What did you try? What do you believe is the issue?

I suggest to keep investigating in case other's don't yet have time to look into your issue.

ok. The issue seems to be that the IR it is reading is wrong. It expects some other arguments probably. I will look into it.

Meinersbur added inline comments.Aug 8 2017, 5:25 AM
test/ScopInfo/statement.ll
32 โ†—(On Diff #110003)

This works:

store i32 %i.0, i32* %arrayidx, align 4, !polly_split_after !0

(metadata attached to an instruction needs a name)

oh yes. thank you!

nandini12396 retitled this revision from [Polly] [WIP] Introduce metadata for splitting to [Polly] Introduce metadata for splitting of scop statement..
nandini12396 edited the summary of this revision. (Show Details)
nandini12396 edited the summary of this revision. (Show Details)

[todo] add codegen testcase.

Meinersbur edited edge metadata.Aug 9 2017, 11:13 AM

Can you also test (and fix) the MemoryAccesses? They are currently:

Statements {
     Stmt_Stmt
         Domain :=
             { Stmt_Stmt[i0] : 0 <= i0 <= 1023 };
         Schedule :=
             { Stmt_Stmt[i0] -> [i0, 0] };
         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
             { Stmt_Stmt[i0] -> MemRef_A[i0] };
         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
             { Stmt_Stmt[i0] -> MemRef_B[i0] };
         Instructions {
               store i32 %i.0, i32* %arrayidx, align 4, !polly_split_after !0
         }
     Stmt_Stmt
         Domain :=
             { Stmt_Stmt[i0] : 0 <= i0 <= 1023 };
         Schedule :=
             { Stmt_Stmt[i0] -> [i0, 1] };
         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
             { Stmt_Stmt[i0] -> MemRef_A[i0] };
         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
             { Stmt_Stmt[i0] -> MemRef_B[i0] };
         Instructions {
               store i32 %i.0, i32* %arrayidx2, align 4
         }

While it should be:

Statements {
     Stmt_Stmt
         Domain :=
             { Stmt_Stmt[i0] : 0 <= i0 <= 1023 };
         Schedule :=
             { Stmt_Stmt[i0] -> [i0, 0] };
         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
             { Stmt_Stmt[i0] -> MemRef_A[i0] };
         Instructions {
               store i32 %i.0, i32* %arrayidx, align 4, !polly_split_after !0
         }
     Stmt_Stmt
         Domain :=
             { Stmt_Stmt[i0] : 0 <= i0 <= 1023 };
         Schedule :=
             { Stmt_Stmt[i0] -> [i0, 1] };
         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
             { Stmt_Stmt[i0] -> MemRef_B[i0] };
         Instructions {
               store i32 %i.0, i32* %arrayidx2, align 4
         }

Can you also ensure that the two statements get different names? Both are called "Stmt_Stmt" at the moment.

nandini12396 retitled this revision from [Polly] Introduce metadata for splitting of scop statement. to [Polly][WIP] Introduce metadata for splitting of scop statement..
  • gives correct memory access for statement.ll but various tests fail. Trying to fix them.

use correct check.

I get 92 regression test failures.

test/ScopInfo/statement.ll
38 โ†—(On Diff #111299)

stmt_split_no_dependence.ll is identical to this one? You could leave this test-case as-is and instead add the CHECKs to the other one.

@Meinersbur : Please suggest what I can to do to fix these failures?

Which one do you have problems with? What's your analysis why it doesn't work? What did you already try to fix it?

From just comparing the output, it seems that there are some memory accesses which are not getting identified by this change. This one I am very suprised about and have no clue.
Regarding the Assertion `SAI && "No ScopArrayInfo available for this base pointer"' fail, I am trying to add assert statements to check if the statements match.

Hi Sir,

I understand the problem why some memory accesses are not getting outputted. The reason is that its a memory access corresponding to an instruction which is not in the explicit instruction list of the statement. So since there is no statement corresponding to it, it is getting skipped. What we need is that all memory accesses upto a certain instruction get added to the statement split until that point. For this, should we have another instruction list? Do we also need a parameter for number of statements per BB?

[todo] fix naming

  • add automatically working test cases.

missed out 2 in prev diff.

Meinersbur added inline comments.Aug 22 2017, 6:55 AM
include/polly/ScopInfo.h
1312โ€“1313 โ†—(On Diff #112155)

[Style] With a public accessor, this field can be made private.

1602 โ†—(On Diff #112155)

It's not an "ID" (which stands for identifier) when there are multiple statements with that id.

1735 โ†—(On Diff #112155)

What is this map needed for? There is only code that adds elements, but none that queries it.

2195 โ†—(On Diff #112155)

[Style] LLVM's coding style policy says parameters/variable should start with upper case letters.

lib/Analysis/ScopBuilder.cpp
623 โ†—(On Diff #112155)

[Style] LLVM's coding style policy says parameters/variables should start with upper case letters.

Is there a reason to make it unsigned? IMHO using signed by default is a good idea (Motivation)

660 โ†—(On Diff #112155)

Could this variable have a more descriptive name than flag?

What do you need it for? Wouldn't it suffice to just increase the StmtID after the current instruction has been processed?

670 โ†—(On Diff #112155)

Would it be possible to use getStmtListFor(BB)[count] to get the statement this instruction is supposed to be in? This would not require introducing any new ID.

test/ScopInfo/statement.ll
12 โ†—(On Diff #112155)

Both statements are still named "Stmt_Stmt"?

nandini12396 added inline comments.Aug 22 2017, 7:44 AM
lib/Analysis/ScopBuilder.cpp
623 โ†—(On Diff #112155)

sure, the example in the talk is really nice. thank you for sharing!

Addressed @Meinersbur's comments.

nandini12396 retitled this revision from [Polly][WIP] Introduce metadata for splitting of scop statement. to [Polly] Introduce metadata for splitting of scop statement..

forgot to capitalise

addressed comments.

LGTM. There is just the unnecessary field Count. Can you remove it (And also run polly-update-format)? Many Thanks.

include/polly/ScopInfo.h
1313 โ†—(On Diff #112697)

[Nit] This member is unused.

sorry, removed unused variable.

Meinersbur accepted this revision.Aug 30 2017, 3:12 AM
This revision is now accepted and ready to land.Aug 30 2017, 3:12 AM
This revision was automatically updated to reflect the committed changes.
polly/trunk/test/Isl/CodeGen/stmt_split_no_dependence.ll