LeapMindのBlueOilに関する講演を聞いたんですが、そのスライドの中にChiselで開発しているIPがあるようですね。
AI技術やIoTなどの企業研究に特化した「CCSE2019」にて、CRO兼村による機械学習を使った科学領域における研究の発表と、新ハードウェアアクセラレータ設計を活用した顔検出デモを初公開!に情報がありました。
【Convolutional Neural Network ProcessorをChiselで開発する】 要旨 近年RISC-VプロセッサやGoogle Edge TPUの開発に使われたChiselをCNNプロセッサ開発に使った事例を簡単に紹介します。
また、ちょっと先だけど、9月28日の第二回 Deep Learning Acceleration 勉強会(DLAccel #2)で聞けそう。
BlueOilのソースコードを調べてみたら、
RunTCAという関数があって、TCAConv2dの中で、下記のように、ホストメモリ => DMA => Conv2D TCA =>=>DMA => ホストメモリをやっていますね。
引用 Measurement::Start("Sync UDMABuf Input"); p.dma_input_buffer->sync_size(input_byte_size); p.dma_input_buffer->sync_for_device(); Measurement::Stop(); Measurement::Start("Conv2D TCA"); de10_nano::RunTCA(p.device_input_phys_addr, p.device_output_phys_addr, p.device_kernel_phys_addr, p.thresholds, in_w, in_h, k_c, MAX_NBIT_QINPUT, out_w, out_h, out_c, k_w, k_h, cp.padding, cp.stride_along_height); Measurement::Stop(); Measurement::Start("Sync UDMABuf Output"); p.dma_output_buffer->sync_size(output_byte_size); p.dma_output_buffer->sync_for_cpu(); Measurement::Stop();
RunTCAでは、
static volatile uint32_t* csr = nullptr; if (csr == nullptr) { csr = reinterpret_cast<uint32_t*>(mapPhysicalMemory(HPS_TO_FPGA_LW_BASE, 0xFF)); }
にて、スタートレジスタに 1 を書いて、
while (csr[Csr::statusRegister] != 127) { // std::cout << "Status " << csr[Csr::statusRegister] << std::endl; continue; }
ステータスレジスタが 127 (0xff)になるまで、ポーリングしていますね。
このQuantizedConv2dは、Pythonコードのdlk/core/view.pyの run メソッド内で、
オペレータが Conv & op.is_quantized and nbit_qinput == 2 の時に、
オペレータが Conv & op.is_quantized and nbit_qinput == 2 の時に、
elif self.op.op_type == 'Conv':
conv_func = 'func_QuantizedConv2D'
で登録され、
{conv_func}({inputs_string}, {op.name}, scaling_factors::{op.name}, binConv2D_struct);のように実行されていますね。
}}}