On 31/07/2014 16:41, Roman Gareev wrote:
Tobias, could you please advise me how is it better to determine a
depth for loop (it is necessary for loop_is_parallel_p)? In
graphite-clast-to-gimple.c. it is done by using the number of
dimensions of a domain, which is attached to clast_for. As far as I
know, isl doesn't give such a opportunity. If I'm not mistaken “2 * (
level + 1) “ is also not suitable for all cases.
Hi Roman,
you can get this information from the isl_ast_build that was used when
generating a certain loop (you can access this isl_ast_build from the
callbacks isl_ast_build_set_before_each_for and
isl_ast_build_set_after_each_for). With isl_ast_build_get_schedule, you
can get an incomplete schedule (less dimensions then the schedule that
you gave to the isl ast generator). Specifically, it only contains the
dimensions of the current loop and all surrounding ones. Consequently
the last dimension in this incomplete schedule is the dimension you want
to check for parallelism.
If you use this schedule in
loop_level_carries_dependences instead of the result from
scop_get_transformed_schedule you should even be able to detect
parallelism for something like the following:
for (i
A[i] += i
for (i)
A[0] += i
Here the first loop is parallel, but the second not. The old approach
would have said this dimension is not parallel at all. If you use the
schedule provided, you only look at the statements involved in a certain
loop, so the first loop would be detected as parallel.
Tobias