AnsweredAssumed Answered

OpenCL: Does optimization slow?

Question asked by vit on Jul 10, 2018
Latest reply on Jul 17, 2018 by vit

(Sorry for my English)

There is a statistical function:

 

int tst(global int* x, int bar,

        int lo, int hi,

        int n, bool flag)

{

    int _bar = bar - n + 1,

        S1 = 0,

        NPlus1 = n + 1,

        i = 2,

        i_ = n >> 1 << 1;

    do

    {

        if (x[_bar] > x[bar])

            S1 += NPlus1 - i;

        if (i == i_)

            break;

        bar--;

        _bar++;

        i += 2;

    }

    while (true);

    /*process S1...*/

    return 0;

}

 

remove NPlus1 and modify the function:

1) i = 1                              [old i = 2]

2) i_ = (n >> 1 << 1) - 1     [old i_ = n >> 1 << 1]

3) S1 += n - i                    [old S1 += NPlus1 - i]

 

The new modification works at 15 - 20% slower ! But nothing fundamentally changed...

What is the reason ?

 

Radeon R7 360

Driver ver. 23.20.15033.5003

Outcomes