XRT では、エラー レポート API およびエラー レポート ツールが提供されています。エラーは、次の 2 つのタイプに分けられます。
- 同期エラー
- XRT ランタイム関数の呼び出し中に検出可能なエラー。
- 非同期エラー
- 下位ドライバー、システム、ハードウェアなどからのエラー。
auto ghdl=xrt::graph(device,uuid,"gr");
try{
ghdl.update("gr.fir24.in[1]",narrow_filter);
ghdl.run(16);
ghdl.read("gr.fir24.inout[0]", coeffs_readback);//Async read
}catch(std::exception const& e){
std::cout<<"Graph Execution Error"<<std::endl;
return 1;
}
非同期エラーは、実行中の XRT 関数呼び出しまたはアプリケーションに関連していない可能性があります。非同期エラーはドライバー サブシステムにキャッシュされるため、非同期エラー レポート API を介してユーザー アプリケーションからアクセスできます。キャッシュされたエラー情報は、削除されるまで保持されます。保持されているエラーが必ずしも現在のシステム状態を示しているとは限りません。たとえば、ボードがリセットされて正しく機能している場合でも、以前にキャッシュされたエラー情報が表示されていることがあります。現在の状態の混乱を避けるため、非同期エラーにはエラーが発生した時間を示すタイムスタンプが付いています。たとえば、タイムスタンプを最後の xbutil
リセットのタイムスタンプと比較できます。
ドライバーでキャッシュされたエラーには、https://github.com/Xilinx/XRT/blob/master/src/runtime_src/core/include/xrt_error_code.h で定義されているシステム エラー コードとメタデータが含まれており、これらはユーザー空間とカーネル空間で共有されます。
XRT エラー処理 API は experimental/xrt_error.h
を参照できます。非同期エラーの処理例:
xrt::error error(device, XRT_ERROR_CLASS_AIE);
auto errCode = error.get_error_code();
auto timestamp = error.get_timestamp();
auto err_str = error.to_string();
/* code to deal with this specific error */
std::cout<<"Async error: "<< err_str << std::endl;
非同期エラー出力の例:
Error Number (6): AIE_ACCESS
Error Driver (4): DRIVER_AIE
Error Severity (3): SEVERITY_CRITICAL
Error Module (3): MODULE_AIE_CORE
Error Class (2): CLASS_AIE
Timestamp: 1637342412366664740
XRT は、各クラスの最新のエラーと、エラー発生時のタイムスタンプを保持します。https://github.com/Xilinx/XRT/blob/master/src/runtime_src/core/include/xrt_error_code.h を参照すると、エラーの詳細を把握できます。たとえば、Error
Module (3): MODULE_AIE_CORE
は、エニュメレーション xrtErrorModule
の XRT_ERROR_MODULE_AIE_CORE
に該当します。
xbutil
を使用してエラーをレポートできます。エラー レポートは、さまざまなクラスからのエラーをすべて収集し、タイムスタンプ順に並べ替えます。レポートは、最後にリセットされた時間をドライバーにクエリします。
$ xbutil examine -r error -d 0
Asynchronous Errors
Time Class Module Driver Severity Error Code
Fri Nov 19 17:19:42 2021 GMT CLASS_AIE MODULE_AIE_CORE DRIVER_AIE SEVERITY_CRITICAL AIE_ACCESS
$ xbutil examine -r error -f json -o <OUTPUT_FILE> -d 0
{
"schema_version": {
"schema": "JSON",
"creation_date": "Fri Nov 19 17:58:09 2021 GMT"
},
"devices": [
{
"interface_type": "pcie",
"device_id": "0000:00:00.0",
"asynchronous_errors": [
{
"time": {
"epoch": "1637342382770339700",
"timestamp": "Fri Nov 19 17:19:42 2021 GMT"
},
"class": "CLASS_AIE",
"module": "MODULE_AIE_CORE",
"severity": "SEVERITY_CRITICAL",
"driver": "DRIVER_AIE",
"error_code": {
"error_id": "6",
"error_msg": "AIE_ACCESS"
}
}
]
}
]
}
xbutil
では、AI エンジンの実行ステータスをレポートし、デバッグ用にレジスタを読み出すためにも使用できます。たとえば、次のコマンドは、グラフの実行後にカーネルのステータスを読み出します。
$ xbutil examine -r aie -d 0
--------------------------
1/1 [0000:00:00.0] : edge
--------------------------
Aie
Aie_Metadata
GRAPH[ 0] Name : gr
Status : unknown
SNo. Core [C:R] Iteration_Memory [C:R] Iteration_Memory_Addresses
[ 0] 23:1 23:1 16388
[ 1] 23:2 23:0 6980
[ 2] 23:3 23:1 4
[ 3] 24:1 24:0 4
[ 4] 24:2 24:2 4
[ 5] 24:3 24:1 4
[ 6] 25:1 25:1 4
Core [ 0]
Column : 23
Row : 1
Core:
Status : disabled, core_done
Program Counter : 0x00000308
Link Register : 0x00000290
Stack Pointer : 0x000340a0
DMA:
MM2S:
Channel:
Id : 0
Channel Status : idle
Queue Size : 0
Queue Status : okay
Current BD : 0
Id : 1
Channel Status : idle
Queue Size : 0
Queue Status : okay
Current BD : 0
S2MM:
Channel:
Id : 0
Channel Status : idle
Queue Size : 0
Queue Status : okay
Current BD : 0
Id : 1
Channel Status : idle
Queue Size : 0
Queue Status : okay
Current BD : 0
Locks:
0 : released_for_write
1 : released_for_write
2 : released_for_write
3 : released_for_write
4 : released_for_write
5 : released_for_write
6 : released_for_write
7 : released_for_write
8 : released_for_write
9 : released_for_write
10 : released_for_write
11 : released_for_write
12 : released_for_write
13 : released_for_write
14 : released_for_write
15 : released_for_write
Events:
core : 1, 2, 5, 22, 23, 24, 28, 29, 31, 32, 35, 36, 38, 39, 40, 44, 45, 47, 68
memory : 1, 43, 44, 45, 106, 113
......
Core [ 6]
Column : 25
Row : 1
Core:
Status : enabled, east_lock_stall
Program Counter : 0x000001e6
Link Register : 0x000000b0
Stack Pointer : 0x00030020
DMA:
MM2S:
Channel:
Id : 0
Channel Status : stalled_on_requesting_lock
Queue Size : 0
Queue Status : okay
Current BD : 2
Id : 1
Channel Status : idle
Queue Size : 0
Queue Status : okay
Current BD : 0
S2MM:
Channel:
Id : 0
Channel Status : running
Queue Size : 0
Queue Status : okay
Current BD : 0
Id : 1
Channel Status : idle
Queue Size : 0
Queue Status : okay
Current BD : 0
Locks:
0 : acquired_for_write
1 : released_for_write
2 : released_for_write
3 : released_for_write
4 : released_for_write
5 : released_for_write
6 : released_for_write
7 : released_for_write
8 : released_for_write
9 : released_for_write
10 : released_for_write
11 : released_for_write
12 : released_for_write
13 : released_for_write
14 : released_for_write
15 : released_for_write
Events:
core : 1, 2, 5, 22, 26, 28, 29, 31, 32, 35, 38, 39, 44
memory : 1, 20, 21, 23, 35, 43, 44, 106, 113
次のコマンドは、デバッグ用に特定のレジスタを呼び出すために使用できます。
$ xbutil advanced --read-aie-reg -d 0 0 25 Core_Status
Register Core_Status Value of Row:0 Column:25 is 0x00000201
AI エンジン レジスタの定義は、
『Versal アダプティブ SoC AI エンジン レジスタ リファレンス』 (AM015) を参照してください。xbutil
コマンドの使用方法の詳細は、ザイリンクス ランタイム (XRT) アーキテクチャを参照してください。Vitis IDE のエラー解析は、AI エンジン ステータスの解析 を参照してください。