Skip to content

Commit 7f5e467

Browse files
maksleventalHardcode84
authored andcommitted
get new stuff
1 parent 0437a9e commit 7f5e467

File tree

2 files changed

+172
-65
lines changed

2 files changed

+172
-65
lines changed

mlir/include/mlir/Transforms/SCFVectorize.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,48 @@ class ParallelOp;
2222
} // namespace mlir
2323

2424
namespace mlir {
25+
26+
/// Loop vectorization info
2527
struct SCFVectorizeInfo {
28+
/// Loop dimension on which to vectorize.
2629
unsigned dim = 0;
30+
31+
/// Biggest vector width, in elements.
2732
unsigned factor = 0;
33+
34+
/// Number of ops, which will be vectorized.
2835
unsigned count = 0;
36+
37+
/// Can use masked vector ops for our of bounds memory accesses.
2938
bool masked = false;
3039
};
3140

41+
/// Collect vectorization statistics on specified `scf.parallel` dimension.
42+
/// Return `SCFVectorizeInfo` or `std::nullopt` if loop cannot be vectorized on
43+
/// specified dimension.
44+
///
45+
/// `vectorBitwidth` - maximum vector size, in bits.
3246
std::optional<SCFVectorizeInfo> getLoopVectorizeInfo(mlir::scf::ParallelOp loop,
3347
unsigned dim,
34-
unsigned vectorBitWidth);
48+
unsigned vectorBitwidth);
3549

50+
/// Vectorization params
3651
struct SCFVectorizeParams {
52+
/// Loop dimension on which to vectorize.
3753
unsigned dim = 0;
54+
55+
/// Desired vector length, in elements
3856
unsigned factor = 0;
57+
58+
/// Use masked vector ops for memory access outside loop bounds.
3959
bool masked = false;
4060
};
4161

62+
/// Vectorize loop on specified dimension with specified factor.
63+
///
64+
/// If `masked` is `true` and loop bound is not divisible by `factor`, instead
65+
/// of generating second loop to process remainig iterations, extend loop count
66+
/// and generate masked vector ops to handle out-of bounds memory accesses.
4267
mlir::LogicalResult vectorizeLoop(mlir::OpBuilder &builder,
4368
mlir::scf::ParallelOp loop,
4469
const SCFVectorizeParams &params);

0 commit comments

Comments
 (0)