Unlock this feature

This feature isn’t part of your plan yet

Contact sales to get upgraded to the full DevStudio experience.

Unlock this feature

This feature isn't part of your plan yet.

Fully Connected Layers

Partial Fully Connected Layers

fullyConnectedTileBlockPartialfunction
File: /src/neuralNetBlocks/fc.hppLines 79–88

Computes a partial sum of a Fully Connected Layer in int8 precision.

template <typename T, std::int32_t numCols, typename NDArray>
void fullyConnectedTileBlockPartial(NDArray& qMatrix)
NameTypeDefaultDescription
TtypenameThe type of the input values.
numColsstd::int32_tThe width of the weight matrix in the FC Layer.
NDArraytypenameThe type of the weight matrix.
NameTypeDescription
qMatrixNDArray&The weights of the layer.

void

Split MAC Issue and Collect

fullyConnectedTileBlock launches the MEU and immediately reads the accumulators with accsum, which stalls until the MAC has finished. When the caller has independent work to do in that window (a flow read into another buffer, ALU work on earlier results), a MacDescriptor can be used to seperate the issuing and collection stages of the mac allowing for better pipelining.

const nn::MacDescriptor<nn::MacType::Int8, std::int32_t> mac;
mac.start<K>(qGateTile);
upWeightsFlow.issueRead();     // lands while the MAC runs
qGateAcc += mac.collect(qGateTile);

Between start and collect the operand must not change, the broadcast FIFO the MEU is consuming must not be popped, the accumulators must not be cleared, and the BroadcastFlow feeding the MAC must outlive the collect. Writes to core special registers stall until the MEU is idle, so they are safe but forfeit the overlap.

Sign in to your account

Don't have an account? 
By signing in, you are agreeing to our Terms of Use and Privacy Policy.
Quadric // One architecture. Every algorithm.

Develop.

Simulate.

Profile.

Collaborate.