Is it considered good practice to create sub-dialects that inherit from a common dialect? For instance, the XLA compiler today supports GPU/CPU/TPU paths, each of which have different target-specific optimizations such as fusion. Will the MLIR compiler have a global XLA dialect and 3 XLA sub-dialects, one for each target architecture? Or should MLIR dialects be target-independent until code generation at which point the LLVM back-end handles target specific optimizations?
--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/d914ad67-1f07-4615-b427-d2b96b11b2a2%40tensorflow.org.
You can create both target-dependent and target-independent dialects. We currently do not have a concept of dialect inheritance.We have XLA dialect in MLIR. It has not yet been release in the open source but will be soon. The XLA dialect models HLO, so it is target independent.
On Mon, Jun 10, 2019 at 10:23 AM Sana Damani <sana....@intel.com> wrote:
Is it considered good practice to create sub-dialects that inherit from a common dialect? For instance, the XLA compiler today supports GPU/CPU/TPU paths, each of which have different target-specific optimizations such as fusion. Will the MLIR compiler have a global XLA dialect and 3 XLA sub-dialects, one for each target architecture? Or should MLIR dialects be target-independent until code generation at which point the LLVM back-end handles target specific optimizations?--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ml...@tensorflow.org.
Thank you for your response Tatiana.Are there plans to add support for dialect inheritance in the future? This may be useful when adding support for data-types (e.g. int8) and operations that are available only on certain architectures, and for optimizations that are implemented differently for each architecture (e.g. profit of fusion may vary between CPU vs GPU).
I do not think XLA is entirely target independent. Today XLA has files under tensorflow/compiler/xla/service/cpu and tensorflow/compiler/xla/service/gpu which implement optimizations and code generation (e.g. cuDNN for GPU) based on the architecture.
--On Monday, June 10, 2019 at 10:29:01 AM UTC-7, Tatiana Shpeisman wrote:You can create both target-dependent and target-independent dialects. We currently do not have a concept of dialect inheritance.We have XLA dialect in MLIR. It has not yet been release in the open source but will be soon. The XLA dialect models HLO, so it is target independent.On Mon, Jun 10, 2019 at 10:23 AM Sana Damani <sana....@intel.com> wrote:Is it considered good practice to create sub-dialects that inherit from a common dialect? For instance, the XLA compiler today supports GPU/CPU/TPU paths, each of which have different target-specific optimizations such as fusion. Will the MLIR compiler have a global XLA dialect and 3 XLA sub-dialects, one for each target architecture? Or should MLIR dialects be target-independent until code generation at which point the LLVM back-end handles target specific optimizations?--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ml...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/d914ad67-1f07-4615-b427-d2b96b11b2a2%40tensorflow.org.
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/f73a5809-57ac-4dd4-8c0a-ca8c6bb7e1e0%40tensorflow.org.
> On Jun 10, 2019, at 10:50 AM, Sana Damani <sana....@intel.com> wrote:
>
> Thank you for your response Tatiana.
>
> Are there plans to add support for dialect inheritance in the future? This may be useful when adding support for data-types (e.g. int8) and operations that are available only on certain architectures, and for optimizations that are implemented differently for each architecture (e.g. profit of fusion may vary between CPU vs GPU).
>
> I do not think XLA is entirely target independent. Today XLA has files under tensorflow/compiler/xla/service/cpu and tensorflow/compiler/xla/service/gpu which implement optimizations and code generation (e.g. cuDNN for GPU) based on the architecture.
Right, XLA is a lot of different things depending on what part you’re referring to. Tatiana is mentioning that there can be a single dialect corresponding to the “HLOBuilder” abstraction, which is more or less target independent (though some targets only support some features).
Within this space there are a lot of open questions: several new HLOs have been added recently specifically because of targets that have optimized high level kernels (e.g. triangular decomposition on GPUs). While this is pragmatic given where we are now, in my view, this direction is eroding the original value of HLO, since it is no longer a simple set of orthogonal primitives that everything is built upon. I’m much farther away from it, but my understanding is that ONNX is also heading down a similar slippery slope.
XLA internally has other abstractions though: it has late HLO (this is a term I made up, I’m not sure the official term for this) which introduces a buffer abstractions. XLA-GPU as an IR of sorts built out of its thunks. Each of these can be modeled as MLIR dialects, and each is in various stages of discussion and evaluation by various teams.
-Chris
--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/07BD97F7-ACD7-440B-8610-377CC8ECD611%40google.com.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/CAM4W%2BYeGtZFuEsMvS5_MXoks%3D2AEuMUohonTCs8AXTGZ2VXKog%40mail.gmail.com.
if you had say an op X that is available on all CPUs and op Y that is only available in certain, then you don't need to have the dialect containing Y inherit from the one containing X. Instead you can have a function with both X and Y
To unsubscribe from this group and stop receiving emails from it, send an email to ml...@tensorflow.org.
if you had say an op X that is available on all CPUs and op Y that is only available in certain, then you don't need to have the dialect containing Y inherit from the one containing X. Instead you can have a function with both X and YHi Jacques,You make a very interesting point. So it looks like if you want a dialect D1 with operation X and another dialect D2 with operations X and Y, you can:(a) create a new dialect D2 with both X and Y(b) create a new dialect D2 with only Y(c) inherit sub-dialect D2 from D1(d) extend dialect D1 to include YOption (a) would be bad practice IMO because of code duplication.Option (b) is the mixed dialect function you described. I think that a potential issue with this would be the inability to perform analyses and transforms that operate on both X and Y (if for example you want to fuse X and Y).
Option (c) solves both problems by preventing code duplication and allowing X and Y to be part of the same dialect D2, thereby making optimizations possible.
Option (d) is what Mehdi proposed and this also solves both problems but would require additional checks to determine if a certain back-end supports operation Y. However, if you require the same operation Y in separate dialects such that the operation is defined differently either based on types supported or optimizations, inheriting multiple child classes D2 and D3 from a common base class D1 may still be useful.
--SanaOn Monday, June 10, 2019 at 11:24:26 PM UTC-7, Jacques Pienaar wrote:On Tue, Jun 11, 2019 at 7:40 AM 'Chris Lattner' via MLIR <ml...@tensorflow.org> wrote:
> On Jun 10, 2019, at 10:50 AM, Sana Damani <sana....@intel.com> wrote:
>
> Thank you for your response Tatiana.
>
> Are there plans to add support for dialect inheritance in the future? This may be useful when adding support for data-types (e.g. int8) and operations that are available only on certain architectures, and for optimizations that are implemented differently for each architecture (e.g. profit of fusion may vary between CPU vs GPU).I'm curious about the use case of inheritance along with multiple dialects. One of the strengths of MLIR is that you can have multiple dialects in the same function. o if you had say an op X that is available on all CPUs and op Y that is only available in certain, then you don't need to have the dialect containing Y inherit from the one containing X. Instead you can have a function with both X and Y (even though they are in different dialects) and that function is only valid for platforms supporting Y. E.g., you would have introduced Y in the process of targeting that specific platform.The target is very important as you and Chris mention as a lot of optimizations require knowing the target to determine which optimizations to do etc. Which is another interesting discussion point :)-- Jacques>
> I do not think XLA is entirely target independent. Today XLA has files under tensorflow/compiler/xla/service/cpu and tensorflow/compiler/xla/service/gpu which implement optimizations and code generation (e.g. cuDNN for GPU) based on the architecture.
Right, XLA is a lot of different things depending on what part you’re referring to. Tatiana is mentioning that there can be a single dialect corresponding to the “HLOBuilder” abstraction, which is more or less target independent (though some targets only support some features).
Within this space there are a lot of open questions: several new HLOs have been added recently specifically because of targets that have optimized high level kernels (e.g. triangular decomposition on GPUs). While this is pragmatic given where we are now, in my view, this direction is eroding the original value of HLO, since it is no longer a simple set of orthogonal primitives that everything is built upon. I’m much farther away from it, but my understanding is that ONNX is also heading down a similar slippery slope.
XLA internally has other abstractions though: it has late HLO (this is a term I made up, I’m not sure the official term for this) which introduces a buffer abstractions. XLA-GPU as an IR of sorts built out of its thunks. Each of these can be modeled as MLIR dialects, and each is in various stages of discussion and evaluation by various teams.
-Chris
--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ml...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/07BD97F7-ACD7-440B-8610-377CC8ECD611%40google.com.
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/62cf0f83-6fc4-4243-b04c-09bc915ba392%40tensorflow.org.
For example, std.addi, std.addf, std.subi, std.subf are all conceptually "arithmetic operations" and std.addi, std.addf are "addition operations". There may be use cases where you would want to operate on any arithmetic operation, or any addition.
Many transformations themselves seem target-independent to me (fusion, tiling), it's the _choice_ of which transformation to apply that is target-specific.
We already the NVVM dialect (https://github.com/tensorflow/mlir/blob/master/include/mlir/LLVMIR/NVVMOps.td) that extends the LLVM dialect in the way Mehdi described above: it reuses the types of the "parent" dialect and introduces new operations. And it is target-specific in a sense that it should only be used when targeting an Nvidia GPU. My understanding is the conversions/passes are in charge of picking the dialects they produce, and it may be useful for those to have a sort of target description. Many transformations themselves seem target-independent to me (fusion, tiling), it's the _choice_ of which transformation to apply that is target-specific.There is another case where operation "inheritance" pops in: when multiple operations have some common property and we may want to introduce an common abstraction for them. For example, std.addi, std.addf, std.subi, std.subf are all conceptually "arithmetic operations" and std.addi, std.addf are "addition operations". There may be use cases where you would want to operate on any arithmetic operation, or any addition. The same may be interesting for some HLOs.
On Tue, Jun 11, 2019 at 8:24 AM 'Jacques Pienaar' via MLIR <ml...@tensorflow.org> wrote:
On Tue, Jun 11, 2019 at 7:40 AM 'Chris Lattner' via MLIR <ml...@tensorflow.org> wrote:
> On Jun 10, 2019, at 10:50 AM, Sana Damani <sana....@intel.com> wrote:
>
> Thank you for your response Tatiana.
>
> Are there plans to add support for dialect inheritance in the future? This may be useful when adding support for data-types (e.g. int8) and operations that are available only on certain architectures, and for optimizations that are implemented differently for each architecture (e.g. profit of fusion may vary between CPU vs GPU).I'm curious about the use case of inheritance along with multiple dialects. One of the strengths of MLIR is that you can have multiple dialects in the same function. o if you had say an op X that is available on all CPUs and op Y that is only available in certain, then you don't need to have the dialect containing Y inherit from the one containing X. Instead you can have a function with both X and Y (even though they are in different dialects) and that function is only valid for platforms supporting Y. E.g., you would have introduced Y in the process of targeting that specific platform.The target is very important as you and Chris mention as a lot of optimizations require knowing the target to determine which optimizations to do etc. Which is another interesting discussion point :)-- Jacques
>
> I do not think XLA is entirely target independent. Today XLA has files under tensorflow/compiler/xla/service/cpu and tensorflow/compiler/xla/service/gpu which implement optimizations and code generation (e.g. cuDNN for GPU) based on the architecture.
Right, XLA is a lot of different things depending on what part you’re referring to. Tatiana is mentioning that there can be a single dialect corresponding to the “HLOBuilder” abstraction, which is more or less target independent (though some targets only support some features).
Within this space there are a lot of open questions: several new HLOs have been added recently specifically because of targets that have optimized high level kernels (e.g. triangular decomposition on GPUs). While this is pragmatic given where we are now, in my view, this direction is eroding the original value of HLO, since it is no longer a simple set of orthogonal primitives that everything is built upon. I’m much farther away from it, but my understanding is that ONNX is also heading down a similar slippery slope.
XLA internally has other abstractions though: it has late HLO (this is a term I made up, I’m not sure the official term for this) which introduces a buffer abstractions. XLA-GPU as an IR of sorts built out of its thunks. Each of these can be modeled as MLIR dialects, and each is in various stages of discussion and evaluation by various teams.
-Chris
--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ml...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/07BD97F7-ACD7-440B-8610-377CC8ECD611%40google.com.
--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ml...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/CAM4W%2BYeGtZFuEsMvS5_MXoks%3D2AEuMUohonTCs8AXTGZ2VXKog%40mail.gmail.com.
---- Alex
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/62cf0f83-6fc4-4243-b04c-09bc915ba392%40tensorflow.org.
Hi Mehdi,My bad, I seem to have misunderstood your proposal.The difference that I see between (b) and (c) would be that with inheritance, the new dialect D2 has its own variant of both X and Y operations
and can analyze both, whereas with (b) there are two independent dialects, each one with a view of only one of the operations (either X or Y).I was under the impression that an optimization could only operate on ops from a single dialect and not on ops from multiple dialects. But perhaps my assumption is incorrect?
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/59ef031d-5f98-47d2-89b3-9206e4b03388%40tensorflow.org.
Thank you for clarifying this Mehdi. Dialect-independent optimizations that can operate on mixed-dialect IRs certainly sound powerful, and they handle the concerns I had.
Sana
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/59ef031d-5f98-47d2-89b3-9206e4b03388%40tensorflow.org.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/5039e961-6e5b-4391-a7cb-4aaecec9a465%40tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/5039e961-6e5b-4391-a7cb-4aaecec9a465%40tensorflow.org.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/5ecff2a7-8258-4563-8cf2-5d387b3fb36b%40tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/5ecff2a7-8258-4563-8cf2-5d387b3fb36b%40tensorflow.org.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/5ecff2a7-8258-4563-8cf2-5d387b3fb36b%40tensorflow.org.
I don't think there is a way to know, at runtime, if an operation that belongs to dialect A consumes or produces types that belong to dialect B.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/5ecff2a7-8258-4563-8cf2-5d387b3fb36b%40tensorflow.org.
---- Alex
I don't think there is a way to know, at runtime, if an operation that belongs to dialect A consumes or produces types that belong to dialect B.Hi Alex, could we not use use-def information to determine if an input to an operation that belongs to dialect A was generated by an operation that belongs to dialect B?
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/74b7e302-c319-4c11-912e-b66032fafc10%40tensorflow.org.
On Tue, Jun 11, 2019 at 11:12 AM Sana Damani <sana....@intel.com> wrote:I don't think there is a way to know, at runtime, if an operation that belongs to dialect A consumes or produces types that belong to dialect B.Hi Alex, could we not use use-def information to determine if an input to an operation that belongs to dialect A was generated by an operation that belongs to dialect B?You can do that, but that does not tell you anything about the actual type of the value :)
I also think that the point was that you can't query at runtime what kind of type would an operation accept types that belong to another dialect.For instance the NVVM dialect operations are operating on the LLVM dialect types, but this isn't something you can query: the code that manipulate these operations is expected to know.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/CANF-O%3DaPPFyCvZp1joiP8MA09rjHD0RTzVXdhLZjuYBEviVL7g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/74b7e302-c319-4c11-912e-b66032fafc10%40tensorflow.org.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/d93b2884-b0cf-457e-b451-00d2ff4dd009%40tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/CAKeN2efHSOhb-xggLd9aDDa-scU7nrOf9CLhozNnKTCwoCMjkA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/d93b2884-b0cf-457e-b451-00d2ff4dd009%40tensorflow.org.
--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ml...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/CAKeN2efHSOhb-xggLd9aDDa-scU7nrOf9CLhozNnKTCwoCMjkA%40mail.gmail.com.
---- Alex
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/083295ed-7d12-48be-bf92-c8c5e1b07b4d%40tensorflow.org.
The only use case I can think of is testing the legality of a specific optimization. e.g. does the back-end support the int8 version of a specific fused operation?
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/083295ed-7d12-48be-bf92-c8c5e1b07b4d%40tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/083295ed-7d12-48be-bf92-c8c5e1b07b4d%40tensorflow.org.
Well this is assuming the dialect itself is target-specific (e.g. NVVM for GPUs).
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/2a6a8e20-130b-4fc3-b3f5-3929f7f7d25e%40tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/2a6a8e20-130b-4fc3-b3f5-3929f7f7d25e%40tensorflow.org.