Example #1
0
/* Vectorize first loop in band that meets criteria */
int pluto_pre_vectorize_band(Band *band, int num_tiling_levels, PlutoProg *prog)
{
    int num, l;

    /* Band has to be the innermost band as well */
    if (!pluto_is_band_innermost(band, num_tiling_levels)) return 0;

    Ploop **loops;

    loops = pluto_get_loops_under(band->loop->stmts, band->loop->nstmts, 
            band->loop->depth + num_tiling_levels*band->width, prog, &num);

    for (l=0; l<num; l++) {
        if (!pluto_loop_is_parallel(prog, loops[l])) continue;
        int s, t, a;
        a = get_num_accesses(loops[l], prog);
        s = get_num_spatial_accesses(loops[l], prog);
        t = get_num_invariant_accesses(loops[l], prog);
        /* Vectorize only if each access has either spatial or temporal
         * reuse */
        /* if accesses haven't been provided, a would be 0 */
        if (a >= 1 && a == s + t) break;
    }

    if (l < num) {
        pluto_make_innermost(loops[l], prog);
        IF_DEBUG(printf("[Pluto] Loop to be vectorized: "););
Example #2
0
/* Check if loop is amenable to straightforward vectorization */
int pluto_loop_is_vectorizable(Ploop *loop, PlutoProg *prog)
{
    int s, t, a;

    /* LIMITATION: it is possible (rarely) that a loop is not parallel at this
     * position, but, once made innermost, is parallel. We aren't checking
     * if it would be parallel at its new position
     */
    if (!pluto_loop_is_parallel(prog, loop)) return 0;
    a = get_num_accesses(loop, prog);
    s = get_num_spatial_accesses(loop, prog);
    t = get_num_invariant_accesses(loop, prog);
    /* Vectorize only if each access has either spatial or temporal
     * reuse */
    /* if accesses haven't been provided, a would be 0 */
    if (a >= 1 && a == s + t) return 1;

    return 0;
}