Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlir compilation failure in zip_equal on arm32 #61581

Open
jpalus opened this issue Mar 21, 2023 · 1 comment
Open

mlir compilation failure in zip_equal on arm32 #61581

jpalus opened this issue Mar 21, 2023 · 1 comment

Comments

@jpalus
Copy link

jpalus commented Mar 21, 2023

Trying to build llvm 16.0.0 for Arm32 and asserts enabled fails with:

In file included from /usr/include/c++/12.2.0/cassert:44,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/include/llvm/ADT/STLExtras.h:29,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/Support/TypeID.h:20,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/IR/MLIRContext.h:13,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/IR/DialectRegistry.h:16,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/IR/Dialect.h:16,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/IR/OpDefinition.h:22,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/IR/Builders.h:12,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/IR/PatternMatch.h:12,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h:12,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h:14,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/include/mlir/Dialect/Linalg/Passes.h:16,
                 from /home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp:9:                                                                                                                      
/home/users/builder/rpm/BUILD/llvm-16.0.0.src/include/llvm/ADT/STLExtras.h: In instantiation of 'llvm::detail::zippy<llvm::detail::zip_first, T, U, Args ...> llvm::zip_equal(T&&, U&&, Args&& ...) [with T = iota_range<long long int>; U = ArrayRef<long long int>&; Args = {SmallVector<mlir::OpFoldResult, 13>}]':
/home/users/builder/rpm/BUILD/llvm-16.0.0.src/tools/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp:58:23:   required from here
/home/users/builder/rpm/BUILD/llvm-16.0.0.src/include/llvm/ADT/STLExtras.h:894:19: error: no matching function for call to 'all_equal(<brace-enclosed initializer list>)'
  894 |   assert(all_equal({std::distance(adl_begin(t), adl_end(t)),
      |          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  895 |                     std::distance(adl_begin(u), adl_end(u)),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  896 |                     std::distance(adl_begin(args), adl_end(args))...}) &&
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
/home/users/builder/rpm/BUILD/llvm-16.0.0.src/include/llvm/ADT/STLExtras.h:1986:28: note: candidate: 'template<class T> bool llvm::all_equal(std::initializer_list<_Tp>)'
 1986 | template <typename T> bool all_equal(std::initializer_list<T> Values) {
      |                            ^~~~~~~~~
/home/users/builder/rpm/BUILD/llvm-16.0.0.src/include/llvm/ADT/STLExtras.h:1986:28: note:   template argument deduction/substitution failed:
/home/users/builder/rpm/BUILD/llvm-16.0.0.src/include/llvm/ADT/STLExtras.h:894:19: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'int')
  894 |   assert(all_equal({std::distance(adl_begin(t), adl_end(t)),
      |          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  895 |                     std::distance(adl_begin(u), adl_end(u)),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  896 |                     std::distance(adl_begin(args), adl_end(args))...}) &&
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

That's because zip_equal assumes difference_type of all 3 input parameters are the same and passes them to all_equal:

assert(all_equal({std::distance(adl_begin(t), adl_end(t)),
std::distance(adl_begin(u), adl_end(u)),
std::distance(adl_begin(args), adl_end(args))...}) &&

However on 32-bit platforms difference_type of first argument (iota_range) is intmax_t therefore long long int while for the other two it's int.

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 21, 2023

@llvm/issue-subscribers-mlir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants