AI エンジンは、2 つのストリーミング入力または 2 つのストリーミング出力を並列で使用することが可能です。
並列ストリームを使用するようツールをガイドにするには、入力ストリームに
aie_stream_resource_in::a
や aie_stream_resource_in::b
といった異なる列挙値を使用する aie_stream_resource_in
および aie_stream_resource_out
アノテーションを使用します。次に例を示します。void vect_mul(input_stream<int8>* __restrict data1, input_stream<int8>* __restrict data2,
output_stream<int8>* __restrict out){
while(true)
chess_prepare_for_pipelining
chess_loop_range(8,)
{
aie::vector<int8,16> va_int8=readincr_v<16,aie_stream_resource_in::a>(data1);
aie::vector<int8,16> vb_int8=readincr_v<16,aie_stream_resource_in::b>(data2);
auto vc=aie::mul(va_int8,vb_int8);
// Avoid the write instruction to occur at the same cycle as the readincr of data1
writeincr<aie_stream_resource_out::a>(out,vc.to_vector<int8>(0));
va_int8=readincr_v<16,aie_stream_resource_in::a>(data1);
vb_int8=readincr_v<16,aie_stream_resource_in::b>(data2);
vc=aie::mul(va_int8,vb_int8);
// This writeincr can be scheduled as soon as possible
// as there is the __restrict keyword in function signature
writeincr(out,vc.to_vector<int8>(0));
}
}
同様に、2 つの並列出力ストリームを示すのに aie_stream_resource_out::a
と aie_stream_resource_out::b
を使用できます。