- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We're currently using TBB 2.1 and have run into some trouble while upgrading the compiler used to build our product on 32-bit Linux to GCC 4.3.x. The issue appears to be an incompatibility between GCC and Intel ICC (presumably what is used to build TBB).
GCC expects the stack to be maintained with 16-byte alignment across functions calls in order to facilitate the use of SSE, etc. instructions. With the upgrade to GCC 4.3.x, we are now observing crashes in many of our functions when they are invoked via TBB; investigation reveals that our functions have been called with the stack 8-byte aligned, not 16-byte aligned. (Most of the examples we've seen so far occur when GCC uses the movapd instruction on data which is on the stack.)
Some research turned up this posting about differences in stack alignment discipline between GCC and ICC: http://software.intel.com/en-us/forums/showthread.php?t=66267
Is this a known issue with TBB? Has it been fixed in a later release? GCC 4.3.x is on the list of supported compilers for TBB; how is this supposed to work?
Thanks.
-Chris
GCC expects the stack to be maintained with 16-byte alignment across functions calls in order to facilitate the use of SSE, etc. instructions. With the upgrade to GCC 4.3.x, we are now observing crashes in many of our functions when they are invoked via TBB; investigation reveals that our functions have been called with the stack 8-byte aligned, not 16-byte aligned. (Most of the examples we've seen so far occur when GCC uses the movapd instruction on data which is on the stack.)
Some research turned up this posting about differences in stack alignment discipline between GCC and ICC: http://software.intel.com/en-us/forums/showthread.php?t=66267
Is this a known issue with TBB? Has it been fixed in a later release? GCC 4.3.x is on the list of supported compilers for TBB; how is this supposed to work?
Thanks.
-Chris
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's so late in the lifetime of 32-bit linux that I wouldn't count on these discrepancies being resolved. I can't speak for the developers of TBB. Perhaps they didn't consider the possibility of TBB calling a function compiled by 32-bit gcc with use of SSE parallel instructions as a part of the documented compatibility, given the impracticality of dealing with the issue. I would expect it to work if you avoided use of parallel instructions in those functions, or built the entire TBB with gcc, as you indicated.
A possible work-around would be to insert a gcc-compiled intermediate wrapper function which doesn't put any SSE data on its own stack, but implicitly adjusts the stack which it passes down to the functions which require aligned stack. Wrapper functions would be in a separate file in case you invoked gcc function in-lining (e.g. -O3).
A possible work-around would be to insert a gcc-compiled intermediate wrapper function which doesn't put any SSE data on its own stack, but implicitly adjusts the stack which it passes down to the functions which require aligned stack. Wrapper functions would be in a separate file in case you invoked gcc function in-lining (e.g. -O3).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting the issue. We certainly intend TBB to work with gcc 4.3 and SSE. Evidently we are missing a unit test for the situation.
The TBB team will take a look and figure out a fix.
- Arch Robison
The TBB team will take a look and figure out a fix.
- Arch Robison
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Meanwhile, could you please check if the most recent TBB 2.2 update works for you? It would be good to know whether building with a newer version of ICC avoids the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Arch Robison (Intel)
Thanks for reporting the issue. We certainly intend TBB to work with gcc 4.3 and SSE. Evidently we are missing a unit test for the situation.
The TBB team will take a look and figure out a fix.
- Arch Robison
The TBB team will take a look and figure out a fix.
- Arch Robison
Thanks, Arch. I expect we'll get someone to open a QUAD case in the next couple of days. In the mean time, we'll download the latest 2.2 release and give that a spin.
-Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
It's so late in the lifetime of 32-bit linux that I wouldn't count on these discrepancies being resolved. I can't speak for the developers of TBB. Perhaps they didn't consider the possibility of TBB calling a function compiled by 32-bit gcc with use of SSE parallel instructions as a part of the documented compatibility, given the impracticality of dealing with the issue. I would expect it to work if you avoided use of parallel instructions in those functions, or built the entire TBB with gcc, as you indicated.
A possible work-around would be to insert a gcc-compiled intermediate wrapper function which doesn't put any SSE data on its own stack, but implicitly adjusts the stack which it passes down to the functions which require aligned stack. Wrapper functions would be in a separate file in case you invoked gcc function in-lining (e.g. -O3).
A possible work-around would be to insert a gcc-compiled intermediate wrapper function which doesn't put any SSE data on its own stack, but implicitly adjusts the stack which it passes down to the functions which require aligned stack. Wrapper functions would be in a separate file in case you invoked gcc function in-lining (e.g. -O3).
The fix is actually trivial: the TBB shared libraries just need to be compiled with more conservative stack alignment--there's an ICC compiler flag for doing just this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Chris Newbold
Thanks, Arch. I expect we'll get someone to open a QUAD case in the next couple of days. In the mean time, we'll download the latest 2.2 release and give that a spin.
-Chris
Working with Chris, I have opened Intel premier support issue 575013.
--Mark
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page