Re: [Polybench-discussion] non-parametric polybench benchmarks
Brought to you by:
pouchet,
tomofumi-yuki
|
From: Louis-Noel P. <po...@cs...> - 2012-02-03 20:03:14
|
On Feb 1, 2012, at 5:50 AM, Sven Verdoolaege wrote:
> Hi,
>
> The lastest PolyBench has proper support for parametric benchmarks,
> i.e., if you define POLYBENCH_USE_C99_PROTO, both iteration domains
> and array sizes are parametric.
>
> However, there does not seem to be any way of obtaining instances
> of the benchmarks for specific values of the parameters.
> If you don't define POLYBENCH_USE_C99_PROTO the arrays have
> a fixed size, but the iteration domains are still parametric.
>
> When generating CUDA code, you typically want to generate code
> for specific values of the parameters. If the iteration domains
> are still parametric, you just get a bunch of useless extra
> conditions on the parameters, slowing down the execution.
>
> Would it be possible to apply something like this to
> all benchmarks?
I am very reluctant to say yes. The problem is the following: using this kind of syntax makes much more complex the task of simplistic source code analyzer, because of the "function call" in the loop bounds. Indeed, unless using a CPP, the macro is interpreted as a function here by tools such as Clan (at least it's current version embedded in PoCC).
I see maybe a possibility:
- in the benchmark header file:
#define paramN POLYBENCH_SCALARBOUNDS_SELECT(N,n)
- in the source file:
#pragma scop
- for (i = 0; i < n; i++)
- for (j = 0; j < n; j++)
+ for (i = 0; i < paramN; i++)
+ for (j = 0; j < paramN; j++)
x1[i] = x1[i] + A[i][j] * y_1[j];
...
Would that work for you? A solution like that allows "real" compilers to end up with the actual scalar value associated to N in the loop nest, after some CPP, and "toy" parsers to still see a simple expression for the loop nest.
I'm interested in any other suggestion that:
- preserves simple expression for the loop bounds in between the #pragma scop/endscop
- default to a variable symbol in the code (eg, 'n')
- allows with some flag to have the scalar value for the loop bound
Thanks,
++
>
> diff --git a/trunk/linear-algebra/kernels/mvt/mvt.c b/trunk/linear-algebra/kernels/mvt/mvt.c
> index 619599d..b2a6f7d 100644
> --- a/trunk/linear-algebra/kernels/mvt/mvt.c
> +++ b/trunk/linear-algebra/kernels/mvt/mvt.c
> @@ -72,11 +72,11 @@ void kernel_mvt(int n,
> int i, j;
>
> #pragma scop
> - for (i = 0; i < n; i++)
> - for (j = 0; j < n; j++)
> + for (i = 0; i < POLYBENCH_C99_SELECT(N,n); i++)
> + for (j = 0; j < POLYBENCH_C99_SELECT(N,n); j++)
> x1[i] = x1[i] + A[i][j] * y_1[j];
> - for (i = 0; i < n; i++)
> - for (j = 0; j < n; j++)
> + for (i = 0; i < POLYBENCH_C99_SELECT(N,n); i++)
> + for (j = 0; j < POLYBENCH_C99_SELECT(N,n); j++)
> x2[i] = x2[i] + A[j][i] * y_2[j];
> #pragma endscop
>
> Or do you have any other suggestions for obtaining fixed size instances?
>
> (Of course, we can always plug in the value of n after extracting a model,
> but this is error-prone since we need to ensure that the values of n and N
> are the same.)
>
> Thanks,
>
> skimo
>
> Btw, http://www.cse.ohio-state.edu/~pouchet/software/polybench/
> doesn't seem to mention the mailing list.
--
Louis-Noel Pouchet
po...@cs...
|