TVMによるCソースコードの出力
解決したいこと
https://tvm.apache.org/docs/tutorial/tvmc_command_line_driver.html
↑でTVMのコンパイルや実行を進めています。
そこで、TVMが吐き出すCソースコードを読み取るのが現状の課題です。
現段階ではresnet50-v2-7.onnxモデルを獲得したのちに、
targetをcにして、relayに通して?以下のようにしました。
python3 -m tvm.driver.tvmc compile
--target "c"
--dump-code "relay"
--output module.tar
resnet50-v2-7.onnx
とコマンドを打ちコンパイルしてみました。
TVMの扱いもよくわからず探り探りで行っているのが現状です。
モデルは何でもいいのと、とりあえずとしてTVMがどのようなcソースコードを
出力したいです。
具体的なコマンドや操作を教えていただけると幸いです。
よろしくお願いします。
発生している問題・エラー
エラー内容一部抜粋
RuntimeError: Compilation error:
/tmp/tmptpo1c4uv/lib0.c: In function ‘int32_t tvmgen_default_fused_add_layout_transform(void*, int32_t*, int32_t, void*, int32_t*, void*)’:
/tmp/tmptpo1c4uv/lib0.c:34:7: error: ‘int32_t3’ was not declared in this scope
int32_t3 _1 = (int3)((((ax0_ax1_fused_ax2_fused * 224) + ax3))+(50176*0), (((ax0_ax1_fused_ax2_fused * 224) + ax3))+(50176*1), (((ax0_ax1_fused_ax2_fused * 224) + ax3))+(50176*2));
^~~~~~~~
/tmp/tmptpo1c4uv/lib0.c:34:7: note: suggested alternative: ‘int32_t’
int32_t3 _1 = (int3)((((ax0_ax1_fused_ax2_fused * 224) + ax3))+(50176*0), (((ax0_ax1_fused_ax2_fused * 224) + ax3))+(50176*1), (((ax0_ax1_fused_ax2_fused * 224) + ax3))+(50176*2));
^~~~~~~~
int32_t
/tmp/tmptpo1c4uv/lib0.c:35:9: error: ‘float3’ was not declared in this scope
*(float3*)(((float*)T_layout_trans) + ((ax0_ax1_fused_ax2_fused * 672) + (ax3 * 3))) = (((float3)(((float*)placeholder)[_1.s0],((float*)placeholder)[_1.s1],((float*)placeholder)[_1.s2])) + *(float3*)(((float*)placeholder1) + 0));
^~~~~~
/tmp/tmptpo1c4uv/lib0.c:35:9: note: suggested alternative: ‘float’
*(float3*)(((float*)T_layout_trans) + ((ax0_ax1_fused_ax2_fused * 672) + (ax3 * 3))) = (((float3)(((float*)placeholder)[_1.s0],((float*)placeholder)[_1.s1],((float*)placeholder)[_1.s2])) + *(float3*)(((float*)placeholder1) + 0));
^~~~~~
float
/tmp/tmptpo1c4uv/lib0.c:35:16: error: expected primary-expression before ‘)’ token
*(float3*)(((float*)T_layout_trans) + ((ax0_ax1_fused_ax2_fused * 672) + (ax3 * 3))) = (((float3)(((float*)placeholder)[_1.s0],((float*)placeholder)[_1.s1],((float*)placeholder)[_1.s2])) + *(float3*)(((float*)placeholder1) + 0));
^
/tmp/tmptpo1c4uv/lib0.c:35:127: error: ‘_1’ was not declared in this scope
*(float3*)(((float*)T_layout_trans) + ((ax0_ax1_fused_ax2_fused * 672) + (ax3 * 3))) = (((float3)(((float*)placeholder)[_1.s0],((float*)placeholder)[_1.s1],((float*)placeholder)[_1.s2])) + *(float3*)(((float*)placeholder1) + 0));
^~
/tmp/tmptpo1c4uv/lib0.c:35:127: note: suggested alternative: ‘._1’
*(float3*)(((float*)T_layout_trans) + ((ax0_ax1_fused_ax2_fused * 672) + (ax3 * 3))) = (((float3)(((float*)placeholder)[_1.s0],((float*)placeholder)[_1.s1],((float*)placeholder)[_1.s2])) + *(float3*)(((float*)placeholder1) + 0));
^~
._1
/tmp/tmptpo1c4uv/lib0.c:35:205: error: expected primary-expression before ‘)’ token
*(float3*)(((float*)T_layout_trans) + ((ax0_ax1_fused_ax2_fused * 672) + (ax3 * 3))) = (((float3)(((float*)placeholder)[_1.s0],((float*)placeholder)[_1.s1],((float*)placeholder)[_1.s2])) + *(float3*)(((float*)placeholder1) + 0));
^
/tmp/tmptpo1c4uv/lib0.c: In function ‘int32_t tvmgen_default_fused_add_nn_relu(void*, int32_t*, int32_t, void*, int32_t*, void*)’:
/tmp/tmptpo1c4uv/lib0.c:70:7: error: ‘int32_t4’ was not declared in this scope
int32_t4 _1 = (int4)((cse_var_1)+(1*0), (cse_var_1)+(1*1), (cse_var_1)+(1*2), (cse_var_1)+(1*3));
^~~~~~~~
/tmp/tmptpo1c4uv/lib0.c:70:7: note: suggested alternative: ‘int32_t’
int32_t4 _1 = (int4)((cse_var_1)+(1*0), (cse_var_1)+(1*1), (cse_var_1)+(1*2), (cse_var_1)+(1*3));
^~~~~~~~
int32_t
/tmp/tmptpo1c4uv/lib0.c:71:7: error: ‘float4’ was not declared in this scope
float4 _2 = ((float4)(((float*)placeholder)[_1.s0],((float*)placeholder)[_1.s1],((float*)placeholder)[_1.s2],((float*)placeholder)[_1.s3])) + *(float4*)(((float*)placeholder1) + ((ax0_ax1_fused_ax2_fused / 56) * 4));
^~~~~~
/tmp/tmptpo1c4uv/lib0.c:71:7: note: suggested alternative: ‘float’
float4 _2 = ((float4)(((float*)placeholder)[_1.s0],((float*)placeholder)[_1.s1],((float*)placeholder)[_1.s2],((float*)placeholder)[_1.s3])) + *(float4*)(((float*)placeholder1) + ((ax0_ax1_fused_ax2_fused / 56) * 4));
^~~~~~
float
/tmp/tmptpo1c4uv/lib0.c:72:14: error: expected ‘;’ before ‘_3’
float4 _3 = (float4)(0.000000e+00f, 0.000000e+00f, 0.000000e+00f, 0.000000e+00f);
^~
/tmp/tmptpo1c4uv/lib0.c:73:16: error: expected primary-expression before ‘)’ token
*(float4*)(((float*)T_relu) + cse_var_1) = ((_2) > (_3) ? (_2) : (_3));
^
/tmp/tmptpo1c4uv/lib0.c:73:52: error: ‘_2’ was not declared in this scope
*(float4*)(((float*)T_relu) + cse_var_1) = ((_2) > (_3) ? (_2) : (_3));
^~
/tmp/tmptpo1c4uv/lib0.c:73:52: note: suggested alternative: ‘._2’
*(float4*)(((float*)T_relu) + cse_var_1) = ((_2) > (_3) ? (_2) : (_3));
^~
._2
/tmp/tmptpo1c4uv/lib0.c:73:59: error: ‘_3’ was not declared in this scope
*(float4*)(((float*)T_relu) + cse_var_1) = ((_2) > (_3) ? (_2) : (_3));
^~
/tmp/tmptpo1c4uv/lib0.c:73:59: note: suggested alternative: ‘._3’
*(float4*)(((float*)T_relu) + cse_var_1) = ((_2) > (_3) ? (_2) : (_3));
^~
._3
/tmp/tmptpo1c4uv/lib0.c: In function ‘int32_t tvmgen_default_fused_add_nn_relu_1(void*, int32_t*, int32_t, void*, int32_t*, void*)’:
/tmp/tmptpo1c4uv/lib0.c:108:7: error: ‘int32_t4’ was not declared in this scope
int32_t4 _1 = (int4)((cse_var_1)+(1*0), (cse_var_1)+(1*1), (cse_var_1)+(1*2), (cse_var_1)+(1*3));
^~~~~~~~
/tmp/tmptpo1c4uv/lib0.c:108:7: note: suggested alternative: ‘int32_t’
int32_t4 _1 = (int4)((cse_var_1)+(1*0), (cse_var_1)+(1*1), (cse_var_1)+(1*2), (cse_var_1)+(1*3));
^~~~~~~~
int32_t
/tmp/tmptpo1c4uv/lib0.c:109:7: error: ‘float4’ was not declared in this scope
float4 _2 = ((float4)(((float*)placeholder)[_1.s0],((float*)placeholder)[_1.s1],((float*)placeholder)[_1.s2],((float*)placeholder)[_1.s3])) + *(float4*)(((float*)placeholder1) + ((ax0_ax1_fused_ax2_fused / 28) * 4));
0