mirror of https://github.com/llvm/torch-mlir
Rename jit_ir python package.
parent
61f5ff2ee4
commit
2ed2ca9817
|
@ -42,6 +42,6 @@ if [ ! -z ${TORCH_MLIR_EXT_MODULES} ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PYTHONPATH="${pypath}" python \
|
PYTHONPATH="${pypath}" python \
|
||||||
-m torch_mlir.dialects.torch.importer.jit_ir.build_tools.abstract_interp_lib_gen \
|
-m torch_mlir.jit_ir_importer.build_tools.abstract_interp_lib_gen \
|
||||||
--pytorch_op_extensions=${ext_module:-""} \
|
--pytorch_op_extensions=${ext_module:-""} \
|
||||||
--torch_transforms_cpp_dir="${torch_transforms_cpp_dir}"
|
--torch_transforms_cpp_dir="${torch_transforms_cpp_dir}"
|
||||||
|
|
|
@ -43,7 +43,7 @@ fi
|
||||||
|
|
||||||
set +u
|
set +u
|
||||||
PYTHONPATH="${PYTHONPATH}:${pypath}" python \
|
PYTHONPATH="${PYTHONPATH}:${pypath}" python \
|
||||||
-m torch_mlir.dialects.torch.importer.jit_ir.build_tools.torch_ods_gen \
|
-m torch_mlir.jit_ir_importer.build_tools.torch_ods_gen \
|
||||||
--torch_ir_include_dir="${torch_ir_include_dir}" \
|
--torch_ir_include_dir="${torch_ir_include_dir}" \
|
||||||
--pytorch_op_extensions="${ext_module}" \
|
--pytorch_op_extensions="${ext_module}" \
|
||||||
--debug_registry_dump="${torch_ir_include_dir}/JITOperatorRegistryDump.txt"
|
--debug_registry_dump="${torch_ir_include_dir}/JITOperatorRegistryDump.txt"
|
||||||
|
|
|
@ -17,7 +17,7 @@ The end-to-end test is important to check the correctness of the other steps.
|
||||||
|
|
||||||
### Step 2. Update ods
|
### Step 2. Update ods
|
||||||
|
|
||||||
Update [torch_ods_gen.py](https://github.com/llvm/torch-mlir/blob/main/projects/pt1/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/torch_ods_gen.py) with the new op and run [update_torch_ods.sh](https://github.com/llvm/torch-mlir/blob/main/build_tools/update_torch_ods.sh) to generate the ods. Running `update_torch_ods.sh` would dump all the operators with schema into `JITOperatorRegistryDump.txt`. It’s convenient to look for ops signatures and operands names in this file.
|
Update [torch_ods_gen.py](https://github.com/llvm/torch-mlir/blob/main/projects/pt1/python/torch_mlir/jit_ir_importer/build_tools/torch_ods_gen.py) with the new op and run [update_torch_ods.sh](https://github.com/llvm/torch-mlir/blob/main/build_tools/update_torch_ods.sh) to generate the ods. Running `update_torch_ods.sh` would dump all the operators with schema into `JITOperatorRegistryDump.txt`. It’s convenient to look for ops signatures and operands names in this file.
|
||||||
|
|
||||||
### Step 3. Propagate types
|
### Step 3. Propagate types
|
||||||
It’s essential to make sure the new op implements shape and dtype inference. See [abstract_interp_lib](https://github.com/llvm/torch-mlir/blob/main/docs/abstract_interp_lib.md) for information on adding shape and dtype inference.
|
It’s essential to make sure the new op implements shape and dtype inference. See [abstract_interp_lib](https://github.com/llvm/torch-mlir/blob/main/docs/abstract_interp_lib.md) for information on adding shape and dtype inference.
|
||||||
|
|
|
@ -26,7 +26,7 @@ The two main use cases are:
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
Functions are defined as TorchScript-able Python functions in
|
Functions are defined as TorchScript-able Python functions in
|
||||||
`python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/abstract_interp_lib_gen.py`.
|
`python/torch_mlir/jit_ir_importer/build_tools/abstract_interp_lib_gen.py`.
|
||||||
The signatures of the functions are systematically derived from Torch JIT
|
The signatures of the functions are systematically derived from Torch JIT
|
||||||
operator registry. Most shape functions are expected to reuse the upstream
|
operator registry. Most shape functions are expected to reuse the upstream
|
||||||
helper functions
|
helper functions
|
||||||
|
|
|
@ -87,7 +87,7 @@ following order:
|
||||||
|
|
||||||
1. Shape of input tensor. Use `-1` for dynamic dimensions
|
1. Shape of input tensor. Use `-1` for dynamic dimensions
|
||||||
2. Dtype of the input tensor
|
2. Dtype of the input tensor
|
||||||
3. Boolean representing whether the input tensor [has value semantics](https://github.com/llvm/torch-mlir/blob/ba17a4d6c09b4bbb4ef21b1d8d4a93cb056be109/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/class_annotator.h#L54-L67). This
|
3. Boolean representing whether the input tensor [has value semantics](https://github.com/llvm/torch-mlir/blob/ba17a4d6c09b4bbb4ef21b1d8d4a93cb056be109/python/torch_mlir/jit_ir_importer/csrc/class_annotator.h#L54-L67). This
|
||||||
will always be true for E2E tests, since the [Torch-MLIR backend contract](architecture.md#the-backend-contract) requires all tensors in the
|
will always be true for E2E tests, since the [Torch-MLIR backend contract](architecture.md#the-backend-contract) requires all tensors in the
|
||||||
IR to eventually have value semantics.
|
IR to eventually have value semantics.
|
||||||
|
|
||||||
|
|
|
@ -55,14 +55,14 @@ factored such that we can handle this with one core import path, which is
|
||||||
through the PyTorch
|
through the PyTorch
|
||||||
"[JIT IR](https://github.com/pytorch/pytorch/blob/78c8a0d75220bdd4955415b5f81509e005af4232/torch/csrc/jit/OVERVIEW.md)",
|
"[JIT IR](https://github.com/pytorch/pytorch/blob/78c8a0d75220bdd4955415b5f81509e005af4232/torch/csrc/jit/OVERVIEW.md)",
|
||||||
and lives in
|
and lives in
|
||||||
[torch-mlir/python/torch_mlir/dialects/torch/importer/jit_ir](https://github.com/llvm/torch-mlir/tree/e322f6a8784009b37aa354abfa9a40a80f30877d/python/torch_mlir/dialects/torch/importer/jit_ir).
|
[torch-mlir/python/torch_mlir/jit_ir_importer](https://github.com/llvm/torch-mlir/tree/e322f6a8784009b37aa354abfa9a40a80f30877d/python/torch_mlir/dialects/torch/importer/jit_ir).
|
||||||
The JIT IR is a highly principled IR that faithfully models a Python subset (+
|
The JIT IR is a highly principled IR that faithfully models a Python subset (+
|
||||||
tensors, the PyTorch op registry, and a few other things). All the other PyTorch
|
tensors, the PyTorch op registry, and a few other things). All the other PyTorch
|
||||||
program representations can eventually bottom-out on the JIT IR via some path
|
program representations can eventually bottom-out on the JIT IR via some path
|
||||||
provided by PyTorch. The `torch` dialect is almost entirely in 1:1
|
provided by PyTorch. The `torch` dialect is almost entirely in 1:1
|
||||||
correspondence with the JIT IR -- this allows the importer to be extremely small
|
correspondence with the JIT IR -- this allows the importer to be extremely small
|
||||||
(the core is
|
(the core is
|
||||||
[under 500 lines of code](https://github.com/llvm/torch-mlir/blob/e322f6a8784009b37aa354abfa9a40a80f30877d/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/node_importer.cpp#L1)).
|
[under 500 lines of code](https://github.com/llvm/torch-mlir/blob/e322f6a8784009b37aa354abfa9a40a80f30877d/python/torch_mlir/jit_ir_importer/csrc/node_importer.cpp#L1)).
|
||||||
|
|
||||||
### Ops
|
### Ops
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ See [TorchOps.td](https://github.com/llvm/torch-mlir/blob/114f48e96c578ee76a6f83
|
||||||
|
|
||||||
The ops in the `torch` dialect are almost entirely generated based on the
|
The ops in the `torch` dialect are almost entirely generated based on the
|
||||||
PyTorch JIT IR operator registry via the script
|
PyTorch JIT IR operator registry via the script
|
||||||
[torch_ods_gen.py](https://github.com/llvm/torch-mlir/blob/e322f6a8784009b37aa354abfa9a40a80f30877d/python/torch_mlir/dialects/torch/importer/jit_ir/build_tools/torch_ods_gen.py#L1) (invoked via [update_torch_ods.sh](https://github.com/llvm/torch-mlir/blob/main/build_tools/update_torch_ods.sh)).
|
[torch_ods_gen.py](https://github.com/llvm/torch-mlir/blob/e322f6a8784009b37aa354abfa9a40a80f30877d/python/torch_mlir/jit_ir_importer/build_tools/torch_ods_gen.py#L1) (invoked via [update_torch_ods.sh](https://github.com/llvm/torch-mlir/blob/main/build_tools/update_torch_ods.sh)).
|
||||||
This script queries the registry and generates MLIR
|
This script queries the registry and generates MLIR
|
||||||
[ODS](https://mlir.llvm.org/docs/OpDefinitions/) in
|
[ODS](https://mlir.llvm.org/docs/OpDefinitions/) in
|
||||||
[GeneratedTorchOps.td](https://github.com/llvm/torch-mlir/blob/e322f6a8784009b37aa354abfa9a40a80f30877d/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td#L1). We have a guide for [adding a new op end-to-end](https://github.com/llvm/torch-mlir/wiki/Torch-ops-E2E-implementation).
|
[GeneratedTorchOps.td](https://github.com/llvm/torch-mlir/blob/e322f6a8784009b37aa354abfa9a40a80f30877d/include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td#L1). We have a guide for [adding a new op end-to-end](https://github.com/llvm/torch-mlir/wiki/Torch-ops-E2E-implementation).
|
||||||
|
@ -195,7 +195,7 @@ values. When one `torch.jit.script`'s a `torch.nn.Module`, the result is
|
||||||
actually an `IValue` that represents the module, with a hierarchy of children
|
actually an `IValue` that represents the module, with a hierarchy of children
|
||||||
`IValue`'s. Strictly speaking, JIT IR `torch::jit::Graph`'s are only used to
|
`IValue`'s. Strictly speaking, JIT IR `torch::jit::Graph`'s are only used to
|
||||||
represent the bodies of methods on the modules. So in addition to importing the
|
represent the bodies of methods on the modules. So in addition to importing the
|
||||||
JIT IR, we also need to import the `IValue`'s. This happens inside [ivalue_importer.cpp](https://github.com/llvm/torch-mlir/blob/fde390c7669e29362b18388448ef2b188713383f/python/torch_mlir/dialects/torch/importer/jit_ir/csrc/ivalue_importer.cpp#L1).
|
JIT IR, we also need to import the `IValue`'s. This happens inside [ivalue_importer.cpp](https://github.com/llvm/torch-mlir/blob/fde390c7669e29362b18388448ef2b188713383f/python/torch_mlir/jit_ir_importer/csrc/ivalue_importer.cpp#L1).
|
||||||
|
|
||||||
Most of the IValue modeling can reuse `torch` dialect ops that already exist
|
Most of the IValue modeling can reuse `torch` dialect ops that already exist
|
||||||
otherwise, such as `torch.constant.int` to represent an int in the object graph.
|
otherwise, such as `torch.constant.int` to represent an int in the object graph.
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// This file is automatically generated. Please do not edit.
|
// This file is automatically generated. Please do not edit.
|
||||||
// Generated via:
|
// Generated via:
|
||||||
// ```
|
// ```
|
||||||
// python -m torch_mlir.dialects.torch.importer.jit_ir.build_tools.torch_ods_gen
|
// python -m torch_mlir.jit_ir_importer.build_tools.torch_ods_gen
|
||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,7 @@
|
||||||
#include "mlir-c/IR.h"
|
#include "mlir-c/IR.h"
|
||||||
#include "mlir-c/Pass.h"
|
#include "mlir-c/Pass.h"
|
||||||
|
|
||||||
#include "../../dialects/torch/importer/jit_ir/csrc/function_importer.h"
|
#include "../../jit_ir_importer/csrc/function_importer.h"
|
||||||
#include "backend_impl.h"
|
#include "backend_impl.h"
|
||||||
#include "mlir_lowering_context.h"
|
#include "mlir_lowering_context.h"
|
||||||
#include "mlir_node.h"
|
#include "mlir_node.h"
|
||||||
|
|
|
@ -92,8 +92,8 @@
|
||||||
"import torchvision\n",
|
"import torchvision\n",
|
||||||
"\n",
|
"\n",
|
||||||
"import torch_mlir\n",
|
"import torch_mlir\n",
|
||||||
"from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ModuleBuilder\n",
|
"from torch_mlir.jit_ir_importer import ClassAnnotator, ModuleBuilder\n",
|
||||||
"from torch_mlir.dialects.torch.importer.jit_ir.torchscript_annotations import extract_annotations\n",
|
"from torch_mlir.jit_ir_importer.torchscript_annotations import extract_annotations\n",
|
||||||
"\n",
|
"\n",
|
||||||
"from torch_mlir.passmanager import PassManager\n",
|
"from torch_mlir.passmanager import PassManager\n",
|
||||||
"from torch_mlir_e2e_test.linalg_on_tensors_backends.refbackend import RefBackendLinalgOnTensorsBackend"
|
"from torch_mlir_e2e_test.linalg_on_tensors_backends.refbackend import RefBackendLinalgOnTensorsBackend"
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from torch_mlir_e2e_test.annotations import annotate_args, export
|
from torch_mlir_e2e_test.annotations import annotate_args, export
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator
|
from torch_mlir.jit_ir_importer import ClassAnnotator
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir.torchscript_annotations import extract_annotations
|
from torch_mlir.jit_ir_importer.torchscript_annotations import extract_annotations
|
||||||
|
|
||||||
class MmModule(torch.nn.Module):
|
class MmModule(torch.nn.Module):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -17,8 +17,8 @@ from torch_mlir.dynamo import _get_decomposition_table
|
||||||
from torch.fx.experimental.proxy_tensor import make_fx
|
from torch.fx.experimental.proxy_tensor import make_fx
|
||||||
|
|
||||||
from .compiler_utils import run_pipeline_with_repro_report
|
from .compiler_utils import run_pipeline_with_repro_report
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ImportOptions, ModuleBuilder
|
from torch_mlir.jit_ir_importer import ClassAnnotator, ImportOptions, ModuleBuilder
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir.build_tools.library_generator import generate_library
|
from torch_mlir.jit_ir_importer.build_tools.library_generator import generate_library
|
||||||
|
|
||||||
|
|
||||||
class OutputType(Enum):
|
class OutputType(Enum):
|
||||||
|
|
|
@ -11,7 +11,7 @@ import torch
|
||||||
|
|
||||||
# Our native extension is not self-contained. It references libraries which
|
# Our native extension is not self-contained. It references libraries which
|
||||||
# must come in via the above first.
|
# must come in via the above first.
|
||||||
from ....._mlir_libs._jit_ir_importer import *
|
from .._mlir_libs._jit_ir_importer import *
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
|
@ -10,7 +10,7 @@ import codecs
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
from torch_mlir.passmanager import PassManager
|
from torch_mlir.passmanager import PassManager
|
||||||
|
|
||||||
from .registry import Registry
|
from .registry import Registry
|
||||||
|
|
|
@ -8,7 +8,7 @@ from typing import List, Optional, Tuple
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
import torch_mlir
|
import torch_mlir
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator
|
from torch_mlir.jit_ir_importer import ClassAnnotator
|
||||||
|
|
||||||
# Decorators
|
# Decorators
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ModuleBuilder
|
from torch_mlir.jit_ir_importer import ClassAnnotator, ModuleBuilder
|
||||||
# RUN: %PYTHON %s | FileCheck %s
|
# RUN: %PYTHON %s | FileCheck %s
|
||||||
|
|
||||||
mb = ModuleBuilder()
|
mb = ModuleBuilder()
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ModuleBuilder
|
from torch_mlir.jit_ir_importer import ClassAnnotator, ModuleBuilder
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
mb = ModuleBuilder()
|
mb = ModuleBuilder()
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ModuleBuilder
|
from torch_mlir.jit_ir_importer import ClassAnnotator, ModuleBuilder
|
||||||
# RUN: %PYTHON %s | FileCheck %s
|
# RUN: %PYTHON %s | FileCheck %s
|
||||||
|
|
||||||
mb = ModuleBuilder()
|
mb = ModuleBuilder()
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ModuleBuilder
|
from torch_mlir.jit_ir_importer import ClassAnnotator, ModuleBuilder
|
||||||
# RUN: %PYTHON %s | FileCheck %s
|
# RUN: %PYTHON %s | FileCheck %s
|
||||||
|
|
||||||
mb = ModuleBuilder()
|
mb = ModuleBuilder()
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ModuleBuilder
|
from torch_mlir.jit_ir_importer import ClassAnnotator, ModuleBuilder
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
mb = ModuleBuilder()
|
mb = ModuleBuilder()
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ModuleBuilder
|
from torch_mlir.jit_ir_importer import ClassAnnotator, ModuleBuilder
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
mb = ModuleBuilder()
|
mb = ModuleBuilder()
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
from typing import Dict, Optional
|
from typing import Dict, Optional
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | FileCheck %s
|
# RUN: %PYTHON %s | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: not %PYTHON %s 2>&1 | FileCheck %s
|
# RUN: not %PYTHON %s 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: not %PYTHON %s 2>&1 | FileCheck %s
|
# RUN: not %PYTHON %s 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# UNSUPPORTED: system-darwin
|
# UNSUPPORTED: system-darwin
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ImportOptions, ModuleBuilder
|
from torch_mlir.jit_ir_importer import ClassAnnotator, ImportOptions, ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch._C import CompilationUnit
|
from torch._C import CompilationUnit
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | FileCheck %s
|
# RUN: %PYTHON %s | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
import collections
|
import collections
|
||||||
from typing import Tuple, Optional, List, NamedTuple, Dict
|
from typing import Tuple, Optional, List, NamedTuple, Dict
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import enum
|
import enum
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
|
|
||||||
class Color(enum.Enum):
|
class Color(enum.Enum):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# This file is licensed under a pytorch-style license
|
# This file is licensed under a pytorch-style license
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
from utils import create_script_function
|
from utils import create_script_function
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ClassAnnotator, ImportOptions, ModuleBuilder
|
from torch_mlir.jit_ir_importer import ClassAnnotator, ImportOptions, ModuleBuilder
|
||||||
|
|
||||||
from utils import create_script_function
|
from utils import create_script_function
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
from typing import Tuple, Optional, NamedTuple
|
from typing import Tuple, Optional, NamedTuple
|
||||||
|
|
||||||
from utils import create_script_function
|
from utils import create_script_function
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# See LICENSE.pytorch for license information.
|
# See LICENSE.pytorch for license information.
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch_mlir.dialects.torch.importer.jit_ir import ModuleBuilder
|
from torch_mlir.jit_ir_importer import ModuleBuilder
|
||||||
|
|
||||||
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
# RUN: %PYTHON %s | torch-mlir-opt | FileCheck %s
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@ func.func @basic(%arg0: !torch.vtensor) -> !torch.vtensor {
|
||||||
|
|
||||||
// -----
|
// -----
|
||||||
|
|
||||||
// CHECK-LABEL: func.func private @__torch__.torch_mlir.dialects.torch.importer.jit_ir.build_tools.library_generator.promote_dtypes(
|
// CHECK-LABEL: func.func private @__torch__.torch_mlir.jit_ir_importer.build_tools.library_generator.promote_dtypes(
|
||||||
// CHECK: {{.*}} = torch.promote_dtypes {{.*}} : (!torch.list<optional<int>>, !torch.list<int>) -> !torch.int
|
// CHECK: {{.*}} = torch.promote_dtypes {{.*}} : (!torch.list<optional<int>>, !torch.list<int>) -> !torch.int
|
||||||
|
|
||||||
// CHECK-LABEL: func.func private @__torch_mlir_dtype_fn.aten.floor_divide(
|
// CHECK-LABEL: func.func private @__torch_mlir_dtype_fn.aten.floor_divide(
|
||||||
// CHECK: {{.*}} = call @__torch__.torch_mlir.dialects.torch.importer.jit_ir.build_tools.library_generator.promote_dtypes({{.*}}
|
// CHECK: {{.*}} = call @__torch__.torch_mlir.jit_ir_importer.build_tools.library_generator.promote_dtypes({{.*}}
|
||||||
|
|
||||||
// CHECK-LABEL: func.func @op_with_dtype_promotion(
|
// CHECK-LABEL: func.func @op_with_dtype_promotion(
|
||||||
// CHECK: {{.*}} = func.call @__torch_mlir_dtype_fn.aten.floor_divide({{.*}}
|
// CHECK: {{.*}} = func.call @__torch_mlir_dtype_fn.aten.floor_divide({{.*}}
|
||||||
|
|
Loading…
Reference in New Issue