mirror of
https://github.com/CNugteren/CLBlast.git
synced 2024-07-04 21:36:57 +02:00
Made it more likely (but no guarantees) for amax/amin to return the first index
This commit is contained in:
parent
7fab29304c
commit
b46853660e
|
@ -64,7 +64,7 @@ void Xamax(const int n,
|
||||||
#else
|
#else
|
||||||
x = fabs(x);
|
x = fabs(x);
|
||||||
#endif
|
#endif
|
||||||
if (x >= max) {
|
if (x > max) {
|
||||||
max = x;
|
max = x;
|
||||||
imax = id*x_inc + x_offset;
|
imax = id*x_inc + x_offset;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ void Xamax(const int n,
|
||||||
// Performs reduction in local memory
|
// Performs reduction in local memory
|
||||||
for (int s=WGS1/2; s>0; s=s>>1) {
|
for (int s=WGS1/2; s>0; s=s>>1) {
|
||||||
if (lid < s) {
|
if (lid < s) {
|
||||||
if (maxlm[lid + s] >= maxlm[lid]) {
|
if (maxlm[lid + s] > maxlm[lid]) {
|
||||||
maxlm[lid] = maxlm[lid + s];
|
maxlm[lid] = maxlm[lid + s];
|
||||||
imaxlm[lid] = imaxlm[lid + s];
|
imaxlm[lid] = imaxlm[lid + s];
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ void XamaxEpilogue(const __global singlereal* restrict maxgm,
|
||||||
const int lid = get_local_id(0);
|
const int lid = get_local_id(0);
|
||||||
|
|
||||||
// Performs the first step of the reduction while loading the data
|
// Performs the first step of the reduction while loading the data
|
||||||
if (maxgm[lid + WGS2] >= maxgm[lid]) {
|
if (maxgm[lid + WGS2] > maxgm[lid]) {
|
||||||
maxlm[lid] = maxgm[lid + WGS2];
|
maxlm[lid] = maxgm[lid + WGS2];
|
||||||
imaxlm[lid] = imaxgm[lid + WGS2];
|
imaxlm[lid] = imaxgm[lid + WGS2];
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ void XamaxEpilogue(const __global singlereal* restrict maxgm,
|
||||||
// Performs reduction in local memory
|
// Performs reduction in local memory
|
||||||
for (int s=WGS2/2; s>0; s=s>>1) {
|
for (int s=WGS2/2; s>0; s=s>>1) {
|
||||||
if (lid < s) {
|
if (lid < s) {
|
||||||
if (maxlm[lid + s] >= maxlm[lid]) {
|
if (maxlm[lid + s] > maxlm[lid]) {
|
||||||
maxlm[lid] = maxlm[lid + s];
|
maxlm[lid] = maxlm[lid + s];
|
||||||
imaxlm[lid] = imaxlm[lid + s];
|
imaxlm[lid] = imaxlm[lid + s];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue