實驗流程
預處理
- Hugging Face 下載模型(whisper tiny.onnx)
- 獲取encoder、decoder的input output參數(netron)
- 寫轉換的py檔(compile.py) ,並分析operator的使用率(tvm本身的op)
- 重寫轉換的py檔,並標記欲優化的operator(matmul,此op占用95%以上)
- 編譯模型並得到so檔(encoder, decoder, decoder_with_past),其中decoder_with_past 因 dynamic shape,未優化
建置runtime
- 設定TVM編譯的參數(學長教的,有五六個檔案)
- 寫runtime(從tensorRT 改的),此runtime會呼叫我們自己寫的op
- 使用RISC-V RVV重寫matmul,並從c++檔編譯成.so檔(libmatmul.cpp→libmutmal.so)
- 編譯整個TVM(Cmake)
運行
- 執行run_whisper_tiny.py(執行encode/prefill/decode),並且生成aggregation.csv
備註:
Bianbu OS 是從ubuntu24.04爆改來的