Reference for C++11 support in offloaded code

Reference for C++11 support in offloaded code

Is there a reference someplace which documents what features of C++11 are supported in offloaded code?  It appears to me that std::thread::yield and std::map::emplace are not supported, but it would be good to have a comprehensive list.

8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Did you read the section in the release notes?

Features from C++11 (-std=c++11)
o Complete (instead of partial) implementation of initializer lists. See N2672 and
o Complete implementation of inline namespaces. See N2535.
o Complete implementation of non-static data member initializers. See N2756.
o Complete implementation of generalized constant expressions. See N2235.
o Complete implementation of unrestricted unions. See N2544.
o Delegating constructors. See N1986.
o Rvalue references for *this. See N2439.
o Raw string literals. See N2442.
o Conversions of lambdas to function pointers.
o Implicit move constructors and assignment operators. See N3053.
o __bases and __direct_bases type traits.
o The context-sensitive keyword "final" can now be used on a class definition, and
"final" and "override" can be used on member function declarations. See N2928,
N3206, and N3272.
o Complete implementation of the "noexcept" specifier and operator. See

If you're looking for deficiency reports about which things may not always work in offload mode, I don't know a solution other than to ask specific questions here or in a problem report.

Thanks for the pointer to the release notes.  I was hoping for something along the lines of this table:

But even this table lacks details of the additions to the STL and the thread support library which are definitely supported on windows but seem to be missing on the MIC.

I do not know of a specific list but I will make some inquiries and let you know what I learn. As Tim said, if there is something specific of interest or that you may have tried that is not working and can offer details or examples then let us know and we will certainly try to help.

I apologize for the delay. There is no specific feature list. Working w/Developers on details, here is the characterization of the support:

Care must be exercised when using classes (user defined and standard libraries - .e.g. cstdio, iostream, standard C++ library) in offloaded code on Windows*. The offload code must not depend on any specific data size or order of allocation of classes between the host (Windows) and target (Linux). Classes with such variances can be used in offloaded code inside a function call (and other functions that it calls) appearing within the lexical scope of an offload pragma; however, such classes cannot be used with IN/OUT/INOUT clauses explicitly or implicitly.

Let me know whether this helps and/or whether you still have specific questions/errors related to std::thread::yield and std::map::emplace that I can inquire w/Developers about.

Thanks for investigating. Perhaps you could ask about std::thread::yield for me. If I take the example from and add decorations for the MIC like so:

#pragma offload_attribute(push target(mic))
#include <iostream>
#include <chrono>
#include <thread>
#pragma offload_attribute(pop)
// "busy sleep" while suggesting that other threads run 
// for a small amount of time
__declspec(target(mic)) void little_sleep(std::chrono::microseconds us)
    auto start = std::chrono::high_resolution_clock::now();
    auto end = start + us;
    do {
    } while (std::chrono::high_resolution_clock::now() < end);
int main()
#pragma offload target(mic : 0)
    auto start = std::chrono::high_resolution_clock::now();
    auto elapsed = std::chrono::high_resolution_clock::now() - start;
    std::cout << "waited for "
              << std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count()
              << " microsecondsn";

It won't compile:

1>  Building with Intel(R) C++ Compiler XE 14.0
1>  ***** ClCompile (x64 - Intel C++)
1>  Main.cpp
1>Main.cpp(14): error : *MIC* namespace "std::this_thread" has no member "yield"
1>            std::this_thread::yield();
1>                              ^
1>  compilation aborted for Main.cpp (code 2)
1>icl : error #10340: problem encountered when performing target compilation
1>Build FAILED.

Any advice?

Developers indicate thread::yield was added to g++ in version 4.8. The Xeon Phi™ binutils is based off g++ 4.7. When the host version of g++ is set to 4.7, the code fails to compile on *host* as well.  Others have reported similar related issues. We are anticipating an upgrade to the Xeon Phi™ g++ base in a future release targeted to the Knights Landing release/timeframe. I'm sorry I don't have better news about this.

Ok, thank you for explaining it. I guess the document I was looking for originally is a combination of these two pages?

Leave a Comment

Please sign in to add a comment. Not a member? Join today