Until now, the pass hoisting `RT.await_future` operations only
supports `tensor.parallel_insert_slice` operations that use loop
induction variables directly as indexes. Any more complex indexing
expressions produce a domination error, since a
`tensor.parallel_insert_slice` cloned by the pass into an additional
parallel for loop is left with references to values from the original
loop.
This change properly clones operations producing intermediate values
within the original parallel for loop and thus adds support for
indexing expressions that reference loops IVs only indirectly.
We currently have something like `var = TemporaryDirectory`
without explicitly calling the `close` method on `var` thus
raising a `ResourceWarning` when the resource is implicitely cleaned-up.
This could be avoided by using `mkdtemp` instead.
The type parser of the RT dialect unconditionally attempts to parse
the string "future". This breaks the parsing of any RT type. Remove
unconditional parsing of this prefix.
Return-like operations require special treatment by the type inference
rewriter, since their operand types are both tied to the result types
of their producers and to result types of their parent operations.
The inference scheme for ordinary operations, in which the initial
local inference state is composed of the operand types of the
rewritten producers and the old types of related operations before
rewriting is insufficient, since this may result in a mismatch between
the inferred types and the actual types of the already rewritten
parent operation.
Until now, precedence of the new result types of the parent operation
has been implemented by simply designating these types as the operand
types of a return-like operation. However, while this works as
intended for return-like operations, which simply forward values
(e.g., `func.return`), this creates invalid IR for other return-like
operations (e.g., `tensor.yield`).
This change implements precedence of the result types of the parent
operation of a return-like operation by adding the return types of the
already rewritten parent operation to the initial local inference
state before final invocation of type inference.
The type inference rewriter changes the name of the rewritten function
to the name of the original function when the rewriting process is
complete. However, the name is retrieved from the original function
operation after the operation has already been replaced and thus
destroyed, resulting in a null pointer dereference.
This change retrieves the name of the original function before it is
replaced and saves it in a copy, which is then used to safely assign
the new name to the rewritten function.
The tiling infrastructure preserves attributes of tiled
`linalg.generic` operations, such that the attribute for the tile
sizes specified for the `linalg.generic` operation before tiling is
copied to the `linalg.generic` operation that is part of the generated
IR for a single tile.
This change causes the attribute to be removed after tiling, since it
does not make sense to preserve the attribute for per-tile operations.
For now, the attribute "tile-sizes" is copied from the FHELinalg
operation to the corresponding `linalg.generic` operation only for
multiplications of encrypted matrices with plaintext matrices.
The changes of this commit also cause the attribute to be copied for
multiplications between plaintext ad ciphertext matrices, as well as
for multiplications between two ciphertext matrices.
The current scheme used by reinstantiating conversion patterns in
`lib/Conversion/Utils/Dialects` for operations with blocks is to
create a new operation with empty blocks, to move the operations from
the old blocks and then to replace any references to block
arguments. However, such in-place updates of the types of block
arguments leave conversion patterns for operations nested in the
blocks without the ability to determine the original types of values
from before the update.
This change uses proper signature conversion for block arguments, such
that the original types of block arguments with converted types is
preserved, while the new types are made available through the dialect
conversion infrastructure via the respective adaptors.
Some of the TFHE to Concrete conversion patterns implicitly assume
that operands are ciphertexts and thus that the converted types have a
higher number of dimensions than the original types. However, for
non-ciphertext types, the number of dimensions before and after the
conversion must be the same.
This commit adds a check to the respective conversion patterns
triggering a simple type conversion that preserves the number of
dimensions for non-ciphertext types.