Move existing npcomp.compiler -> npcomp.compiler.numpy.

* Makes room for the pytorch compiler.
* Some common things can be hoisted from the numpy side but some more consolidation needs to happen first.
pull/113/head
Stella Laurenzo 2020-11-10 18:03:25 -08:00
parent 1c7c362e29
commit d1488c8572
38 changed files with 36 additions and 34 deletions

View File

@ -9,7 +9,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E copy
# TODO: Make the runtime library work for windows.
${CMAKE_BINARY_DIR}/lib/libNPCOMPCompilerRuntimeShlib.so
${CMAKE_CURRENT_BINARY_DIR}/npcomp/compiler/backend/refjit_resources/libNPCOMPCompilerRuntimeShlib.so
${CMAKE_CURRENT_BINARY_DIR}/npcomp/compiler/_refjit_resources/libNPCOMPCompilerRuntimeShlib.so
)
add_dependencies(NPCOMPPythonResources
NPCOMPCompilerRuntimeShlib

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
from _npcomp import mlir
from npcomp.compiler import logging
from npcomp.compiler.utils import logging
__all__ = [
"is_enabled",

View File

@ -5,7 +5,7 @@
import os
from _npcomp import mlir
from npcomp.compiler import logging
from npcomp.compiler.utils import logging
__all__ = [
"is_enabled",
@ -48,7 +48,9 @@ def is_enabled() -> bool:
def get_runtime_libs():
resources_dir = os.path.join(os.path.dirname(__file__), "refjit_resources")
# The _refjit_resources directory is at the npcomp.compiler level.
resources_dir = os.path.join(os.path.dirname(__file__), "..", "..",
"_refjit_resources")
return [os.path.join(resources_dir, "libNPCOMPCompilerRuntimeShlib.so")]

View File

@ -10,7 +10,7 @@ import numpy as np
from _npcomp.mlir import ir
from ... import logging
from ....utils import logging
from ...interfaces import *
from ...partial_eval_base import *

View File

@ -8,7 +8,7 @@ from typing import Union
from _npcomp.mlir import ir
from ... import logging
from ....utils import logging
from ...interfaces import *
__all__ = [

View File

@ -14,7 +14,7 @@ from _npcomp.mlir import ir
from _npcomp.mlir.dialect import ScfDialectHelper
from npcomp.dialect import Numpy
from . import logging
from ..utils import logging
from .importer import *
from .interfaces import *
from .name_resolver_base import *

View File

@ -10,7 +10,7 @@ import traceback
from _npcomp.mlir import ir
from . import logging
from ..utils import logging
from .interfaces import *
__all__ = [

View File

@ -7,7 +7,7 @@ from typing import Any, Callable, Union
from .interfaces import *
from .py_value_utils import *
from . import logging
from ..utils import logging
__all__ = [
"MappedPartialEvalHook",

View File

@ -6,7 +6,7 @@
import ast
import functools
from . import logging
from ..utils import logging
from .frontend import *
from .interfaces import *
from .partial_eval_base import *

View File

@ -2,11 +2,11 @@
import numpy as np
from npcomp.compiler.backend import refjit
from npcomp.compiler.frontend import *
from npcomp.compiler import logging
from npcomp.compiler import test_config
from npcomp.compiler.target import *
from npcomp.compiler.numpy.backend import refjit
from npcomp.compiler.numpy.frontend import *
from npcomp.compiler.numpy import test_config
from npcomp.compiler.numpy.target import *
from npcomp.compiler.utils import logging
# TODO: This should all exist in a high level API somewhere.
from _npcomp import mlir

View File

@ -1,7 +1,7 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
import numpy as np
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,6 +1,6 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,6 +1,6 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,6 +1,6 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,6 +1,6 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -2,8 +2,8 @@
# Subset of constant tests which verify against a GenericTarget32.
from npcomp.compiler import test_config
from npcomp.compiler.target import *
from npcomp.compiler.numpy import test_config
from npcomp.compiler.numpy.target import *
import_global = test_config.create_import_dump_decorator(
target_factory=GenericTarget32)

View File

@ -1,6 +1,6 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file -npcomp-cpa-type-inference | FileCheck %s --dump-input=fail
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,8 +1,8 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file -npcomp-cpa-type-inference -canonicalize | FileCheck %s --dump-input=fail
import numpy as np
from npcomp.compiler import test_config
from npcomp.compiler.frontend import EmittedError
from npcomp.compiler.numpy import test_config
from npcomp.compiler.numpy.frontend import EmittedError
import_global = test_config.create_import_dump_decorator()

View File

@ -2,7 +2,7 @@
import collections
import math
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,6 +1,6 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file -basicpy-type-inference -convert-basicpy-to-std | FileCheck %s --dump-input=fail
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,7 +1,7 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
"""Module docstring."""
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,6 +1,6 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,7 +1,7 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
import math
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,6 +1,6 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file -basicpy-type-inference | FileCheck %s --dump-input=fail
from npcomp.compiler import test_config
from npcomp.compiler.numpy import test_config
import_global = test_config.create_import_dump_decorator()

View File

@ -1,8 +1,8 @@
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
import numpy as np
from npcomp.compiler import test_config
from npcomp.compiler.frontend import EmittedError
from npcomp.compiler.numpy import test_config
from npcomp.compiler.numpy.frontend import EmittedError
import_global = test_config.create_import_dump_decorator()

View File

@ -23,7 +23,7 @@ def run_doctest(mod):
TEST_MODULES = (
"npcomp.compiler.py_value_utils",
"npcomp.compiler.numpy.py_value_utils",
"npcomp.dialect.Basicpy",
"npcomp.dialect.Numpy",
"npcomp.tracing.context",