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

Problem using TBB 2020.3 with Intel icx 2023.1 on Windows trying to use concurrent_hash_map::emplace #1142

Closed
jamesrburgess opened this issue Jul 11, 2023 · 5 comments

Comments

@jamesrburgess
Copy link

The VFX reference platform for 2023 and later is still on this older branch of tbb and I'm wanting to use that with the latest icx compiler. In tbb_config.h on Windows, we drop into the __clang__ section and the detection of whether rvalue references goes awry because we are neither using libc++ nor glibc on Windows. This then disables the emplace method.

Here is the relevant section in tbb/tbb_config.h:

#elif __clang__
/** TODO: these options need to be rechecked **/
    ...
    #define __TBB_CPP11_RVALUE_REF_PRESENT                  (__has_feature(__cxx_rvalue_references__) && (_LIBCPP_VERSION || __TBB_GLIBCXX_VERSION >= 40500))

and you can see that __TBB_CPP11_RVALUE_REF_PRESENT is going to come out as zero even though __has_feature(__cxx_rvalue_references__) will return 1.

A few lines down in the same __clang__ section we see std::begin and end are also disabled for the same reason.

Not knowing precisely why libc++ and glibc come into this calculation I could not confidently suggest a solution, but in my instance, which I think would be fairly broad I can modify both of those lines to use the following:

    #define __TBB_CPP11_RVALUE_REF_PRESENT                  (__has_feature(__cxx_rvalue_references__) && (_LIBCPP_VERSION || __TBB_GLIBCXX_VERSION >= 40500 || _MSC_VER >= 1916))

so enable if clang, has rvalue references, and is on Windows with Visual Studio 2019 or better compiler.

@isaevil
Copy link
Contributor

isaevil commented Jul 12, 2023

Hi, I can't surely tell for the TBB 2020 but it seems that it just wasn't intended to fall under __clang__ branch on Windows, but since icx is LLVM-based we do. I think your code change is valid.

Notify: @pavelkumbrasev

@pavelkumbrasev
Copy link
Contributor

The problem is that development of TBB (with last official version - 2020.U3) was stopped before icx (LLVM based Intel compiler) was released so that's why we can observe such issues.
On a first glance this solution can be used as a workaround.

@nofuturre
Copy link

@jamesrburgess is this issue still relevant?

@nofuturre
Copy link

If anyone encounter this issue in the future please open new issue with a link to this one

@jamesrburgess
Copy link
Author

We're shipping code with my patch. Seems to work. I'm trying hard to get us off of 2020.U3 still :-)

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

4 participants