Skip to content

Commit

Permalink
[Arc] Modify VectorizeOp to support AnyType (#7087)
Browse files Browse the repository at this point in the history
  • Loading branch information
elhewaty committed May 25, 2024
1 parent 139c97b commit 021c3c2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
5 changes: 2 additions & 3 deletions include/circt/Dialect/Arc/ArcOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,6 @@ def VectorizeOp : ArcOp<"vectorize", [
vectorized each list will only contain a single SSA value of either vector
type or an integer representing the concatenation of all original operands
of that vector.
Only integer types can be vectorized, no arrays or structs are allowed.

Example:

Expand Down Expand Up @@ -845,9 +844,9 @@ def VectorizeOp : ArcOp<"vectorize", [
}];

let arguments = (ins
VariadicOfVariadic<IntOr1DVectorOfInt, "inputOperandSegments">:$inputs,
VariadicOfVariadic<AnyType, "inputOperandSegments">:$inputs,
DenseI32ArrayAttr:$inputOperandSegments);
let results = (outs Variadic<IntOr1DVectorOfInt>:$results);
let results = (outs Variadic<AnyType>:$results);
let regions = (region SizedRegion<1>:$body);

let assemblyFormat = [{
Expand Down
9 changes: 0 additions & 9 deletions lib/Dialect/Arc/ArcOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,6 @@ LogicalResult VectorizeOp::verify() {
return emitOpError("input vector must have at least one element");
}

if (getInputs().front().size() > 1 &&
!isa<IntegerType>(getInputs().front().front().getType()))
return emitOpError("input vector element type must be a signless integer");

if (getResults().empty())
return emitOpError("must have at least one result");

Expand All @@ -368,11 +364,6 @@ LogicalResult VectorizeOp::verify() {
if (getResults().size() != getInputs().front().size())
return emitOpError("number results must match input vector size");

if (getResults().size() > 1 &&
!isa<IntegerType>(getResults().front().getType()))
return emitError(
"may only return a vector type if boundary is already vectorized");

return success();
}

Expand Down
24 changes: 0 additions & 24 deletions test/Dialect/Arc/basic-errors.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -402,30 +402,6 @@ hw.module @only_one_block_allowed(in %in0: i1, in %in1: i1, in %in2: i1, in %in3

// -----

hw.module @invalid_input_type(in %in0: vector<2xi1>, in %in1: vector<2xi1>, in %in2: vector<2xi1>, in %in3: vector<2xi1>, out out0: i1, out out1: i1) {
// expected-error @below {{input vector element type must be a signless integer}}
%0:2 = arc.vectorize (%in0, %in1), (%in2, %in3) : (vector<2xi1>, vector<2xi1>, vector<2xi1>, vector<2xi1>) -> (i1, i1) {
^bb0(%arg0: vector<2xi1>, %arg1: vector<2xi1>):
%1 = vector.extract %arg0[0] : i1 from vector<2xi1>
arc.vectorize.return %1 : i1
}
hw.output %0#0, %0#1 : i1, i1
}

// -----

hw.module @invalid_result_type(in %in0: i1, in %in1: i1, in %in2: i1, in %in3: i1, out out0: vector<2xi1>, out out1: vector<2xi1>) {
// expected-error @below {{may only return a vector type if boundary is already vectorized}}
%0:2 = arc.vectorize (%in0, %in1), (%in2, %in3) : (i1, i1, i1, i1) -> (vector<2xi1>, vector<2xi1>) {
^bb0(%arg0: i1, %arg1: i1):
%cst = arith.constant dense<0> : vector<2xi1>
arc.vectorize.return %cst : vector<2xi1>
}
hw.output %0#0, %0#1 : vector<2xi1>, vector<2xi1>
}

// -----

hw.module @input_operand_list_not_empty(out out0: i1, out out1: i1) {
// expected-error @below {{there has to be at least one input vector}}
%0:2 = arc.vectorize : () -> (i1, i1) {
Expand Down

0 comments on commit 021c3c2

Please sign in to comment.