heterocl.tvm.schedule

class _Stage(handle)[source]

A Stage represents schedule for one operation.

These scheduling functions can be accessed by the Stage generated by HeteroCL APIs

compute_at(parent, scope)[source]

Attach the stage at parent’s scope

Parameters
  • parent (_Stage) – The parent stage

  • scope (IterVar) – The loop scope t be attached to.

fuse(*args)[source]

Fuse multiple consecutive iteration variables into a single iteration variable.

fused = fuse(…fuse(fuse(args[0], args[1]), args[2]),…, args[-1]) The order is from outer to inner.

Parameters

args (list of IterVars) – Itervars that proceeds each other

Returns

fused – The fused variable of iteration.

Return type

IterVar

parallel(var)[source]

Parallelize the iteration.

Parameters

var (IterVar) – The iteration to be parallelized.

pipeline(var, initiation_interval=1)[source]

Pipeline the iteration.

Parameters
  • var (IterVar) – The iteration to be pipelined.

  • initiation_interval (Expr) – The initiation interval in pipeline schedule. Default value is 1.

reorder(*args)[source]

reorder the arguments in the specified order.

Parameters

args (list of IterVar) – The order to be ordered

split(parent, factor=None, nparts=None, mode='transform')[source]

Split the stage either by factor providing outer scope, or both

Parameters
  • parent (IterVar) – The parent iter var.

  • factor (Expr, optional) – The splitting factor

  • nparts (Expr, optional) – The number of outer parts.

  • mode (str, "transform" or "annotate") – “transform” mode changes the IR structure, “annotate” mode adds attributes.

Returns

  • outer (IterVar) – The outer variable of iteration.

  • inner (IterVar) – The inner variable of iteration.

tile(x_parent, y_parent, x_factor, y_factor)[source]

Perform tiling on two dimensions

The final loop order from outmost to inner most are [x_outer, y_outer, x_inner, y_inner]

Parameters
  • x_parent (IterVar) – The original x dimension

  • y_parent (IterVar) – The original y dimension

  • x_factor (Expr) – The stride factor on x axis

  • y_factor (Expr) – The stride factor on y axis

Returns

  • x_outer (IterVar) – Outer axis of x dimension

  • y_outer (IterVar) – Outer axis of y dimension

  • x_inner (IterVar) – Inner axis of x dimension

  • p_y_inner (IterVar) – Inner axis of y dimension

unroll(var, factor=0)[source]

Unroll the iteration.

Parameters
  • var (IterVar) – The iteration to be unrolled.

  • factor (Expr) – The unroll factor. Default value 0 means full unroll.