From 60433ace28be2ecda9c1d30f4de3f832b2af0efa Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 15 May 2018 09:28:03 +0200 Subject: [PATCH] gpu_array_bound: always store shift/stride Since ppcg-0.08-4-g9040bd2f (gpu_group.c: set_stride: use isl_map_get_range_stride_info, Mon Apr 16 15:53:49 2018 +0200), a valid shift and stride is always computed (0 and 1 in the trivial case), so these results might as well be stored even in the trivial case. This allows some special casing to be removed. Signed-off-by: Sven Verdoolaege --- gpu_array_tile.h | 7 +++---- gpu_group.c | 28 +++++++--------------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/gpu_array_tile.h b/gpu_array_tile.h index 53b8e3d..d7fcab8 100644 --- a/gpu_array_tile.h +++ b/gpu_array_tile.h @@ -5,10 +5,9 @@ #include #include -/* The fields stride and shift only contain valid information - * if shift != NULL. - * If so, they express that current index is such that if you add shift, - * then the result is always a multiple of stride. +/* The current index is such that if you add "shift", + * then the result is always a multiple of "stride", + * where "stride" may be equal to 1. * Let D represent the initial tile->depth dimensions of the computed schedule. * The spaces of "lb" and "shift" are of the form * diff --git a/gpu_group.c b/gpu_group.c index 22f8951..1c43707 100644 --- a/gpu_group.c +++ b/gpu_group.c @@ -126,7 +126,8 @@ int gpu_array_ref_group_requires_unroll(struct gpu_array_ref_group *group) * * If so, record the information in bound->stride and bound->shift and * return isl_bool_true. - * Otherwise, set bound->stride to NULL and return isl_bool_false. + * Otherwise, set bound->stride to 1 (and bound->shift to 0) and + * return isl_bool_false. * * Note that the stride info returned by isl_map_get_range_stride_info * is of the form @@ -140,24 +141,15 @@ static isl_bool set_stride(struct gpu_array_bound *bound, { isl_map *map; isl_stride_info *si; - isl_val *stride; isl_bool has_stride; map = isl_map_from_basic_map(bounds); si = isl_map_get_range_stride_info(map, 0); isl_map_free(map); - bound->stride = NULL; - - stride = isl_stride_info_get_stride(si); - has_stride = isl_val_gt_si(stride, 1); - - if (has_stride >= 0 && has_stride) { - bound->stride = stride; - bound->shift = isl_aff_neg(isl_stride_info_get_offset(si)); - } else { - isl_val_free(stride); - } + bound->stride = isl_stride_info_get_stride(si); + bound->shift = isl_aff_neg(isl_stride_info_get_offset(si)); + has_stride = isl_val_gt_si(bound->stride, 1); isl_stride_info_free(si); return has_stride; @@ -1704,14 +1696,8 @@ static __isl_give isl_multi_aff *strided_tile( isl_val *stride_i; isl_aff *shift_i; - if (tile->bound[i].shift) { - stride_i = isl_val_copy(bound->stride); - shift_i = isl_aff_copy(bound->shift); - } else { - stride_i = isl_val_one(ctx); - shift_i = isl_aff_zero_on_domain( - isl_local_space_copy(ls)); - } + stride_i = isl_val_copy(bound->stride); + shift_i = isl_aff_copy(bound->shift); stride = isl_multi_val_set_val(stride, i, stride_i); shift = isl_multi_aff_set_aff(shift, i, shift_i); -- 2.11.4.GIT