[Mlir-commits] [mlir] 835cbfa - [mlir][python] Make a number of imports relative.

Stella Laurenzo llvmlistbot at llvm.org
Fri Aug 6 00:24:38 PDT 2021


Author: Stella Laurenzo
Date: 2021-08-06T07:23:37Z
New Revision: 835cbfa8cf6330e31498f751baae3df83eab076a

URL: https://github.com/llvm/llvm-project/commit/835cbfa8cf6330e31498f751baae3df83eab076a
DIFF: https://github.com/llvm/llvm-project/commit/835cbfa8cf6330e31498f751baae3df83eab076a.diff

LOG: [mlir][python] Make a number of imports relative.

Avoiding absolute imports allows the code to be relocatable (which is used for out of tree integrations).

Differential Revision: https://reviews.llvm.org/D107617

Added: 
    

Modified: 
    mlir/python/mlir/dialects/linalg/opdsl/lang/affine.py
    mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py
    mlir/python/mlir/dialects/linalg/opdsl/lang/config.py
    mlir/python/mlir/dialects/linalg/opdsl/lang/dsl.py
    mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py

Removed: 
    


################################################################################
diff  --git a/mlir/python/mlir/dialects/linalg/opdsl/lang/affine.py b/mlir/python/mlir/dialects/linalg/opdsl/lang/affine.py
index 6db3bcfcc5b2b..9c1bb33420329 100644
--- a/mlir/python/mlir/dialects/linalg/opdsl/lang/affine.py
+++ b/mlir/python/mlir/dialects/linalg/opdsl/lang/affine.py
@@ -53,7 +53,7 @@
 
 from typing import Callable, Dict, Optional, Tuple, Union
 
-from mlir import ir as _ir
+from ..... import ir as _ir
 
 __all__ = [
     "AffineBuildState",

diff  --git a/mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py b/mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py
index 66d7510b68abf..f7bfa81c0a2c9 100644
--- a/mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py
+++ b/mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py
@@ -11,8 +11,7 @@
 from typing import Any, Dict, List, Optional, Sequence, Set, Tuple
 from enum import Enum
 
-from mlir import ir as _ir
-
+from ..... import ir as _ir
 from .affine import *
 from .scalar_expr import *
 from .types import *

diff  --git a/mlir/python/mlir/dialects/linalg/opdsl/lang/config.py b/mlir/python/mlir/dialects/linalg/opdsl/lang/config.py
index f6d5248ea00fb..fec41decbb395 100644
--- a/mlir/python/mlir/dialects/linalg/opdsl/lang/config.py
+++ b/mlir/python/mlir/dialects/linalg/opdsl/lang/config.py
@@ -13,8 +13,7 @@
 
 from typing import Dict, Optional
 
-from mlir import ir as _ir
-
+from ..... import ir as _ir
 from .comprehension import *
 from .yaml_helper import *
 

diff  --git a/mlir/python/mlir/dialects/linalg/opdsl/lang/dsl.py b/mlir/python/mlir/dialects/linalg/opdsl/lang/dsl.py
index 1b42b57670448..047bde245b645 100644
--- a/mlir/python/mlir/dialects/linalg/opdsl/lang/dsl.py
+++ b/mlir/python/mlir/dialects/linalg/opdsl/lang/dsl.py
@@ -9,7 +9,7 @@
 import inspect
 import threading
 
-from mlir import ir
+from ..... import ir
 from .comprehension import *
 from .config import *
 from .emitter import *

diff  --git a/mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py b/mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py
index 4568298d1be88..ea2da7151beac 100644
--- a/mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py
+++ b/mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py
@@ -4,10 +4,10 @@
 
 from typing import Dict, Sequence
 
-from mlir.ir import *
-from mlir.dialects import linalg
-from mlir.dialects import std
-from mlir.dialects import math
+from .....ir import *
+from .... import linalg
+from .... import std
+from .... import math
 # TODO: resolve name collision for Linalg functionality that is injected inside
 # the _mlir.dialects.linalg directly via pybind.
 from ....._cext_loader import _cext


        


More information about the Mlir-commits mailing list