Bump llvm-project to 5b2e7f50a6798fd9b9c79d9d62fdebcd9e78525b. (#260)

pull/259/head
Stella Laurenzo 2021-07-29 12:26:54 -07:00 committed by GitHub
parent dc305c5101
commit cd44a35177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 29 additions and 28 deletions

3
.gitignore vendored
View File

@ -3,7 +3,8 @@
.env .env
*.code-workspace *.code-workspace
build /build
/build_*
build-mlir build-mlir
install-mlir install-mlir
__pycache__ __pycache__

@ -1 +1 @@
Subproject commit 310c9496d80961188e8d8f8ad306cdf44bd7541f Subproject commit 5b2e7f50a6798fd9b9c79d9d62fdebcd9e78525b

View File

@ -33,7 +33,7 @@ FuncBuilder::createFunction(FuncBuilder::Inserter &inserter,
context, mlirStringRefCreate(name.data(), name.size())))); context, mlirStringRefCreate(name.data(), name.size()))));
MlirOperationState state = MlirOperationState state =
mlirOperationStateGet(toMlirStringRef("func"), location); mlirOperationStateGet(toMlirStringRef("builtin.func"), location);
mlirOperationStateAddAttributes(&state, funcAttrs.size(), funcAttrs.data()); mlirOperationStateAddAttributes(&state, funcAttrs.size(), funcAttrs.data());
{ {
// Don't access these once ownership transferred. // Don't access these once ownership transferred.

View File

@ -34,7 +34,7 @@ MlirOperation torch_mlir::importJitFunctionAsFuncOp(
MlirAttribute symNameAttr = mlirStringAttrGet( MlirAttribute symNameAttr = mlirStringAttrGet(
context, toMlirStringRef(function->qualname().qualifiedName())); context, toMlirStringRef(function->qualname().qualifiedName()));
MlirOperation func = createMlirOperation( MlirOperation func = createMlirOperation(
"func", loc, mlirRegionCreate(), "builtin.func", loc, mlirRegionCreate(),
toMlirNamedAttribute("type", mlirTypeAttrGet(functionType)), toMlirNamedAttribute("type", mlirTypeAttrGet(functionType)),
toMlirNamedAttribute("sym_name", symNameAttr)); toMlirNamedAttribute("sym_name", symNameAttr));
std::vector<MlirAttribute> argAttrDicts; std::vector<MlirAttribute> argAttrDicts;

View File

@ -8,9 +8,9 @@ import platform
_refjit = None _refjit = None
BACKEND_PASSES = ( BACKEND_PASSES = (
"func(convert-scf-to-std)", "builtin.func(convert-scf-to-std)",
"func(canonicalize)", "builtin.func(canonicalize)",
"func(tcf-shape-refinement)", "builtin.func(tcf-shape-refinement)",
) )

View File

@ -16,10 +16,10 @@ __all__ = [
] ]
FRONTEND_PASSES = ( FRONTEND_PASSES = (
"func(basicpy-type-inference)", "builtin.func(basicpy-type-inference)",
"func(convert-basicpy-to-std)", "builtin.func(convert-basicpy-to-std)",
"func(canonicalize)", "builtin.func(canonicalize)",
"func(convert-scf-to-std)", "builtin.func(convert-scf-to-std)",
) )
_ireert = None _ireert = None

View File

@ -15,12 +15,12 @@ __all__ = [
] ]
FRONTEND_PASSES = ( FRONTEND_PASSES = (
"func(npcomp-cpa-type-inference)", "builtin.func(npcomp-cpa-type-inference)",
"numpy-public-functions-to-tensor", "numpy-public-functions-to-tensor",
"func(convert-numpy-to-tcf)", "builtin.func(convert-numpy-to-tcf)",
"func(convert-scf-to-std)", "builtin.func(convert-scf-to-std)",
"func(canonicalize)", "builtin.func(canonicalize)",
"func(tcf-shape-refinement)", "builtin.func(tcf-shape-refinement)",
) )
# Re-export. # Re-export.

View File

@ -6,6 +6,7 @@
from typing import Optional, Tuple from typing import Optional, Tuple
from mlir import ir as _ir from mlir import ir as _ir
from mlir.dialects import builtin as builtin_ops
from npcomp import _cext from npcomp import _cext
__all__ = [ __all__ = [
@ -96,19 +97,18 @@ class ImportContext:
create_entry_block: bool) -> Tuple[_ir.Operation, _ir.Block]: create_entry_block: bool) -> Tuple[_ir.Operation, _ir.Block]:
"""Creates a |func| op. """Creates a |func| op.
TODO: This should really be in the MLIR API.
Returns: Returns:
(operation, entry_block) (operation, entry_block)
""" """
with self.context, self.loc: assert self.loc is not None
attrs = { # TODO: Fix upstream FuncOp constructor to not require an implicit
"type": _ir.TypeAttr.get(func_type), # context.
"sym_name": _ir.StringAttr.get(name), with self.context:
} func = builtin_ops.FuncOp(name, func_type, loc=self.loc, ip=self.ip)
op = _ir.Operation.create("func", regions=1, attributes=attrs, ip=self.ip) entry_block = None
body_region = op.regions[0] if create_entry_block:
entry_block = body_region.blocks.append(*func_type.inputs) entry_block = func.add_entry_block()
return op, entry_block return (func, entry_block)
def basicpy_ExecOp(self): def basicpy_ExecOp(self):
"""Creates a basicpy.exec op. """Creates a basicpy.exec op.

View File

@ -4,7 +4,7 @@
torch.class_type @c {} torch.class_type @c {}
%0 = torch.nn_module { %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() func @f()
} : !torch.nn.Module<"c"> } : !torch.nn.Module<"c">
@ -32,7 +32,7 @@ torch.class_type @c {
// ----- // -----
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() func @f()
} }