Loop fusion in llvm polly

161 views
Skip to first unread message

Raja Patra

unread,
Sep 14, 2021, 3:10:19 AM9/14/21
to Polly Development
Hi all,

We are trying for loop fusion on nested loops. Firstly trying with -mllvm -polly-opt-fusion=max and simple -mllvm -polly flag, is this the way to do loop fusion in polly or some other flags or pragmas are available for loop transformation from polly side. Please guide.

Thanks,
Raja

Michael Kruse

unread,
Sep 14, 2021, 3:24:54 PM9/14/21
to Raja Patra, Polly Development
The -polly-opt-fusion option maps to ISL's serialize_sccs option,
which only relates to fusion on the outermost level. Unfortunately
there is no single fuse option. Also checkout the
-polly-opt-maximize-bands, -polly-opt-outer-coincidence and ISL's
schedule_whole_component (-polly-isl-arg=--schedule-whole-component=0)
options.

Michael
> --
> You received this message because you are subscribed to the Google Groups "Polly Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to polly-dev+...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/polly-dev/b67ac709-4707-4173-aee5-3ca33bff7dedn%40googlegroups.com.



--
Tardyzentrismus verboten!

Raja Patra

unread,
Sep 14, 2021, 5:32:24 PM9/14/21
to re...@meinersbur.de, Polly Development
Hi Michael,

Thanks for your reply. Does using clang pragmas for loop transformation a better option here, as the nested loops have vector intrinsics and non affine expressions ? Please guide me.

Thanks,
Siddharth

Michael Kruse

unread,
Sep 14, 2021, 6:39:07 PM9/14/21
to Raja Patra, Michael Kruse, Polly Development
Depends. Vector intrinsics should not be a problem. Non-affine
expression can be enabled using -polly-allow-nonaffine. However, there
is no guarantee that ISL's rescheduling heuristic finds the
optimization you were looking for.
Using the Polly implementation of loop transformation pragmas, would
need to make Polly recognize the SCoP anyway, using mechanisms such as
-polly-allow-nonaffine, it only really replaces the rescheduling
heuristic.

Michael
> To view this discussion on the web, visit https://groups.google.com/d/msgid/polly-dev/CA%2BHC0Nc_DgXRsEBf_PMX%3DEfV4X1g91Y2cX-rscwPQ4KAUw8%3DaQ%40mail.gmail.com.



--
Tardyzentrismus verboten!

Raja Patra

unread,
Sep 15, 2021, 5:40:46 AM9/15/21
to re...@meinersbur.de, Polly Development
Hi Michael,

Does using the clang pragmas discussed here - https://www.youtube.com/watch?v=RhwjZS9PSI8 would be of any use for loop transformations ?

Thanks

Michael Kruse

unread,
Sep 15, 2021, 10:58:10 AM9/15/21
to Raja Patra, Michael Kruse, Polly Development
The talk refers to the implementation here:
https://reviews.llvm.org/D69088. Unfortunately there was no interest
by reviewers. Instead, I continued development of a fork here:
https://github.com/sollve/llvm-project/tree/pragma-clang-loop which
also includes the Polly changes and more loop transformations,
including loop fusion:
https://github.com/SOLLVE/llvm-project/blob/pragma-clang-loop/clang/test/TransformPragma/pragma-id-fuse.c

Michael
> To view this discussion on the web, visit https://groups.google.com/d/msgid/polly-dev/CA%2BHC0NeJCVXOvZ0wxbCRFgTG%3Dyz3%3DEWxrhyj%3DFTTnkPdno%3DAFA%40mail.gmail.com.



--
Tardyzentrismus verboten!
Reply all
Reply to author
Forward
0 new messages