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

[Bug] Fails to compile with TBB and XSIMD enabled #2736

Open
spectre-ns opened this issue Oct 31, 2023 · 9 comments · May be fixed by #2799
Open

[Bug] Fails to compile with TBB and XSIMD enabled #2736

spectre-ns opened this issue Oct 31, 2023 · 9 comments · May be fixed by #2799

Comments

@spectre-ns
Copy link
Contributor

spectre-ns commented Oct 31, 2023

Windows 10
MSVC 2019 Enterprise
C++20

Fails to compile with both XSIMD and TBB enabled. Fails with the following
syntax error: 'template'
On line 1252 of xassign.hpp

@spectre-ns
Copy link
Contributor Author

@JohanMabille
Copy link
Member

JohanMabille commented Nov 1, 2023

I guess we need to capture needs_cast here, but I wonder if it's a compiler issue. Do you have the same issue with MSVC 2022 ?

@spectre-ns
Copy link
Contributor Author

@JohanMabille yes the same issue exists in MSVC 2022

@spectre-ns
Copy link
Contributor Author

spectre-ns commented Nov 1, 2023

@spectre-ns
Copy link
Contributor Author

Also there are issues out of the box around tbb defining min and max that need to be mitigated using #define NOMINMAX

@spectre-ns
Copy link
Contributor Author

@tdegeus this issue isn't C++20 specific. Not sure what that label means though.

@PerretB
Copy link
Contributor

PerretB commented Jul 19, 2024

@spectre-ns @JohanMabille hello, did you find a workaround for this problem? Activating the flag /Zc:lambda does solve the failed capture of the constexpr var in the lambda https://learn.microsoft.com/en-us/cpp/build/reference/zc-lambda?view=msvc-170 . However the syntax error: 'template' remains on this line (and several others):

res_stepper.template store_simd(fct_stepper.template step_simd<value_type>());

@spectre-ns
Copy link
Contributor Author

Hi @PerretB I have not found a workaround. It works in clang and GCC so it is a compiler issue...

@PerretB PerretB linked a pull request Jul 22, 2024 that will close this issue
@brccabral
Copy link

This small example triggers the error

#include <xtensor/xarray.hpp>
#include <xtensor/xrandom.hpp>
#include <xtensor-blas/xlinalg.hpp>

int main()
{
    auto W1 = xt::random::rand<float>({10, 50}) - 0.5f;
    auto X = xt::random::rand<float>({10, 50}) - 0.5f;
    xt::xarray<float> d1 = xt::linalg::dot(W1, X);

    return 0;
}
cmake_minimum_required(VERSION 3.14)
project(xt_tbb)

set(XTENSOR_USE_XSIMD 1)
set(XTENSOR_USE_TBB 1)
find_package(xtensor REQUIRED)
find_package(xtensor-blas REQUIRED)

add_executable(xt_tbb main.cpp)
target_compile_options(xt_tbb PUBLIC "/Zc:lambda")
target_include_directories(xt_tbb PUBLIC ${xtensor-blas_INCLUDE_DIRS})
target_link_libraries(xt_tbb PUBLIC xtensor)
C:\Program Files (x86)\xtensor\include\xtensor\xassign.hpp(1252,41): error C2187: syntax error: 'template' was unexpected here

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

Successfully merging a pull request may close this issue.

5 participants