❓ Questions
I know that ProGraML builds the graph by inserting a node for each instruction and variable/constant in the LLVM intermediate representation (IR), and then the final result is made of control flow, data flow, and call flow. But in this way, the Metadata information seems not to be included.
When I add a #pragma unroll in my source C code, there is NOT differece in corresponding LLVM IR except for addtional metadata !llvm.loop !2 following the instruction br.
And thus, the generated graph is the same except for one node representing the br instruction above. The only difference appears in that node's attribute features/full_text. However, the full_text attribute, which includes the entire line of raw LLVM IR information, is usually discarded when using the GNN model. That is, the graph generated with ProGraML does NOT contain any information about Loop optimization. This is a huge disaster for the project I am working on:(
In short, my questions are:
- Where the loop optimization information be included in LLVM IR, is it only in Metadata? I guess Yes after referring to LLVM-loop-unrolling.
- Does ProGraML use the Metadata information in LLVM IR to construct control flow, data flow, and call flow (as structural information)?
Thanks in advance for any help!!
My test case and corresponding produced results
source C code, then clang-7 -S -emit-llvm dot_product.c is used to obtain the LLVM IR.
#define n 2
void dot_product(int vec_a[n], int vec_b[n], int *res){
*res = 0;
#pragma unroll 2 // with loop optimization
for (int i = 0; i < n; i++){
*res += vec_a[i] * vec_b[i];
}
}
the corresponding partly LLVM IR and Graph with #pragma unroll 2
...
br label %9, !llvm.loop !2
...
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 7.0.1-12 (tags/RELEASE_701/final)"}
!2 = distinct !{!2, !3}
!3 = !{!"llvm.loop.unroll.count", i32 2}
<node id="67" label="67">
<attvalues>
<attvalue for="0" value="3" />
<attvalue for="4" value="{'full_text': ['br label %9, !llvm.loop !2']}" />
<attvalue for="1" value="0" />
<attvalue for="2" value="br" />
<attvalue for="3" value="0" />
</attvalues>
</node>
the corresponding partly LLVM IR and Graph without #pragma unroll 2
...
br label %9
...
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 7.0.1-12 (tags/RELEASE_701/final)"}
<node id="67" label="67">
<attvalues>
<attvalue for="0" value="3" />
<attvalue for="4" value="{'full_text': ['br label %9']}" />
<attvalue for="1" value="0" />
<attvalue for="2" value="br" />
<attvalue for="3" value="0" />
</attvalues>
</node>
❓ Questions
I know that ProGraML builds the graph by inserting a node for each instruction and variable/constant in the LLVM intermediate representation (IR), and then the final result is made of control flow, data flow, and call flow. But in this way, the Metadata information seems not to be included.
When I add a #pragma unroll in my source C code, there is NOT differece in corresponding LLVM IR except for addtional metadata
!llvm.loop !2following the instructionbr.And thus, the generated graph is the same except for one node representing the
brinstruction above. The only difference appears in that node's attributefeatures/full_text. However, thefull_textattribute, which includes the entire line of raw LLVM IR information, is usually discarded when using the GNN model. That is, the graph generated with ProGraML does NOT contain any information about Loop optimization. This is a huge disaster for the project I am working on:(In short, my questions are:
Thanks in advance for any help!!
My test case and corresponding produced results
source C code, then
clang-7 -S -emit-llvm dot_product.cis used to obtain the LLVM IR.the corresponding partly LLVM IR and Graph with
#pragma unroll 2the corresponding partly LLVM IR and Graph without
#pragma unroll 2