tvm_tirx.sym.subspace_divide

tvm_tirx.sym.subspace_divide#

tvm_tirx.sym.subspace_divide(bindings, input_iters, sub_iters, predicate=True, check_level=IterMapLevel.Surjective, analyzer=None, simplify_trivial_iterators=True)#

Detect if bindings can be written as [a_0*e_0 + b_0 + c_0, a_1*e_1 + b_1, ..., a_n*e_n + b_n]

where:

a = some-quasi-affine-iter-map(input_iters set_minus sub_iters)
b = some-quasi-affine-iter-map(sub_iters)
c is constant symbols
e is the extent of b

For example:

z*12 + y*3 + x + c = (z*4+y)*3 + x
bindings = [z*12 + y*3 + x + c]
input_iters = [z, y, x]
sub_iter = [x]
Then the result will be [a, b] where
a = [z*4 + y]
b = [x]
Parameters:
  • bindings (List[Expr]) – The input bindings

  • input_iters (Map[tvm_tirx.ir.Var, Range]) – The domain of input iterator, which is the basis of the whole space

  • sub_iters (Array[tvm_tirx.ir.Var]) – The subset of input_iters, which is the basis of the subspace

  • predicate (Expr) – The predicate constraints on the input iterators

  • check_level (Union[str, IterMapLevel]) – Checking level of iteration mapping

  • simplify_trivial_iterators (bool) – If true, iterators with extent of 1 will be replaced with a constant value.

  • analyzer (Optional[tvm_tirx.sym.Analyzer]) – The analyzer to use. When provided, its accumulated bindings and constraints are reused; otherwise a fresh analyzer is created.

Returns:

results (List[List[Expr]]) – The result list has length len(bindings) + 1.

  • [0, len(bindings)): The iter map matching result. The inner list is of length 2. The first expr is the basis of the quotient space. The second expr is the basis of the subspace.

  • len(bindings): the predicate of outer space and inner space.

  • Empty array if no match can be found.