Skip to main content

Module fusion

Module fusion 

Source
Expand description

Operand sharing — reader fusion on the RDU, decided from the cost model.

Unroll a tiled GEMM par ways and every instance wants the same operand panels. There are two ways to feed them and the compiler must pick one:

  • Replicated — each instance streams its own copy from DRAM. consumers times the memory traffic, nothing on the fabric.
  • Broadcast — one instance streams it and fans the panel out to the others. One copy from memory, plus a fan-out that occupies the vector network for as long as the data takes to cross it.

Which is cheaper is a property of the shape, the mesh and the memory, never a constant: a large panel shared by many instances over a short hop is obviously worth broadcasting, and a small one over a long hop obviously is not, and the interesting cases are in between. So share_operand compares the DRAM cycles a broadcast would save against the fabric cycles it would add, and returns the cheaper arrangement with both numbers attached — the same shape of decision the Tensix lane makes for reader fusion, and with the same discipline: the function takes the machine and the shape and nothing else, so there is no way to tell the compiler the answer. plasticine_fusion_lock holds that both outcomes are reachable by moving only the costs, and that the roofline moves exactly the bytes the decision chose.

Structs§

OperandStream
One operand panel and the instances that want it.
SharingDecision
The decision, with the two costs that produced it.

Enums§

Sharing
How an operand reaches the instances that want it.

Functions§

share_operand
Choose how stream reaches its consumers on t. Takes the machine and the shape, and nothing else.