Skip to content

[Ease-of-Use] Standardize in0/in1 parameters passing to unpacker/math functions for matmul #1287

@skrsmanovicTT

Description

@skrsmanovicTT

In LLK lib we assume that in0/inA/activations input will be mapped to HW SrcB Register and in1/inB/weights input would be mapped to HW SrcA register due to design of Tensix engine.
However our current approach for passing those parameters from tt-metal compute API level down do line to the LLK lib and inside LLK lib is not in perfect shape.
Here are few examples:

  1. https://github.com/tenstorrent/tt-metal/blob/40d106253584a51c1c41a988c81fb34526a998f5/tt_metal/hw/inc/api/compute/matmul.h#L93 llk_unpack_hw_configure parameters for in0 and in1 are swapped in compute api level
  2. https://github.com/tenstorrent/tt-metal/blob/40d106253584a51c1c41a988c81fb34526a998f5/tt_metal/hw/ckernels/blackhole/metal/llk_api/llk_unpack_AB_matmul_api.h#L29-L30 and https://github.com/tenstorrent/tt-metal/blob/40d106253584a51c1c41a988c81fb34526a998f5/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_unpack_AB_matmul_api.h#L29-L30 llk_unpack_AB_matmul_init parameters for in0 and in1 are swapped in llk level
  3. https://github.com/tenstorrent/tt-metal/blob/40d106253584a51c1c41a988c81fb34526a998f5/tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_unpack_AB_matmul_api.h#L73-L74 llk_unpack_AB_matmul parameters for in0 and in1 are swapped only for partial_face and not for the other face/tile related parameters in llk level

There is more examples in llk lib as well, where we usually use in0/in1 convention and then in mop config or similar functions we are mapping them to different src registers.

All of this is really confusing and hard for analysis. Proposal would be to keep it simple and consistent e.g. have mapping only in one layer if possible and keep it as deep as possible or as high as possible(compute api or llk lib level).

This mixed approach is also causing headache for LLK test infra since it uses direct calls to llk lib and not wrapping compute api where most of swap is happending.

I am open for further discussion or more detailed proposals.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions