Here are three affine maps:
map1(d0) -> (((d0 floordiv 11) mod 2) * 44 + (d0 mod 11) * 2)
map2(d0) -> (((d0 floordiv 44) mod 2) * 172 + ((d0 floordiv 22) mod 2) * 86 + (d0 mod 22) * 2)
map3(d0) -> (((d0 floordiv 172) mod 2) * 680 + ((d0 floordiv 43) mod 4) * 170 + (d0 mod 43) * 2)
Values of d0
are in the range [0, 22)
When I do a composition of these maps, I get the following simplified map (after SimplifyAffineStructures
pass):
map3(map2(map1(d0))) -> (d0 * 8 + (d0 floordiv 11) * 256 + ((d0 * 4 + (d0 floordiv 11) * 128) floordiv 43) * 84 - (((d0 * 4 + (d0 floordiv 11) * 128) floordiv 43) floordiv 4) * 680)
The simplification process was wrong. If you try values of d0 = 0..22
, you will find different results. The un-simplified maps will output this:
[0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 680, 688, 696, 704, 712, 720, 728, 736, 744, 752, 760]
whereas the simplified one will output this:
[0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80]
This suggests that there is a bug in the affine simplification pass. Is there a way to disable these simplifications until a fix is found?