[llvm-dev] Polly loop offloading to Accelerator

Michael Kruse via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 29 18:41:27 PST 2018


2018-01-29 14:43 GMT-06:00 hameeza ahmed <hahmed2305 at gmail.com>:
> Thank You.
>
> i used -polly-ast-detect-parallel but there is no coincident info generated;
>
> my c code is simple vec-sum as follows;
>
> #include <stdio.h>
> int a[2048], b[2048], c[2048];
> foo () {
> int i;
> for (i=0; i<2048; i++) {
>  a[i]=b[5] + c[i];
>
> }
> }
>
> i executed following commands;
>
> $clang  -S -emit-llvm vec-sum.cpp -march=native -O3 -mllvm
> -disable-llvm-optzns -o vec-sum.s
> $opt -S -polly-canonicalize vec-sum.s > vecsum.preopt.ll
> $opt -polly-ast -polly-ast-detect-parallel -analyze -q vecsum.preopt.ll
> -polly-process-unprofitable
>
> the output is;
>
> :: isl ast :: foo :: %1---%8
>
> if (1)
>
>     #pragma simd
>     #pragma known-parallel
>     for (int c0 = 0; c0 <= 2047; c0 += 1)
>       Stmt0(c0);
>
> else
>     {  /* original code */ }
>
>
> there is no coincident info.
>
> Can you please explain coincident...How it is related to locality?

"coincidence" is isl's term for being executable in parallel. It is right there:

    #pragma known-parallel



> Well my work deals with identifying non-temporal accesses and if such
> accesses are found offload them to my accelerator...
>
> now it can be done by multiple approaches if i implement my own pass where i
> do all the dependency and locality analysis from scratch using some builtin
> llvm passes (i dont know if they are efficient enough), so in the end my
> pass should detect whether the code has non temporal behavior or not..
> 2nd approach could be using polly passes to detect locality (non-temporal)
> in my new pass..........
>
> and based on the analysis results i also need to transform my IR such as
> appending meta data (my-accelerator) to the non temporal accesses
> (loops).......

Could you please explain what you understand by non-temporal
accesses/behavior and why it is important to your accelerator? Is it
about the accelerator's cache behavior?

Michael


More information about the llvm-dev mailing list