Livt packages
Livt.ML
Version 1.6.1
Fixed-size quantized inference, tensor storage, attention, and transformer building blocks for Livt.
Published files (132)
- DotProduct.lvt
- FixedPointAccumulator.lvt
- Int8BroadcastMac64x8.lvt
- Int8BroadcastMac64x8Primitive.lvt
- Int8BroadcastMac64x8Primitive.vhd
- Int8Dot64x8.lvt
- Int8Dot64x8Primitive.lvt
- Int8Dot64x8Primitive.vhd
- Int8Linear4x8.lvt
- Int8Linear8x3.lvt
- Int8LinearAccumulator.lvt
- Int8Mac8.lvt
- Int8MatrixAccumulator32.lvt
- Int8MatrixAccumulator32Primitive.lvt
- Int8MatrixAccumulator32Primitive.vhd
- Int8MatrixAccumulator32Stream.lvt
- Linear8x8.lvt
- MatrixVectorMultiplication.lvt
- QLinearMatMul256x10.lvt
- QLinearMatMul256x10Ram.lvt
- QLinearMatMul256x10Stream.lvt
- QuantizedMatrix.lvt
- VecAdd.lvt
src/linear/Int8Dot64x8.lvt
namespace Livt.ML.Linear
/**
* Pipelined 64-element dot product with eight signed 16x8 MAC lanes.
*
* Activations are configured once and must fit signed 16-bit range. Each
* Compute call captures one packed row of 64 signed-int8 weights and returns
* an int32 result after eight registered groups.
*/
component Int8Dot64x8
{
// Request toggle paired with the native worker acknowledgment.
request: logic
// Owned arithmetic worker used by serialized operations.
primitive: Int8Dot64x8Primitive
/**
* Owns one native eight-lane worker in the caller clock/reset context; serialize calls
* sharing this instance.
*/
new()
{
primitive = new Int8Dot64x8Primitive()
}
/**
* Submits the configured operation by toggling the request and waits for matching
* acknowledgment. Operands must already be stable; reset cancels the pending operation.
*/
fn Submit(resetValue: logic, configureValue: logic)
{
state {
primitive.clear = resetValue
primitive.configure = configureValue
}
request = !request
primitive.request = request
while (primitive.acknowledge != request) {
state {
}
}
}
/**
* Clears the current dot-product accumulator.
*/
public fn Reset()
{
Submit(0b1, 0b0)
}
/**
* Configures one signed 16-bit activation; invalid indexes are ignored.
*/
public fn SetActivation(index: int, value: int)
{
if (index < 0 || index >= 64) {
return
}
state {
primitive.index = index as logic[6]
primitive.value = value
}
Submit(0b0, 0b1)
}
/**
* Computes one 64-element dot product from a packed signed-int8 row.
*/
public fn Compute(weights: logic[512]) int
{
primitive.weights = weights
Submit(0b0, 0b0)
return primitive.result
}
}