- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I noticed in the latest CilkPlus ABI specification (https://www.cilkplus.org/sites/default/files/open_specifications/CilkPlusABI_1.1.pdf), it says that the caller to the library must set the floating point flags (top of page 8). This is what the LLVM implementation of CilkPlus and its runtime do, but the current Intel version of the run-time has the code to save the floating point status registers that is in LLVM's code generator and not the runtime from the LLVM repository. Please could you tell me whether:
a) The floating point status flags should be set/saved by the caller
b) The floating point status flags should be set/saved by the callee
c) There's something I've overlooked
The ABI says:
"/**
The Intel runtime has:
"fnstcw %1" : : "m" ((sf).mxcsr), "m" ((sf).fpcsr));");
The LLVM runtime does not have this, but the CilkPlus specific file in the LLVM code generator has equivalent code.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ABI V1 requires that the floating point state be preserved before the setjmp call. This allows us to restore it on a steal so that if some aspect of floating point handling has been changed we can handle it properly. Ideally the instructions to do this should be inlined by the compiler when it generates the setjmp call, as the Intel compiler does.
We added a function to save the floating point state for those cases where it's difficult to add the instructions. If that function is missing from the LLVM repository, we need to update that version. If you need a version immediately, you can use the latest version at https://www.cilkplus.org/download#runtime-sources . While it doesn't have the gmake files, it should be compatible with the version bundled with the LLVM distribution.
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One more point. I'm not sure if LLVM/CLang is generating ABI 0 or ABI 1 frames. If it's generating ABI 0 frames, then it isn't required to save the floating point state, and in fact, there's nowhere to save it to.
On the other hand, if it is generating ABI 1 frames, and it's not saving the floating point state, the runtime will attempt to restore that state (which is random trash from the stack) and likely generate an error.
- Barry

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page