[Polly] Generating code for changed memory accesses

'Johannes Doerfert' doerfert at cs.uni-saarland.de
Mon Jul 28 19:07:55 PDT 2014


> There is a difference between scattering and domain. Only the scattering is
> changed, the dimensionality of the domain is _never_ changed and
> consequently the memory access does not need to be updated.
Then I just have an implementation problem I guess...

> >Now we can either apply the scattering to the access relation when we generate code or not.
> 
> What you want to do is the following:
> 
> 1) Get the schedule map from the isl_ast_build
> 
> 2) Translate it to an isl_pw_multi_aff
> 
> 3) Translate the access function to an isl_pw_multi_aff
> 
> 4) Express the access function in terms of new loop iterators
> 
> To do this you use isl_multi_pw_aff_pullback_pw_multi_aff() to
> apply the schedule pma to the your access function
> 
> 5) Build the ast expression
I tried this and I run into the same problems as before (test case:
test/Isl/CodeGen/20120403-RHS-type-mismatch.ll, the new getNewAccessOperand
function is appended to this mail).

I show you the results of the steps above. Note, that in my implementation I
remove the Stmt_for_body7 tuple name to make it work in general, only these
corner cases are not yet handled.

1)
  { Stmt_for_body7[0] -> [] }
2)
  { Stmt_for_body7[i0] -> [] : i0 = 0 }
3) a) The access relation (isl_map)
  { Stmt_for_body7[i0] -> MemRef_hi_129_reg2mem[0] }
3) b) The access relation (pw_multi_aff)
  { Stmt_for_body7[i0] -> MemRef_hi_129_reg2mem[(0)] }
4)
  Crash (in isl_space_tuple_match).
5) This part is fine again.


Can you tell me what I'm doing wrong?

-------------------------------------------------------------------------------


Value *BlockGenerator::getNewAccessOperand(const MemoryAccess &MA) {
  isl_pw_multi_aff *PWSchedule, *PWAccRel;
  isl_union_map *ScheduleU;
  isl_map *Schedule, *AccRel;
  isl_ast_expr *Expr;

  assert(ExprBuilder && Build &&
         "Cannot generate new value without IslExprBuilder!");

  AccRel = isl_map_reset_tuple_id(MA.getNewAccessRelation(), isl_dim_in);
  if (!AccRel)
    AccRel = isl_map_reset_tuple_id(MA.getAccessRelation(), isl_dim_in);

  ScheduleU = isl_ast_build_get_schedule(Build);
  ScheduleU = isl_union_map_intersect_domain(
      ScheduleU, isl_union_set_from_set(MA.getStatement()->getDomain()));
  Schedule = isl_map_from_union_map(ScheduleU);
  Schedule = isl_map_reset_tuple_id(Schedule, isl_dim_in);

  PWSchedule = isl_pw_multi_aff_from_map(Schedule);
  PWAccRel = isl_pw_multi_aff_from_map(AccRel);
  PWAccRel = isl_pw_multi_aff_pullback_pw_multi_aff(PWAccRel, PWSchedule);

  Expr = isl_ast_build_access_from_pw_multi_aff(Build, PWAccRel);
  return ExprBuilder->create(Expr);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140728/fe265e74/attachment.sig>


More information about the llvm-commits mailing list