intel / intel/llvm

Drop `polygeist-opt` and `cgeist` unwanted extensions

Open
#8,701 0 comments 0 reactions 0 assignees View on GitHub
enhancement sycl-mlir
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

**Is your feature request related to a problem? Please describe**

Currently, `polygeist` uses some extensions to cover codegen flaws ([here](https://github.com/intel/llvm/blob/741252c001d391254e09492ea64f547d9147a271/polygeist/tools/polygeist-opt/polygeist-opt.cpp#L80) and [here](https://github.com/intel/llvm/blob/741252c001d391254e09492ea64f547d9147a271/polygeist/tools/cgeist/driver.cc#L242)).

This comes from the fact that `llvm` and `memref` types should not be used together.

**Describe the solution you would like**

Implement `polygeist.struct` and `polygeist.struct_member_access` (or similar) operations to avoid using `llvm.struct` types.

**Alternative solutions**

We could be extra careful in codegen not combining this types, but this would involve:

1. When inserting a `memref` in a `llvm.struct`, we would need to convert to `llvm.ptr`;
2. When extracting a `ptr` from a `llvm.struct`, if applicable, we should convert to `memref`.

This is a far from ideal solution, as it'd put more pressure in codegen. We should have a higher-level construct instead.

**Additional context**

[CIR already has a type](https://llvm.github.io/clangir/Dialect/types.html#structtype) and a [GEP-like](https://llvm.github.io/clangir/Dialect/ops.html#cirstruct_element_addr-mlircirstructelementaddr) operation for this matter. We could have a similar approach to them.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.