Autovectorization corrupts argument data?

Bug #1039055 reported by Pekka Jääskeläinen on 2012-08-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pocl
Undecided
Unassigned

Bug Description

A strange issue happens when the testsuite-workgroup.at Barriered for loops (loops) case is autovectorized. It corrupts the context array where it stores the _group_id_x. While that data should come from kernel arguments passed to it by the launcher, it writes constants 0 and 1 to it in the two work items.

%7 = getelementptr [1 x [1 x [2 x i32]]]* %conv2.context_array.i, i64 0, i64 0, i64 0, i64 0
  store i32 0, i32* %7, align 4
...
 %10 = getelementptr [1 x [1 x [2 x i32]]]* %conv2.context_array.i, i64 0, i64 0, i64 0, i64 1
  store i32 1, i32* %10, align 4

That context array is supposed to store the _group_id_x.

It produces an output like this:

[GROUP_ID=0] iteration=0, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=0, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=0, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=0, B_after_barrier, local_id=1
[GROUP_ID=0] iteration=1, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=1, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=1, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=1, B_after_barrier, local_id=1
[GROUP_ID=0] iteration=2, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=2, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=2, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=2, B_after_barrier, local_id=1
[GROUP_ID=0] iteration=3, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=3, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=3, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=3, B_after_barrier, local_id=1
[GROUP_ID=0] iteration=0, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=0, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=0, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=0, B_after_barrier, local_id=1
[GROUP_ID=0] iteration=1, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=1, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=1, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=1, B_after_barrier, local_id=1
[GROUP_ID=0] iteration=2, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=2, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=2, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=2, B_after_barrier, local_id=1
[GROUP_ID=0] iteration=3, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=3, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=3, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=3, B_after_barrier, local_id=1

Instead of the correct one:

[GROUP_ID=0] iteration=0, A_before_barrier, local_id=0
[GROUP_ID=0] iteration=0, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=0, B_after_barrier, local_id=0
[GROUP_ID=0] iteration=0, B_after_barrier, local_id=1
[GROUP_ID=0] iteration=1, A_before_barrier, local_id=0
[GROUP_ID=0] iteration=1, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=1, B_after_barrier, local_id=0
[GROUP_ID=0] iteration=1, B_after_barrier, local_id=1
[GROUP_ID=0] iteration=2, A_before_barrier, local_id=0
[GROUP_ID=0] iteration=2, A_before_barrier, local_id=1
[GROUP_ID=0] iteration=2, B_after_barrier, local_id=0
[GROUP_ID=0] iteration=2, B_after_barrier, local_id=1
[GROUP_ID=1] iteration=0, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=0, A_before_barrier, local_id=1
[GROUP_ID=1] iteration=0, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=0, B_after_barrier, local_id=1
[GROUP_ID=1] iteration=1, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=1, A_before_barrier, local_id=1
[GROUP_ID=1] iteration=1, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=1, B_after_barrier, local_id=1
[GROUP_ID=1] iteration=2, A_before_barrier, local_id=0
[GROUP_ID=1] iteration=2, A_before_barrier, local_id=1
[GROUP_ID=1] iteration=2, B_after_barrier, local_id=0
[GROUP_ID=1] iteration=2, B_after_barrier, local_id=1

After disabling the autovec the _group_id is loaded from the argument struct like it should.

Vladimir Guzma (vladimir-guzma) wrote :

This should be fixed in commit 363.

Changed in pocl:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers