Created
June 9, 2017 10:06
-
-
Save simbuerg/25e193e3345fff1f6751a52a4e4fe9e1 to your computer and use it in GitHub Desktop.
Call Example (C)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "isl/map.h" | |
#include "isl/set.h" | |
#include "isl/space.h" | |
#include "isl/ctx.h" | |
int main(int argc, char *argv[]) { | |
isl_ctx *ctx = isl_ctx_alloc(); | |
isl_set *domainInner = isl_set_read_from_str(ctx, "[x,y] -> {S1[i,j] : 0 <= i,j and i < x and j < y }"); | |
isl_map *accessInner = isl_map_read_from_str(ctx, "{ S1[i,j] -> A[i+1, j-1, 42] }"); | |
isl_map *access = isl_map_read_from_str(ctx, "{S[i,j] -> F[j,i] }"); | |
isl_map *x = isl_map_intersect_domain(isl_map_copy(accessInner), isl_set_copy(domainInner)); | |
x = isl_map_project_out(x, isl_dim_in, 0, isl_map_dim(x, isl_dim_in)); | |
x = isl_map_move_dims(x, isl_dim_in, 0, isl_dim_param, 0, isl_map_dim(x, isl_dim_param)); | |
isl_map_dump(x); | |
isl_map *inFuncTrafo = isl_map_from_domain_and_range( | |
isl_map_range(isl_map_copy(access)), | |
isl_map_domain(isl_map_copy(x))); | |
isl_map_dump(inFuncTrafo); | |
for (int i=0; i < isl_map_dim(x, isl_dim_in); i++) { | |
inFuncTrafo = isl_map_equate(inFuncTrafo, isl_dim_in, i, isl_dim_out, i); | |
} | |
isl_map_dump(inFuncTrafo); | |
isl_map *new_access; | |
new_access = isl_map_apply_range(isl_map_copy(access), isl_map_copy(inFuncTrafo)); | |
isl_map_dump(new_access); | |
new_access = isl_map_apply_range(new_access, isl_map_copy(x)); | |
isl_map_dump(new_access); | |
isl_set_free(domainInner); | |
isl_map_free(accessInner); | |
isl_map_free(access); | |
isl_map_free(x); | |
isl_map_free(inFuncTrafo); | |
isl_map_free(new_access); | |
isl_ctx_free(ctx); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment