[ARITH] Introduce iterator (quasi)affine map detection.#6667
[ARITH] Introduce iterator (quasi)affine map detection.#6667tqchen merged 2 commits intoapache:mainfrom
Conversation
spectrometerHBH
left a comment
There was a problem hiding this comment.
Some quick comments
|
|
||
|
|
||
| def isplit(axis, factor): | ||
| """Fuse iterators""" |
| The input indices. | ||
|
|
||
| input_iters : Map[Var, Range] | ||
| The domain of each input iterators. |
There was a problem hiding this comment.
May be good to add Returns in comment here.
| Additional scale to the split. | ||
| """ | ||
|
|
||
| def __init__(self, min_value, max_value): |
There was a problem hiding this comment.
Incorrect arguments
| """ | ||
|
|
||
| def __init__(self, min_value, max_value): | ||
| self.__init_handle_by_constructor__(_ffi_api.IterMark, source, extent) |
There was a problem hiding this comment.
Inconsistent with function arguments
468db05 to
0260e33
Compare
The loop transformations (split, fuse) create bijective maps from a collection of source iterators to target iterators. DetectIterMap is a function that detects such bijective mappings from the lowered index expression. We choose the term quasi affine to be consistent with the terminology used by in polyhedral compilation. DetectIterMap can handle symbolic integers(in split/fuse) to some extent. The utility can be useful in detecting loop transformation patterns and data layout change patterns in TIR.
| * \brief Base class of all iter map expressions. | ||
| * | ||
| * An IterMapExpr is a special expression to store | ||
| * the result of IterMapDetection, it should not |
There was a problem hiding this comment.
Would be great to complete the comments
| } | ||
| }; | ||
|
|
||
| // Rewriter to rewrite oinformations in iter |
spectrometerHBH
left a comment
There was a problem hiding this comment.
Other parts LGTM
| results.push_back(rewriter.Rewrite(value)); | ||
| if (rewriter.unresolved_count() != 0) return Array<IterSumExpr>(); | ||
| } | ||
| if (!rewriter.CheckBijective(results)) return Array<IterSumExpr>(); |
There was a problem hiding this comment.
Currently, the Independence check seems to only check that all input marks are iterated. Is that sufficient to ensure independence?
There was a problem hiding this comment.
It also checks all the intermediate marks(including the input) are being covered without overlapping
There was a problem hiding this comment.
If the indices are y, x, x+1 and input_iters are y, x, will this be checked?
There was a problem hiding this comment.
yes, in this case, x and x+1 will contribute two Split entries to mark2split of x, (one contributed by x and another by x+1)
mark2split[x]= [ Split(x, extent), Split(x, extent)]
And it will results in an error because the two splits overlaps with each other
There was a problem hiding this comment.
The checks are via the TryNormalizeSplits function
|
Thanks @spectrometerHBH I addressed your comment and added more explaination about bijective check, I also added your example as a testcase |
spectrometerHBH
left a comment
There was a problem hiding this comment.
Thanks, @tqchen!
* [ARITH] Introduce iterator (quasi)affine map detection. The loop transformations (split, fuse) create bijective maps from a collection of source iterators to target iterators. DetectIterMap is a function that detects such bijective mappings from the lowered index expression. We choose the term quasi affine to be consistent with the terminology used by in polyhedral compilation. DetectIterMap can handle symbolic integers(in split/fuse) to some extent. The utility can be useful in detecting loop transformation patterns and data layout change patterns in TIR. * Update per feedback
* [ARITH] Introduce iterator (quasi)affine map detection. The loop transformations (split, fuse) create bijective maps from a collection of source iterators to target iterators. DetectIterMap is a function that detects such bijective mappings from the lowered index expression. We choose the term quasi affine to be consistent with the terminology used by in polyhedral compilation. DetectIterMap can handle symbolic integers(in split/fuse) to some extent. The utility can be useful in detecting loop transformation patterns and data layout change patterns in TIR. * Update per feedback
* [ARITH] Introduce iterator (quasi)affine map detection. The loop transformations (split, fuse) create bijective maps from a collection of source iterators to target iterators. DetectIterMap is a function that detects such bijective mappings from the lowered index expression. We choose the term quasi affine to be consistent with the terminology used by in polyhedral compilation. DetectIterMap can handle symbolic integers(in split/fuse) to some extent. The utility can be useful in detecting loop transformation patterns and data layout change patterns in TIR. * Update per feedback
* [ARITH] Introduce iterator (quasi)affine map detection. The loop transformations (split, fuse) create bijective maps from a collection of source iterators to target iterators. DetectIterMap is a function that detects such bijective mappings from the lowered index expression. We choose the term quasi affine to be consistent with the terminology used by in polyhedral compilation. DetectIterMap can handle symbolic integers(in split/fuse) to some extent. The utility can be useful in detecting loop transformation patterns and data layout change patterns in TIR. * Update per feedback
The loop transformations (split, fuse) create bijective
maps from a collection of source iterators to target iterators.
DetectIterMap is a function that detects such bijective mappings
from lowered index expressions.
We choose the term quasi affine to be consistent with the
terminology used in polyhedral compilation.
DetectIterMap can handle symbolic integers(in split/fuse) to some extent.
The utility can be useful in detecting loop transformation
patterns and data layout change patterns in TIR.