Skip to content

Commit

Permalink
Remove deprecated operations, disable expand/collapse_shape tiling
Browse files Browse the repository at this point in the history
  • Loading branch information
hanchenye committed Feb 2, 2024
1 parent bdb391e commit be0721b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 386 deletions.
97 changes: 15 additions & 82 deletions include/scalehls/Dialect/HLS/TransformOps/HLSTransformOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ def HLSConvertExtractSliceToTensorInitOp : Op<Transform_Dialect,
"hls.convert_extract_slice_to_tensor_init",
[FunctionalStyleTransformOpTrait, TransformEachOpTrait,
TransformOpInterface, MemoryEffectsOpInterface]> {
let description = [{}];
let description = [{
Convert a target `extract_slice` op to a `tensor_init` op, localizing the
initial tensor. This transform must be applied on the `init` operand of an
linalg op. Meanwhile, the real producer of the `init` operand must be an
`tensor_init` op in the first place, otherwise a silenceable failure will be
emitted. This transform returns the handle of the new `tensor_init` op.
}];
let arguments = (ins
Transform_ConcreteOpType<"tensor.extract_slice">:$extract_slice);
let results = (outs
Expand All @@ -37,7 +43,14 @@ def HLSConvertExtractSliceToTensorInitOp : Op<Transform_Dialect,
def HLSDemoteExtractSliceOp : Op<Transform_Dialect, "hls.demote_extract_slice",
[FunctionalStyleTransformOpTrait, TransformEachOpTrait,
TransformOpInterface, MemoryEffectsOpInterface]> {
let description = [{}];
let description = [{
Demote an `extract_slice` op to as outer as possible loop level, potentially
increasing the resuability of the extracted tensor. The source of the target
`extract_slice` op must not be an iteration argument of a loop, otherwise a
silenceable failure will be emitted. This transform always returns the
handle of the target `extract_slice` op, no matter it has been demoted or
not.
}];
let arguments = (ins
Transform_ConcreteOpType<"tensor.extract_slice">:$extract_slice);
let results = (outs
Expand Down Expand Up @@ -99,84 +112,4 @@ def HLSConvertExtractSliceToStreamOp : Op<Transform_Dialect,
}];
}

// def HLSTileExpandShapeOp : Op<Transform_Dialect, "hls.tile_expand_shape",
// [FunctionalStyleTransformOpTrait, TransformEachOpTrait,
// TransformOpInterface, MemoryEffectsOpInterface]> {
// let description = [{}];
// let arguments = (ins
// Transform_ConcreteOpType<"tensor.expand_shape">:$expand_shape,
// DenseI64ArrayAttr:$tile_sizes);
// let results = (outs
// Transform_ConcreteOpType<"scf.for">:$outermost_loop,
// Transform_ConcreteOpType<"tensor.extract_slice">:$extract_slice,
// Transform_ConcreteOpType<"tensor.expand_shape">:$tiled_expand_shape,
// Transform_ConcreteOpType<"tensor.insert_slice">:$insert_slice);
// let assemblyFormat = [{
// $expand_shape attr-dict `:` functional-type(operands, results)
// }];
// let extraClassDeclaration = [{
// ::mlir::DiagnosedSilenceableFailure applyToOne(
// ::mlir::transform::TransformRewriter &rewriter,
// ::mlir::tensor::ExpandShapeOp expandShape,
// ::mlir::transform::ApplyToEachResultList &results,
// ::mlir::transform::TransformState &state);
// }];
// }

// def HLSTileCollapseShapeOp : Op<Transform_Dialect, "hls.tile_collapse_shape",
// [FunctionalStyleTransformOpTrait, TransformEachOpTrait,
// TransformOpInterface, MemoryEffectsOpInterface]> {
// let description = [{}];
// let arguments = (ins
// Transform_ConcreteOpType<"tensor.collapse_shape">:$collapse_shape,
// DenseI64ArrayAttr:$tile_sizes);
// let results = (outs
// Transform_ConcreteOpType<"scf.for">:$outermost_loop,
// Transform_ConcreteOpType<"tensor.extract_slice">:$extract_slice,
// Transform_ConcreteOpType<"tensor.collapse_shape">:$tiled_collapse_shape,
// Transform_ConcreteOpType<"tensor.insert_slice">:$insert_slice);
// let assemblyFormat = [{
// $collapse_shape attr-dict `:` functional-type(operands, results)
// }];
// let extraClassDeclaration = [{
// ::mlir::DiagnosedSilenceableFailure applyToOne(
// ::mlir::transform::TransformRewriter &rewriter,
// ::mlir::tensor::CollapseShapeOp collapseShape,
// ::mlir::transform::ApplyToEachResultList &results,
// ::mlir::transform::TransformState &state);
// }];
// }

def HLSFoldExpandShapeOp : Op<Transform_Dialect, "hls.fold_expand_shape",
[FunctionalStyleTransformOpTrait, TransformEachOpTrait,
TransformOpInterface, MemoryEffectsOpInterface]> {
let description = [{}];
let arguments = (ins
Transform_ConcreteOpType<"tensor.expand_shape">:$expand_shape);
let assemblyFormat = "$expand_shape attr-dict `:` type(operands)";
let extraClassDeclaration = [{
::mlir::DiagnosedSilenceableFailure applyToOne(
::mlir::transform::TransformRewriter &rewriter,
::mlir::tensor::ExpandShapeOp expandShape,
::mlir::transform::ApplyToEachResultList &results,
::mlir::transform::TransformState &state);
}];
}

def HLSFoldCollapseShapeOp : Op<Transform_Dialect, "hls.fold_collapse_shape",
[FunctionalStyleTransformOpTrait, TransformEachOpTrait,
TransformOpInterface, MemoryEffectsOpInterface]> {
let description = [{}];
let arguments = (ins
Transform_ConcreteOpType<"tensor.collapse_shape">:$collapse_shape);
let assemblyFormat = "$collapse_shape attr-dict `:` type(operands)";
let extraClassDeclaration = [{
::mlir::DiagnosedSilenceableFailure applyToOne(
::mlir::transform::TransformRewriter &rewriter,
::mlir::tensor::CollapseShapeOp collapseShape,
::mlir::transform::ApplyToEachResultList &results,
::mlir::transform::TransformState &state);
}];
}

#endif // SCALEHLS_DIALECT_HLS_TRANSFORMOPS_HLSTRANSFORMOPS_TD
Loading

0 comments on commit be0721b

Please sign in to comment.