Skip to content

Commit

Permalink
[Torch Dialect] emit aten::warn (llvm#3003)
Browse files Browse the repository at this point in the history
* torch-mlir may not handle `aten.warn`. But it could be handled by
custom users' backend which involves torch-mlir.
  • Loading branch information
qingyunqu authored Mar 10, 2024
1 parent bd7f1ba commit a3fe130
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -13148,6 +13148,29 @@ def Torch_AtenJoinOp : Torch_Op<"aten.join", [
}];
}

def Torch_AtenWarnOp : Torch_Op<"aten.warn", [
AllowsTypeRefinement,
HasValueSemantics,
ReadOnly
]> {
let summary = "Generated op for `aten::warn : (str, int) -> ()`";
let arguments = (ins
Torch_StringType:$message,
Torch_IntType:$stacklevel
);
let results = (outs
);
let hasCustomAssemblyFormat = 1;
let extraClassDefinition = [{
ParseResult AtenWarnOp::parse(OpAsmParser &parser, OperationState &result) {
return parseDefaultTorchOp(parser, result, 2, 0);
}
void AtenWarnOp::print(OpAsmPrinter &printer) {
printDefaultTorchOp(printer, *this, 2, 0);
}
}];
}

def Torch_AtenFloatScalarOp : Torch_Op<"aten.Float.Scalar", [
AllowsTypeRefinement,
HasValueSemantics,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ def emit_with_mutating_variants(key, **kwargs):
emit("aten::str : (t) -> (str)")
emit("aten::format : (...) -> (str)")
emit("aten::join : (str, str[]) -> (str)")
emit("aten::warn : (str, int) -> ()")

# Type conversion ops.
emit("aten::Float.Scalar : (Scalar) -> (float)", has_folder=True)
Expand Down

0 comments on commit a3fe130

Please sign in to comment.