Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ def ApplyShuffleVectorFMAOpsPatternsOp : Op<Transform_Dialect,
let assemblyFormat = "attr-dict";
}

def ApplyFlattenVectorTransferOpsPatternsOp : Op<Transform_Dialect,
Comment thread
adam-smnk marked this conversation as resolved.
Outdated
"apply_patterns.x86vector.flatten_vector_transfer_ops",
[DeclareOpInterfaceMethods<PatternDescriptorOpInterface>]> {
let description = [{
Comment thread
adam-smnk marked this conversation as resolved.
Outdated
Collect patterns to rewrite contiguous row-major vector.transfer_read or
vector.transfer_write operations to a 1D operation.
}];

let assemblyFormat = "attr-dict";
}


Comment thread
adam-smnk marked this conversation as resolved.
#endif // X86VECTOR_TRANSFORM_OPS

5 changes: 5 additions & 0 deletions mlir/include/mlir/Dialect/X86Vector/Transforms.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ void populateSinkVectorProducerOpsPatterns(RewritePatternSet &patterns);
// grouped with respect to odd/even packed index.
void populateShuffleVectorFMAOpsPatterns(RewritePatternSet &patterns);

// Rewrites contiguous row-major vector.transfer_read or vector.transfer_write
// operations by inserting a memref.collapse_shape on the source,
// transforming the operation to use a 1D source.
void populateFlattenVectorTransferOpsPatterns(RewritePatternSet &patterns);

//===----------------------------------------------------------------------===//
/// Helpers extracted from:
/// - clang/lib/Headers/avxintrin.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "mlir/Dialect/Transform/IR/TransformDialect.h"
#include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h"
#include "mlir/Dialect/X86Vector/Transforms.h"
#include "mlir/Dialect/X86Vector/X86VectorDialect.h"

Expand All @@ -21,6 +22,7 @@
using namespace mlir;
using namespace mlir::x86vector;
using namespace mlir::transform;
using namespace mlir::vector;
Comment thread
adam-smnk marked this conversation as resolved.
Outdated

void mlir::transform::ApplyVectorContractToFMAPatternsOp::populatePatterns(
RewritePatternSet &patterns) {
Expand All @@ -47,6 +49,11 @@ void mlir::transform::ApplyShuffleVectorFMAOpsPatternsOp::populatePatterns(
x86vector::populateShuffleVectorFMAOpsPatterns(patterns);
}

void mlir::transform::ApplyFlattenVectorTransferOpsPatternsOp::populatePatterns(
RewritePatternSet &patterns) {
vector::populateFlattenVectorTransferPatterns(patterns);
}

//===----------------------------------------------------------------------===//
// Transform op registration
//===----------------------------------------------------------------------===//
Expand Down