mlir-hlo/tests
Wenyi Zhao 23ebbb28d1 PR #50191: [MLIR][DISC] Add RAL (Runtime abstraction layer) Dialect
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/50191

DISC is a e2e flow, including both compiler side and runtime side. For
runtime side, we have different targeting environments (e.g. tensorflow,
pytorch, or sometimes even a standalone binary). In order to simplify
the design of the compiler side, we design a Runtime Abstraction Layer
(RAL) to sperate the compiler side and runtime side. Thus the compiler
side only need to target RAL itself and it is the responsibility of RAL
to handle the differences between different targeting environments.

One of the most important functions of RAL is to manage stateful
resources. To this end, it provides a context object, and hides all
stateful operations behind this context, thus the compiler side itself
doesn't need to care about the resource initialization. For example, a
kernel must be loaded before it can be launched on GPU. However, the
loading operation should only be taken once during the whole lifetime of
the context in order to achieve the best performance. Based on the
initialization-free interfaces provided by RAL, compiler side can focus
on its core optimization logic and lets the RAL to manage the resource
status.

The context mentioned above is passed as a parameter to the entry
function and all RAL APIs should always use the context as their first
argument. This CR also provides a pass to help to ensure this property.
The pass rewrites the entry function to make sure their first argument
is the context. For entry function, the pass also rewrites its inputs
and outputs. To be concrete, all the original inputs and outputs of the
entry function are received from and sent to RAL through a sequence of
RAL API calls correspondingly. The motivation behind this is to hide the
implementation details of I/Os. This design may also potentially enable
partial execution of the compiled module when some of the inputs are
ready.
Copybara import of the project:

--
c4f20a89aed71181e75bcc5265723b88bde23240 by Wenyi Zhao <reyizero@gmail.com>:

[MLIR][DISC] Add RAL (Runtime abstraction layer) Dialect

DISC is a e2e flow, including both compiler side and runtime side. For
runtime side, we have different targeting environments (e.g. tensorflow,
pytorch, or sometimes even a standalone binary). In order to simplify
the design of the compiler side, we design a Runtime Abstraction Layer
(RAL) to sperate the compiler side and runtime side. Thus the compiler
side only need to target RAL itself and it is the responsibility of RAL
to handle the differences between different targeting environments.

One of the most important functions of RAL is to manage stateful
resources. To this end, it provides a context object, and hides all
stateful operations behind this context, thus the compiler side itself
doesn't need to care about the resource initialization. For example, a
kernel must be loaded before it can be launched on GPU. However, the
loading operation should only be taken once during the whole lifetime of
the context in order to achieve the best performance. Based on the
initialization-free interfaces provided by RAL, compiler side can focus
on its core optimization logic and lets the RAL to manage the resource
status.

The context mentioned above is passed as a parameter to the entry
function and all RAL APIs should always use the context as their first
argument. This CR also provides a pass to help to ensure this property.
The pass rewrites the entry function to make sure their first argument
is the context. For entry function, the pass also rewrites its inputs
and outputs. To be concrete, all the original inputs and outputs of the
entry function are received from and sent to RAL through a sequence of
RAL API calls correspondingly. The motivation behind this is to hide the
implementation details of I/Os. This design may also potentially enable
partial execution of the compiled module when some of the inputs are
ready.

--
1991d4f80ab6087943956e1c0fec4940a22ab08d by Wenyi Zhao <reyizero@gmail.com>:

fix

PiperOrigin-RevId: 379317586
2021-06-14 11:27:43 -07:00
..
end2end Integrate LLVM at llvm/llvm-project@8396aeb07c 2021-03-31 08:01:34 -07:00
CMakeLists.txt Add CMake files and lit configurations, enough for `ninja check-mlir-hlo` to pass on all the tests 2020-08-07 22:14:34 -07:00
broadcast_propagation.mlir [MLIR][HLO] Extend broadcast propagation pass to enable more fusion 2021-06-09 03:03:37 -07:00
canonicalize.mlir Handle empty tensors in SimplifyConcatSlice. 2021-06-09 02:15:47 -07:00
chlo_infer_shape_type_methods.mlir Integrate LLVM at llvm/llvm-project@671f0e2e18 2021-04-28 16:37:53 -07:00
chlo_legalize_to_hlo_broadcasts.mlir Integrate LLVM at llvm/llvm-project@cb65419b1a 2021-05-26 04:47:24 -07:00
chlo_legalize_to_mhlo.mlir Fix Cosh approximation for F16. 2021-06-10 06:16:44 -07:00
chlo_ops.mlir [MLIR][HLO] Implement `RegionBranchOpInterface` for rank specialization cluster 2021-05-11 09:03:05 -07:00
concatenate.mlir Rename `xla_hlo` dialect to `mhlo` 2020-07-30 22:32:50 +00:00
convert.mlir [MHLO] Don't crash trying to constant fold mhlo.convert on complex 2021-05-11 05:15:57 -07:00
disc_ral_inject_execution_context.mlir PR #50191: [MLIR][DISC] Add RAL (Runtime abstraction layer) Dialect 2021-06-14 11:27:43 -07:00
hlo-legalize-gather-to-torch-index-select.mlir Add a transform for Gathers to torch_index_select. 2020-07-30 22:34:32 +00:00
hlo-legalize-to-lhlo-only-dynamic.mlir PR #50211: [MLIR][DISC] Bufferize RealDynamicSliceOp and ReduceOp 2021-06-11 16:33:15 -07:00
hlo-legalize-to-lhlo-unranked.mlir PR #49454: [MLIR][DISC] Upgrade to use the new `reifyReturnTypeShapes` interface. 2021-05-24 10:11:55 -07:00
hlo-legalize-to-lhlo.mlir PR #49454: [MLIR][DISC] Upgrade to use the new `reifyReturnTypeShapes` interface. 2021-05-24 10:11:55 -07:00
hlo-legalize-to-linalg.mlir [MHLO:linalg] Be more aggressive about turning mhlo.const into std.constant 2021-06-07 11:58:23 -07:00
hlo-transform-unranked.mlir Lower ReluGrad via chlo::BroadcastSelect. 2021-05-04 01:03:02 -07:00
inlining.mlir Rename `xla_hlo` dialect to `mhlo` 2020-07-30 22:32:50 +00:00
legalize-control-flow.mlir Restrict MHLO control flow ops to single-block regions 2021-03-30 17:51:03 -07:00
legalize-to-std.mlir Integrate LLVM at llvm/llvm-project@b24436ac96 2021-03-23 12:20:17 -07:00
legalize-trigonometric-to-approximation.mlir Fix tanh lowering for NaN input. 2021-03-24 06:34:36 -07:00
legalize_to_scf.mlir Integrate LLVM at llvm/llvm-project@0cf7e4b252 2020-12-16 20:30:17 -08:00
lhlo-fuse-linalg.mlir Integrate LLVM at llvm/llvm-project@b24436ac96 2021-03-23 12:20:17 -07:00
lhlo-legalize-select-and-scatter.mlir Integrate LLVM at llvm/llvm-project@4b13b7581d 2021-04-27 12:19:05 -07:00
lhlo-legalize-tensor-load-op.mlir PR #49598: [MLIR][DISC] legalize tensor_load inserted during hlo-to-lhlo conversion 2021-06-01 16:27:56 -07:00
lhlo-legalize-to-affine.mlir PR #47315: [MLIR] Add concatenateOp lowering from lmhlo to Affine. 2021-04-14 11:06:38 -07:00
lhlo-legalize-to-gpu.mlir Integrate LLVM at llvm/llvm-project@678241795c 2021-03-16 13:33:00 -07:00
lhlo-legalize-to-linalg.mlir Integrate LLVM at llvm/llvm-project@da3ed58b97 2021-06-03 20:45:18 -07:00
lhlo-legalize-to-parallel-loops.mlir Integrate LLVM at llvm/llvm-project@678241795c 2021-03-16 13:33:00 -07:00
lhlo_gpu_ops.mlir [HLO] Adopt custom syntax for convolution dims and window attributes for LMHLO_GPU 2021-05-20 09:41:48 -07:00
lhlo_ops.mlir [HLO] Add AllReduceScatter to MHLO and LMHLO dialects. 2021-06-14 09:37:07 -07:00
lit.cfg.py Add CMake files and lit configurations, enough for `ninja check-mlir-hlo` to pass on all the tests 2020-08-07 22:14:34 -07:00
lit.site.cfg.py.in Add license header to lit.site.cfg.py.in 2020-08-07 22:22:24 -07:00
lower-complex.mlir Generate Equal and NotEqual kernels for complex types. 2021-04-15 00:35:52 -07:00
lower-general-dot.mlir Cleanup build rule names in compiler/mlir/hlo to remove the redundant/obsolete xla_ prefix 2020-07-30 22:33:29 +00:00
materialize-broadcasts.mlir Cleanup build rule names in compiler/mlir/hlo to remove the redundant/obsolete xla_ prefix 2020-07-30 22:33:29 +00:00
mhlo-fusion.mlir Cleanup build rule names in compiler/mlir/hlo to remove the redundant/obsolete xla_ prefix 2020-07-30 22:33:29 +00:00
mhlo_infer_shape_type_methods.mlir [HLO:MLIR] Make binary op type reification emit shape_of instead of tensor ops 2021-03-11 02:01:35 -08:00
ops.mlir [HLO] Add AllReduceScatter to MHLO and LMHLO dialects. 2021-06-14 09:37:07 -07:00
optimize-hlo.mlir Add an optimization that converts some Gathers to Slices. 2020-07-30 22:34:10 +00:00
rank-specialization.mlir [MLIR][HLO] Find shape equivalences and use them for better rank specialization 2021-06-11 04:00:26 -07:00
reduce.mlir Integrate LLVM at llvm/llvm-project@cb65419b1a 2021-05-26 04:47:24 -07:00
reshape.mlir Rename `xla_hlo` dialect to `mhlo` 2020-07-30 22:32:50 +00:00
reverse.mlir Rename `xla_hlo` dialect to `mhlo` 2020-07-30 22:32:50 +00:00
sink-constants-to-control-flow.mlir Sink standard dialect constants in sink_constants_to_control_flow pass 2020-08-03 19:30:29 -07:00
transpose.mlir Rename `xla_hlo` dialect to `mhlo` 2020-07-30 22:32:50 +00:00
tuple.mlir Rename `xla_hlo` dialect to `mhlo` 2020-07-30 22:32:50 +00:00
unfuse_batch_norm.mlir Integrate LLVM at llvm/llvm-project@678241795c 2021-03-16 13:33:00 -07:00