mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-11 08:48:12 +00:00
ScheduleOptimizer: Do not tile bands with just one dimension
llvm-svn: 146149
This commit is contained in:
parent
dd3e9ccd04
commit
b6033396fd
@ -200,27 +200,34 @@ static isl_basic_map *getTileMap(isl_ctx *ctx, int scheduleDimensions,
|
||||
|
||||
// getScheduleForBand - Get the schedule for this band.
|
||||
//
|
||||
// In case tiling is enabled, the schedule of the band is tiled.
|
||||
isl_union_map *getScheduleForBand(isl_band *Band) {
|
||||
// Polly applies transformations like tiling on top of the isl calculated value.
|
||||
// This can influence the number of scheduling dimension. The number of
|
||||
// schedule dimensions is returned in the parameter 'Dimension'.
|
||||
isl_union_map *getScheduleForBand(isl_band *Band, int *Dimensions) {
|
||||
isl_union_map *PartialSchedule;
|
||||
int Dimensions;
|
||||
isl_ctx *ctx;
|
||||
isl_space *Space;
|
||||
isl_basic_map *TileMap;
|
||||
isl_union_map *TileUMap;
|
||||
|
||||
PartialSchedule = isl_band_get_partial_schedule(Band);
|
||||
*Dimensions = isl_band_n_member(Band);
|
||||
|
||||
if (DisableTiling)
|
||||
return PartialSchedule;
|
||||
|
||||
// It does not make any sense to tile a band with just one dimension.
|
||||
if (*Dimensions == 1)
|
||||
return PartialSchedule;
|
||||
|
||||
ctx = isl_union_map_get_ctx(PartialSchedule);
|
||||
Space = isl_union_map_get_space(PartialSchedule);
|
||||
Dimensions = isl_band_n_member(Band);
|
||||
|
||||
TileMap = getTileMap(ctx, Dimensions, Space);
|
||||
TileMap = getTileMap(ctx, *Dimensions, Space);
|
||||
TileUMap = isl_union_map_from_map(isl_map_from_basic_map(TileMap));
|
||||
TileUMap = isl_union_map_align_params(TileUMap, Space);
|
||||
*Dimensions = 2 * *Dimensions;
|
||||
|
||||
return isl_union_map_apply_range(PartialSchedule, TileUMap);
|
||||
}
|
||||
|
||||
@ -348,8 +355,7 @@ static isl_union_map *getScheduleForBandList(isl_band_list *BandList) {
|
||||
isl_space *Space;
|
||||
|
||||
Band = isl_band_list_get_band(BandList, i);
|
||||
PartialSchedule = getScheduleForBand(Band);
|
||||
ScheduleDimensions = isl_band_n_member(Band);
|
||||
PartialSchedule = getScheduleForBand(Band, &ScheduleDimensions);
|
||||
Space = isl_union_map_get_space(PartialSchedule);
|
||||
|
||||
if (isl_band_has_children(Band)) {
|
||||
@ -367,8 +373,7 @@ static isl_union_map *getScheduleForBandList(isl_band_list *BandList) {
|
||||
isl_map *TileMap;
|
||||
isl_union_map *TileUMap;
|
||||
|
||||
TileMap = getPrevectorMap(ctx, ScheduleDimensions + i,
|
||||
ScheduleDimensions * 2);
|
||||
TileMap = getPrevectorMap(ctx, i, ScheduleDimensions);
|
||||
TileUMap = isl_union_map_from_map(TileMap);
|
||||
TileUMap = isl_union_map_align_params(TileUMap,
|
||||
isl_space_copy(Space));
|
||||
|
@ -30,21 +30,15 @@ bb2: ; preds = %bb2, %.lr.ph
|
||||
}
|
||||
|
||||
; CHECK: if (p_0 >= 1) {
|
||||
; CHECK: for (c1=0;c1<=p_0-1;c1+=32) {
|
||||
; CHECK: for (c2=c1;c2<=min(c1+31,p_0-1);c2++) {
|
||||
; CHECK: Stmt_bb2(c2);
|
||||
; CHECK: }
|
||||
; CHECK: for (c1=0;c1<=p_0-1;c1++) {
|
||||
; CHECK: Stmt_bb2(c1);
|
||||
; CHECK: }
|
||||
; CHECK: }
|
||||
|
||||
; VECTOR: if (p_0 >= 1) {
|
||||
; VECTOR: for (c1=0;c1<=p_0-1;c1+=32) {
|
||||
; VECTOR: for (c2=-4*floord(-c1,4);c2<=min(c1+31,p_0-1);c2+=4) {
|
||||
; VECTOR: for (c3=c2;c3<=min(c2+3,p_0-1);c3++) {
|
||||
; VECTOR: Stmt_bb2(c3);
|
||||
; VECTOR: }
|
||||
; VECTOR: for (c1=0;c1<=p_0-1;c1+=4) {
|
||||
; VECTOR: for (c2=c1;c2<=min(c1+3,p_0-1);c2++) {
|
||||
; VECTOR: Stmt_bb2(c2);
|
||||
; VECTOR: }
|
||||
; VECTOR: }
|
||||
; VECTOR: }
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user