[all-commits] [llvm/llvm-project] a97466: [MLIR][Python] Add `encoding` argument to `tensor....

Mateusz Sokół via All-commits all-commits at lists.llvm.org
Tue Oct 1 13:48:22 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a9746675a505bc891c97dfcd1dbb480cf93116d5
      https://github.com/llvm/llvm-project/commit/a9746675a505bc891c97dfcd1dbb480cf93116d5
  Author: Mateusz Sokół <8431159+mtsokol at users.noreply.github.com>
  Date:   2024-10-01 (Tue, 01 Oct 2024)

  Changed paths:
    M mlir/python/mlir/dialects/tensor.py
    M mlir/test/python/dialects/sparse_tensor/dialect.py

  Log Message:
  -----------
  [MLIR][Python] Add `encoding` argument to `tensor.empty` Python function (#110656)

Hi @xurui1995 @makslevental,

I think in https://github.com/llvm/llvm-project/pull/103087 there's
unintended regression where user can no longer create sparse tensors
with `tensor.empty`.

Previously I could pass:
```python
out = tensor.empty(tensor_type, [])
```
where `tensor_type` contained `shape`, `dtype`, and `encoding`.

With the latest 
```python
tensor.empty(sizes: Sequence[Union[int, Value]], element_type: Type, *, loc=None, ip=None)
```
it's no longer possible.

I propose to add `encoding` argument which is passed to
`RankedTensorType.get(static_sizes, element_type, encoding)` (I updated
one of the tests to check it).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list