Refactor alignment attributes to use `llvm::MaybeAlign` and the `IntValidAlignment` constraint
The IntValidAlignment constraint is currently being used in the vector dialect to verify that the alignment is a positive integer power of two. The memref and SPIR-V dialects also contain operations which denote the alignment of memory operations, however they do not yet use the IntValidAlignment constraint.
After modifying the memory operations in the memref and SPIR-V dialects to use the IntValidAlignment constraint, one can also create constructors for these operations which take an instance of llvm::MaybeAlign as an optional parameter similar to how constructors in the vector dialect are defined here:
https://github.com/llvm/llvm-project/blob/a3eb311ad3769789ced18cc4f0fba31f04293045/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td#L1726-L1734
Finally, one improvement that can be made to all three dialects is to create an interface which returns an llvm::MaybeAlign as opposed to an std::optional<uint64_t>. It could be named getMaybeAlign.
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
- Check that no other contributor is working on this issue. If someone is assigned to the issue or claimed to be working on it, ping the person. After one week without a response, the assignee may be changed.
- Leave a comment indicating that you are working on the issue, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
- Fix the issue locally.
- Run the test suite locally. Remember that the subdirectories under
test/create fine-grained testing targets, so you can e.g. usemake check-clang-astto only run Clang's AST tests. - Create a Git commit.
- Run
git clang-format HEAD~1to format your changes. - Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: Erick Ochoa Lopez (amd-eochoalo)
After modifying the memory operations in the memref and SPIR-V dialects to use the IntValidAlignment constraint, one can also create constructors for these operations which take an instance of llvm::MaybeAlign as an optional parameter similar to how constructors in the vector dialect are defined here:
https://github.com/llvm/llvm-project/blob/a3eb311ad3769789ced18cc4f0fba31f04293045/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td#L1726-L1734
Finally, one improvement that can be made to all three dialects is to create an interface which returns an llvm::MaybeAlign as opposed to an std::optional<uint64_t>. It could be named getMaybeAlign.
@llvm/issue-subscribers-mlir
Author: Erick Ochoa Lopez (amd-eochoalo)
After modifying the memory operations in the memref and SPIR-V dialects to use the IntValidAlignment constraint, one can also create constructors for these operations which take an instance of llvm::MaybeAlign as an optional parameter similar to how constructors in the vector dialect are defined here:
https://github.com/llvm/llvm-project/blob/a3eb311ad3769789ced18cc4f0fba31f04293045/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td#L1726-L1734
Finally, one improvement that can be made to all three dialects is to create an interface which returns an llvm::MaybeAlign as opposed to an std::optional<uint64_t>. It could be named getMaybeAlign.
Can I please volunteer for this issue? Thank you!
@nimit25 , sure! Please feel free to ask questions. It may be better to split this ticket into two PRs. One where the alignment attributes are constraint by IntValidConstraint and the other one with the interface and constructors.
@nimit25, are you still working on this task? It seems there hasn't been any progress for two weeks.
Haven't had a chance to start on it. Looks you beat me to the PR. You can go ahead with the implementation :)
Hi,
Is this issue still available to work on?
@MDerazNasr, thanks for your interesting. This ticket was worked on and partially completed. I'll close it and reopen another one once there is a clear direction on the missing item. Thanks!