Problem Converting Code Using std::vectors to MLIR
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 624
- Forks
- 170
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to compile a simple gather function using vectors for data storage using the compilation flag
```
cgeist $1 -O0 -g -fopenmp -S -o $fileBase.affine.mlir -I/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 \
-I/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 \
-I/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward \
-I/home/$USER_NAME/$PROJECT_NAME/build/lib/clang/18/include \
-I/usr/local/include \
-I/usr/include -D$4
```
The function that I'm trying to compile is
```cpp
#include
#include
#pragma scop
void gather_vec(std::vector &a,
std::vector &b,
std::vector &idx) {
for (size_t i = 0; i < idx.size(); ++i) {
a[i] = b[idx[i]];
}
}
int main() {
std::vector a;
std::vector b = {1, 2, 3, 4};
std::vector idx = {3, 2, 1, 0};
gather_vec(a, b, idx);
// verification
for (size_t i = 0; i < a.size(); ++i) {
std::cout << "a[" << i << "] = " << a[i] << "\n";
}
return 0;
}
```
and when I run the cgeist command, I get some cleanup not handled and this error before printing out the intermediate MLIR. I have also attached the whole log.
[cgeist_error.txt](https://github.com/user-attachments/files/20144002/cgeist_error.txt)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the cgeist command with the shown gather_vec example and inspect cgeist_error.txt alongside the cleanup diagnostic. Trace the vector-related conversion and cleanup handling until the source either emits intermediate MLIR or reports a precise unsupported construct, then add or update coverage if the relevant test location is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100