Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix openscop scattering dimension parsing error #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 34 additions & 13 deletions tool/osl_pluto.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
#include "isl/map.h"
#include "isl/mat.h"
#include "isl/set.h"
#include "isl/val.h"
#include "isl/space.h"
#include "isl/union_map.h"
#include "isl/val.h"

/*
* Converts a [A c] pluto transformations to a [eq -I A c] osl scattering
Expand Down Expand Up @@ -1234,17 +1234,28 @@ static void compute_deps_osl(osl_scop_p scop, PlutoProg *prog,
isl_map *schedule_i;
isl_union_map *read_i;
isl_union_map *write_i;

char name[20];

int nb_parameters = 0;
int nb_iterators = 0;
int nb_scattdims = 0;
int nb_localdims = 0;
int array_id = 0;

snprintf(name, sizeof(name), "S_%d", i);

int niter = osl_statement_get_nb_iterators(stmt);
space = isl_space_set_alloc(ctx, scop->context->nb_parameters, niter);
osl_relation_get_attributes(stmt->scattering, &nb_parameters,
&nb_iterators, &nb_scattdims, &nb_localdims,
&array_id);

space =
isl_space_set_alloc(ctx, scop->context->nb_parameters, nb_scattdims);
if (scop->context->nb_parameters) {
scop_params = (osl_strings_p)scop->parameters->data;
space = set_names(space, isl_dim_param, scop_params->string);
}
if (niter) {
if (nb_iterators) {
osl_body_p stmt_body =
(osl_body_p)osl_generic_lookup(stmt->extension, OSL_URI_BODY);
space = set_names(space, isl_dim_set, stmt_body->iterators->string);
Expand All @@ -1253,13 +1264,13 @@ static void compute_deps_osl(osl_scop_p scop, PlutoProg *prog,
dom = osl_relation_list_to_isl_set(stmt->domain, space);
dom = isl_set_intersect_params(dom, isl_set_copy(context));

space = isl_space_alloc(ctx, scop->context->nb_parameters, niter,
2 * niter + 1);
space = isl_space_alloc(ctx, scop->context->nb_parameters, nb_iterators,
nb_scattdims);
if (scop->context->nb_parameters) {
scop_params = (osl_strings_p)scop->parameters->data;
space = set_names(space, isl_dim_param, scop_params->string);
}
if (niter) {
if (nb_iterators) {
osl_body_p stmt_body =
(osl_body_p)osl_generic_lookup(stmt->extension, OSL_URI_BODY);
space = set_names(space, isl_dim_in, stmt_body->iterators->string);
Expand Down Expand Up @@ -1310,22 +1321,32 @@ static void compute_deps_osl(osl_scop_p scop, PlutoProg *prog,

char name[25];

int nb_parameters = 0;
int nb_iterators = 0;
int nb_scattdims = 0;
int nb_localdims = 0;
int array_id = 0;

if (access->elt->type == OSL_TYPE_READ) {
snprintf(name, sizeof(name), "S_%d_r%d", i, racc_num);
} else {
snprintf(name, sizeof(name), "S_%d_w%d", i, wacc_num);
}

int niter = osl_statement_get_nb_iterators(stmt);
space = isl_space_set_alloc(ctx, scop->context->nb_parameters, niter);
osl_relation_get_attributes(stmt->scattering, &nb_parameters,
&nb_iterators, &nb_scattdims, &nb_localdims,
&array_id);

space = isl_space_set_alloc(ctx, scop->context->nb_parameters,
nb_iterators);
if (scop->context->nb_parameters) {
scop_params = (osl_strings_p)scop->parameters->data;
space = set_names(space, isl_dim_param, scop_params->string);

osl_strings_free(names->parameters);
names->parameters = osl_strings_clone(scop_params);
}
if (niter) {
if (nb_iterators) {
osl_body_p stmt_body =
(osl_body_p)osl_generic_lookup(stmt->extension, OSL_URI_BODY);
space = set_names(space, isl_dim_set, stmt_body->iterators->string);
Expand All @@ -1337,13 +1358,13 @@ static void compute_deps_osl(osl_scop_p scop, PlutoProg *prog,
dom = osl_relation_list_to_isl_set(stmt->domain, space);
dom = isl_set_intersect_params(dom, isl_set_copy(context));

space = isl_space_alloc(ctx, scop->context->nb_parameters, niter,
2 * niter + 1);
space = isl_space_alloc(ctx, scop->context->nb_parameters, nb_iterators,
nb_scattdims);
if (scop->context->nb_parameters) {
scop_params = (osl_strings_p)scop->parameters->data;
space = set_names(space, isl_dim_param, scop_params->string);
}
if (niter) {
if (nb_iterators) {
osl_body_p stmt_body =
(osl_body_p)osl_generic_lookup(stmt->extension, OSL_URI_BODY);
space = set_names(space, isl_dim_in, stmt_body->iterators->string);
Expand Down