kokkos / kokkos/stdBLAS

#include <linalg> causes compiler error in VS2022

Open
#266 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
167
Forks
31
PR merge metrics
No merged PRs in 30d

Description

Putting

#include <linalg>

in a source file in Visual Studio 2022, using the VS compiler, results in a compiler error. There is no error when I switch to the LLVM Platform Toolset in my project settings, however.

Details and repro follow:

My VS project name is lin_alg_examples (VS creates a directory of the same name). Under this directory, I created the following subdirectory:

...lin_alg_examples\kokkos\experimental

Under experimental, I placed the mdspan and linalg header files, and the __p0009_bits and __p1673_bits directories:
image

In the project settings, I am using the VS compiler with the latest C++ working draft:
image

I then write an empty main() function:

#include <experimental/mdspan>
#include <experimental/linalg>
#include <vector>#include <cstdlib>
#include <iostream>#include <format>
using std::vector, std::size_t, std::cout, std::format;
namespace stdex = std::experimental;
int main()
{

}

When I build the project, I get the following compiler error messages:

\lin_alg_examples\kokkos\experimental\__p1673_bits\transposed.hpp(255,57): error C2653: 'original_mapping_type': is not a class or namespace name

\lin_alg_examples\kokkos\experimental\__p1673_bits\transposed.hpp(253,17): message : This diagnostic occurred in the compiler generated function 'auto std::experimental::__p1673_version_0::linalg::impl::transposed_layout<std::experimental::layout_stride>::mapping(const std::experimental::layout_stride::mapping<Extents> &)'

It identifies lines 253 and 255 in transposed.hpp; lines 252-255 are as follows:

    template<class OriginalExtents>
    static auto mapping(const typename layout_stride::template mapping<OriginalExtents>& orig_map) {
      using original_mapping_type = typename layout_stride::template mapping<OriginalExtents>;
      using extents_type = transpose_extents_t<typename original_mapping_type::extents_type>;

I tried inserting the "ugly hack" referenced in Issue #242, but this did not fix the problem, even though it seemed it might be related.

If I comment out #include <experimental/linalg>, however, the project builds successfully.

Furthermore, if I restore the file so that the linalg file is included again, and I change the compiler Platform Toolset to the LLVM setting:

image

the code will compile successfully.

One final remark is that the exact same behavior is seen after changing the C++ Language Standard setting to C++20:

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided empty main and the MSVC Platform Toolset, comparing it with the LLVM toolset and the C++20 setting. Start in kokkos/experimental/__p1673_bits/transposed.hpp around lines 252-255, where original_mapping_type is used, and compare the behavior when experimental/linalg is included. Done means the example builds with the VS compiler without breaking the reported LLVM case.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.