Skip to content

Add SOA level property and change COO format once in LLVM #797

@hameerabbasi

Description

@hameerabbasi
          Once we update to LLVM 20/nightly builds we will change COO format to SoA (Structure of Arrays) calling convention, as it fixes some issues for us [link](https://discourse.llvm.org/t/passmanager-fails-on-simple-coo-addition-example/81247/2?u=mtsokol).
#COO = #sparse_tensor.encoding<{
    map = (i, j) -> (i : compressed(nonunique), j : singleton(soa)), posWidth = 64, crdWidth = 64
}>
#COO_3D = #sparse_tensor.encoding<{
    map = (i, j, k) -> (i : compressed(nonunique), j : singleton(soa, nonunique), k : singleton(soa)), posWidth = 64, crdWidth = 64
}>
#COO_4D = #sparse_tensor.encoding<{
    map = (i, j, k, l) -> (i : compressed(nonunique), j : singleton(soa, nonunique), k : singleton(soa, nonunique), l : singleton(soa)), posWidth = 64, crdWidth = 64
}>

Then instead of:

fields.append((f"indices_{compressed_counter}", get_nd_memref_descr(2, idx_dtype)))

we would have:

fields.append((f"indices_coo_dim_0_{compressed_counter}", get_nd_memref_descr(1, idx_dtype)))
fields.append((f"indices_coo_dim_1_{compressed_counter}", get_nd_memref_descr(1, idx_dtype)))
coo_dim_counter = 2
...
if LevelFormat.Singleton == level.format:
    fields.append((f"indices_coo_dim_{coo_dim_counter}_{compressed_counter}", get_nd_memref_descr(1, idx_dtype)))
    coo_dim_counter += 1

Does it make sense?

But this will be addressed separately once we can build with nightlies.

Originally posted by @mtsokol in #792 (comment)

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorupstream

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions