mirror of https://github.com/llvm/torch-mlir
Bump llvm-project to 5b2e7f50a6798fd9b9c79d9d62fdebcd9e78525b. (#260)
parent
dc305c5101
commit
cd44a35177
|
@ -3,7 +3,8 @@
|
|||
.env
|
||||
*.code-workspace
|
||||
|
||||
build
|
||||
/build
|
||||
/build_*
|
||||
build-mlir
|
||||
install-mlir
|
||||
__pycache__
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 310c9496d80961188e8d8f8ad306cdf44bd7541f
|
||||
Subproject commit 5b2e7f50a6798fd9b9c79d9d62fdebcd9e78525b
|
|
@ -33,7 +33,7 @@ FuncBuilder::createFunction(FuncBuilder::Inserter &inserter,
|
|||
context, mlirStringRefCreate(name.data(), name.size()))));
|
||||
|
||||
MlirOperationState state =
|
||||
mlirOperationStateGet(toMlirStringRef("func"), location);
|
||||
mlirOperationStateGet(toMlirStringRef("builtin.func"), location);
|
||||
mlirOperationStateAddAttributes(&state, funcAttrs.size(), funcAttrs.data());
|
||||
{
|
||||
// Don't access these once ownership transferred.
|
||||
|
|
|
@ -34,7 +34,7 @@ MlirOperation torch_mlir::importJitFunctionAsFuncOp(
|
|||
MlirAttribute symNameAttr = mlirStringAttrGet(
|
||||
context, toMlirStringRef(function->qualname().qualifiedName()));
|
||||
MlirOperation func = createMlirOperation(
|
||||
"func", loc, mlirRegionCreate(),
|
||||
"builtin.func", loc, mlirRegionCreate(),
|
||||
toMlirNamedAttribute("type", mlirTypeAttrGet(functionType)),
|
||||
toMlirNamedAttribute("sym_name", symNameAttr));
|
||||
std::vector<MlirAttribute> argAttrDicts;
|
||||
|
|
|
@ -8,9 +8,9 @@ import platform
|
|||
_refjit = None
|
||||
|
||||
BACKEND_PASSES = (
|
||||
"func(convert-scf-to-std)",
|
||||
"func(canonicalize)",
|
||||
"func(tcf-shape-refinement)",
|
||||
"builtin.func(convert-scf-to-std)",
|
||||
"builtin.func(canonicalize)",
|
||||
"builtin.func(tcf-shape-refinement)",
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ __all__ = [
|
|||
]
|
||||
|
||||
FRONTEND_PASSES = (
|
||||
"func(basicpy-type-inference)",
|
||||
"func(convert-basicpy-to-std)",
|
||||
"func(canonicalize)",
|
||||
"func(convert-scf-to-std)",
|
||||
"builtin.func(basicpy-type-inference)",
|
||||
"builtin.func(convert-basicpy-to-std)",
|
||||
"builtin.func(canonicalize)",
|
||||
"builtin.func(convert-scf-to-std)",
|
||||
)
|
||||
|
||||
_ireert = None
|
||||
|
|
|
@ -15,12 +15,12 @@ __all__ = [
|
|||
]
|
||||
|
||||
FRONTEND_PASSES = (
|
||||
"func(npcomp-cpa-type-inference)",
|
||||
"builtin.func(npcomp-cpa-type-inference)",
|
||||
"numpy-public-functions-to-tensor",
|
||||
"func(convert-numpy-to-tcf)",
|
||||
"func(convert-scf-to-std)",
|
||||
"func(canonicalize)",
|
||||
"func(tcf-shape-refinement)",
|
||||
"builtin.func(convert-numpy-to-tcf)",
|
||||
"builtin.func(convert-scf-to-std)",
|
||||
"builtin.func(canonicalize)",
|
||||
"builtin.func(tcf-shape-refinement)",
|
||||
)
|
||||
|
||||
# Re-export.
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
from typing import Optional, Tuple
|
||||
|
||||
from mlir import ir as _ir
|
||||
from mlir.dialects import builtin as builtin_ops
|
||||
from npcomp import _cext
|
||||
|
||||
__all__ = [
|
||||
|
@ -96,19 +97,18 @@ class ImportContext:
|
|||
create_entry_block: bool) -> Tuple[_ir.Operation, _ir.Block]:
|
||||
"""Creates a |func| op.
|
||||
|
||||
TODO: This should really be in the MLIR API.
|
||||
Returns:
|
||||
(operation, entry_block)
|
||||
"""
|
||||
with self.context, self.loc:
|
||||
attrs = {
|
||||
"type": _ir.TypeAttr.get(func_type),
|
||||
"sym_name": _ir.StringAttr.get(name),
|
||||
}
|
||||
op = _ir.Operation.create("func", regions=1, attributes=attrs, ip=self.ip)
|
||||
body_region = op.regions[0]
|
||||
entry_block = body_region.blocks.append(*func_type.inputs)
|
||||
return op, entry_block
|
||||
assert self.loc is not None
|
||||
# TODO: Fix upstream FuncOp constructor to not require an implicit
|
||||
# context.
|
||||
with self.context:
|
||||
func = builtin_ops.FuncOp(name, func_type, loc=self.loc, ip=self.ip)
|
||||
entry_block = None
|
||||
if create_entry_block:
|
||||
entry_block = func.add_entry_block()
|
||||
return (func, entry_block)
|
||||
|
||||
def basicpy_ExecOp(self):
|
||||
"""Creates a basicpy.exec op.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
torch.class_type @c {}
|
||||
%0 = torch.nn_module {
|
||||
// expected-error @+1 {{'func' op is not allowed inside 'torch.nn_module'}}
|
||||
// expected-error @+1 {{'builtin.func' op is not allowed inside 'torch.nn_module'}}
|
||||
func @f()
|
||||
} : !torch.nn.Module<"c">
|
||||
|
||||
|
@ -32,7 +32,7 @@ torch.class_type @c {
|
|||
// -----
|
||||
|
||||
torch.class_type @c {
|
||||
// expected-error @+1 {{'func' op is not allowed inside `torch.class_type`}}
|
||||
// expected-error @+1 {{'builtin.func' op is not allowed inside `torch.class_type`}}
|
||||
func @f()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue