Skip to content

Commit

Permalink
[DAPHNE-daphne-eu#637] Missing type inference of eigen()
Browse files Browse the repository at this point in the history
This commit adds type inference to mlir::daphne::EigenOp

Closes daphne-eu#637
  • Loading branch information
corepointer committed Nov 6, 2023
1 parent b41fa58 commit e50c5e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/ir/daphneir/DaphneInferTypesOpInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ std::vector<Type> daphne::RandMatrixOp::inferTypes() {
return {daphne::MatrixType::get(getContext(), elTy)};
}

std::vector<Type> daphne::EigenOp::inferTypes() {
auto evMatType = getArg().getType().dyn_cast<daphne::MatrixType>();
return {evMatType.withSameElementType(), evMatType};
}

std::vector<Type> daphne::GroupJoinOp::inferTypes() {
daphne::FrameType lhsFt = getLhs().getType().dyn_cast<daphne::FrameType>();
daphne::FrameType rhsFt = getRhs().getType().dyn_cast<daphne::FrameType>();
Expand Down
3 changes: 2 additions & 1 deletion src/ir/daphneir/DaphneOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,8 @@ def Daphne_OrderOp : Daphne_Op<"order", [
// Matrix decompositions & co
// ****************************************************************************

def Daphne_EigenOp : Daphne_Op<"eigenCal", [TypeFromFirstArg, DeclareOpInterfaceMethods<InferShapeOpInterface>]> {
def Daphne_EigenOp : Daphne_Op<"eigenCal", [TypeFromFirstArg, DeclareOpInterfaceMethods<InferTypesOpInterface>,
DeclareOpInterfaceMethods<InferShapeOpInterface>]> {
let arguments = (ins MatrixOf<[FloatScalar]>:$arg);
let results = (outs MatrixOf<[FloatScalar]>:$eigenValues, MatrixOf<[FloatScalar]>:$eigenVectors);
}
Expand Down

0 comments on commit e50c5e7

Please sign in to comment.