iree icon indicating copy to clipboard operation
iree copied to clipboard

[VectorDistribution] Add iree_vector_ext.subgroup/thread_ids to make distribution opaque

Open Groverkss opened this issue 1 year ago • 3 comments

This patch adds two new operations: iree_vector_ext.subgroup_ids and iree_vector_ext.thread_ids. These operations simply decouple vector distribution from the actual thread indexing and hide them behind another operation.

This makes distribution patterns independent of the distribution indexing and makes them much more easier to debug. The distribution patterns only need to be debugged for tile sizes and the distribution indexing can be debugged separately on these operations.

Groverkss avatar May 07 '24 15:05 Groverkss

Isn't thread id Added here same as GPU thread id? It's fine to have this, but it seems redundant. You could also add subgroup id to the GPU dialect upstream and use that instead

MaheshRavishankar avatar May 07 '24 15:05 MaheshRavishankar

Isn't thread id Added here same as GPU thread id? It's fine to have this, but it seems redundant. You could also add subgroup id to the GPU dialect upstream and use that instead

These operations aren't same as the GPU dialect ones. GPU dialect operations actually map to thread ids. This operation creates a map from thread_id --> virtual_thread_ids. the mapping is defined by the layout.

Groverkss avatar May 07 '24 15:05 Groverkss

This is just deferring the lowering to ids. Is there anything we want to do with these operations?

Yes, this just defers the lowering. No plan to do anything else with these. It was just much easier to debug one-shot-like distribution patterns with this deferred lowering. Something like affine.delinearize + ordering makes it much harder to see what's happening.

Groverkss avatar May 07 '24 15:05 Groverkss

I decided this patch is not worth doing. It's simpler to just do an affine.apply

Groverkss avatar Jun 18 '24 18:06 Groverkss