fix: stop using hex display when printElementsAttrWithHexIfLarger is …#2
Open
fix: stop using hex display when printElementsAttrWithHexIfLarger is …#2
Conversation
… hoisting barrier
Linalg named operations are currently limited to tensors and memrefs
composed of floating point, integer or complex elements and using any
other element type triggers an assertion.
This change adds support for arbitrary element types through the
specification of the arithmetic operations associated to a type in
specific attributes of a linalg named operation. The attributes' names
correspond to the short form of the arithmetic operator implemented by
the operation (i.e., add, sub, mul, max_signed, max_unsigned,
min_signed, min_unsigned, exp, abs, ceil, negf or log) and receive as
values the name of an operation and optionally a return type given
after a colon.
For example, a `linalg.matmul` operation multiplying two tensors
composed of in would be expressed as:
linalg.matmul { add = "complex.add", mul = "complex.mul" }
ins(%arg1, %arg2 : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>)
outs(%2 : tensor<?x?xcomplex<f32>>)
Sensible default values for the attributes are given for float,
integer and complex types, such that the omission of the attributes
results in the original behavior of the named operation before this
change. I.e., the expression:
linalg.matmul { add = "arith.addf", mul = "arith.mulf" }
ins(%arg1, %arg2 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%2 : tensor<?x?xf32>)
and:
linalg.matmul
ins(%arg1, %arg2 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%2 : tensor<?x?xf32>)
yield identical results.
By default, the result type of an operation implementing an arithmetic
operator is assumed to be identical with the type of the first
argument. If this assumption does not hold for an operation, the
result type must be specified explicitly, e.g.,
linalg.matmul { add = "custom_add_op:restypeadd",
mul = "custom_mul_op:restypemul" }
ins(%arg1, %arg2 : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>)
outs(%2 : tensor<?x?xcomplex<f32>>)
The extraction of operation names and result types from attributes,
proper instantiation and default values are provided by a set of
operation interfaces (one per operator) in
`LinalgFrontendInterfaces.td`. The set of operation interfaces
required for a named operation is derived transparently from the
arithmetic expressions in its YAML specification via
`mlir-linalg-ods-yaml-gen`.
umut-sahin
approved these changes
Sep 8, 2023
BourgerieQuentin
requested changes
Sep 13, 2023
Member
BourgerieQuentin
left a comment
There was a problem hiding this comment.
That's a quite invasive in the upstream project. Could we desactivate it properly from concrete?
Author
I have not seen one. But this hard coded default value is making our MLIR not easy to read and probably bigger than needed. @andidr @antoniupop Is it possible to the llvm AsmPrinterOptions from the Concrete Compiler ? |
2607e96 to
87113ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…not set