The `vector.mask` is a `MaskingOpInterface` operation that predicates the
execution of another operation. It takes an `i1` vector mask and an
optional passthru vector as arguments.
- A `vector.yield`-terminated region encloses the operation to be masked.
- Values used within the region are captured from above. Only one *maskable*
- operation can be masked with a `vector.mask` operation at a time. An
- operation is *maskable* if it implements the `MaskableOpInterface`.
+
+ A implicitly `vector.yield`-terminated region encloses the operation to be
+ masked. Values used within the region are captured from above. Only one
+ *maskable* operation can be masked with a `vector.mask` operation at a time.
+ An operation is *maskable* if it implements the `MaskableOpInterface`. The
+ terminator yields all results of the maskable operation to the result of
+ this operation.
The vector mask argument holds a bit for each vector lane and determines
which vector lanes should execute the maskable operation and which ones
```
vector.mask %mask { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, memref<?xf32> } : vector<16xi1>
```
+
+ ```
+ vector.mask %mask { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, tensor<?xf32> } : vector<16xi1> -> tensor<?xf32>
+ ```
}];
// TODO: Support multiple results and passthru values.
let arguments = (ins VectorOf<[I1]>:$mask,
Optional<AnyType>:$passthru);
- let results = (outs Optional<AnyType>:$results);
+ let results = (outs Variadic<AnyType>:$results);
let regions = (region SizedRegion<1>:$maskRegion);
let skipDefaultBuilders = 1;
OpBuilder<(ins "Value":$mask,
CArg<"function_ref<void(OpBuilder &, Location)>",
"buildTerminatedBody">:$maskRegion)>,
- OpBuilder<(ins "Type":$resultType, "Value":$mask,
+ OpBuilder<(ins "TypeRange":$resultTypes, "Value":$mask,
CArg<"function_ref<void(OpBuilder &, Location)>",
"buildTerminatedBody">:$maskRegion)>,
- OpBuilder<(ins "Type":$resultType, "Value":$mask,
+ OpBuilder<(ins "TypeRange":$resultTypes, "Value":$mask,
"Value":$passthru,
CArg<"function_ref<void(OpBuilder &, Location)>",
"buildTerminatedBody">:$maskRegion)>
}
void MaskOp::build(
- OpBuilder &builder, OperationState &result, Type resultType, Value mask,
- function_ref<void(OpBuilder &, Location)> maskRegionBuilder) {
- build(builder, result, resultType, mask, /*passthru=*/Value(),
+ OpBuilder &builder, OperationState &result, TypeRange resultTypes,
+ Value mask, function_ref<void(OpBuilder &, Location)> maskRegionBuilder) {
+ build(builder, result, resultTypes, mask, /*passthru=*/Value(),
maskRegionBuilder);
}
void MaskOp::build(
- OpBuilder &builder, OperationState &result, Type resultType, Value mask,
- Value passthru,
+ OpBuilder &builder, OperationState &result, TypeRange resultTypes,
+ Value mask, Value passthru,
function_ref<void(OpBuilder &, Location)> maskRegionBuilder) {
build(builder, result, mask, maskRegionBuilder);
if (passthru)
result.addOperands(passthru);
- result.addTypes(resultType);
+ result.addTypes(resultTypes);
}
ParseResult MaskOp::parse(OpAsmParser &parser, OperationState &result) {