summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e929d65)
The test case was written with assumptions about loop iteration ordering
that are not guaranteed by OpenACC and do not apply on all targets,
in particular AMD GCN. This patch removes those assumptions.
2020-09-08 Julian Brown <julian@codesourcery.com>
libgomp/
* testsuite/libgomp.oacc-c-c++-common/atomic_capture-2.c: Remove
iteration-ordering assumptions.
imin = idata[i] < imin ? idata[i] : imin;
}
imin = idata[i] < imin ? idata[i] : imin;
}
- if (imax != 1234 || imin != 0)
+ if (imax != 1234 || imin < 0 || imin > 1)
+ int ones = 0, zeros = 0;
+
- if (i % 2 == 0)
- {
- if (idata[i] != 1)
- abort ();
- }
- else
- {
- if (idata[i] != 0)
- abort ();
- }
+ if (idata[i] == 1)
+ ones++;
+ else if (idata[i] == 0)
+ zeros++;
+
+ if (ones != N / 2 || zeros != N / 2)
+ abort ();
if (iexp != igot)
abort ();
if (iexp != igot)
abort ();
- if (i % 2 == 0)
- {
- if (idata[i] != 0)
- abort ();
- }
- else
- {
- if (idata[i] != 1)
- abort ();
- }
+ if (idata[i] == 1)
+ ones++;
+ else if (idata[i] == 0)
+ zeros++;
+
+ if (ones != N / 2 || zeros != N / 2)
+ abort ();
if (iexp != igot)
abort ();
if (iexp != igot)
abort ();
if (lexp != lgot)
abort ();
if (lexp != lgot)
abort ();
lexp = 2LL;
#pragma acc data copy (lgot, ldata[0:N])
lexp = 2LL;
#pragma acc data copy (lgot, ldata[0:N])
#pragma acc parallel loop
for (i = 0; i < N; i++)
{
#pragma acc parallel loop
for (i = 0; i < N; i++)
{
- long long expr = 1LL << N;
#pragma acc atomic capture
{ lgot = lgot / expr; ldata[i] = lgot; }
#pragma acc atomic capture
{ lgot = lgot / expr; ldata[i] = lgot; }
- if (i % 2 == 0)
- {
- if (fdata[i] != 1.0)
- abort ();
- }
- else
- {
- if (fdata[i] != 0.0)
- abort ();
- }
+ if (fdata[i] == 1.0)
+ ones++;
+ else if (fdata[i] == 0.0)
+ zeros++;
+
+ if (ones != N / 2 || zeros != N / 2)
+ abort ();
if (fexp != fgot)
abort ();
if (fexp != fgot)
abort ();
- if (i % 2 == 0)
- {
- if (fdata[i] != 0.0)
- abort ();
- }
- else
- {
- if (fdata[i] != 1.0)
- abort ();
- }
+ if (fdata[i] == 1.0)
+ ones++;
+ else if (fdata[i] == 0.0)
+ zeros++;
+
+ if (ones != N / 2 || zeros != N / 2)
+ abort ();
if (fexp != fgot)
abort ();
if (fexp != fgot)
abort ();
abort ();
fgot = 8192.0*8192.0*64.0;
abort ();
fgot = 8192.0*8192.0*64.0;
#pragma acc data copy (fgot, fdata[0:N])
{
#pragma acc data copy (fgot, fdata[0:N])
{
if (fexp != fgot)
abort ();
if (fexp != fgot)
abort ();
- fgot = 4.0;
- fexp = 4.0;
+ fgot = 2.0 * (1LL << N);
+ fexp = 2.0;
#pragma acc data copy (fgot, fdata[0:N])
{
#pragma acc parallel loop
for (i = 0; i < N; i++)
{
#pragma acc data copy (fgot, fdata[0:N])
{
#pragma acc parallel loop
for (i = 0; i < N; i++)
{
- long long expr = 1LL << N;
#pragma acc atomic capture
{ fgot = fgot / expr; fdata[i] = fgot; }
#pragma acc atomic capture
{ fgot = fgot / expr; fdata[i] = fgot; }