- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a MT C# application that suffers from significant 64K aliasing conflicts with HT. The C# equivalent of alloca seems to be stackalloc. stackalloc requires me to declare my code unsafe. Does anyone have a workaround where I can avoid 64K aliasing conflicts with HT without using stackalloc?
Thanks for the help.
Srini
krishnamurthy.srinivasan@intel.com
Thanks for the help.
Srini
krishnamurthy.srinivasan@intel.com
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Srini -
I've posed your question to Arch Robison, one of the engineers here at KSL that has been looking at C# for some time, and his response was:
If the thread executes a small recursive routine first, and the base case of the recursion does the real work of interest, then the number of recursions could be used to control the stack offset, albeit not to as high a degree of control as with stackalloc.
As an example, he gave the following pseudo-code.
Each thread calling stack_waster() would need to use a different value of i.
-- clay
I've posed your question to Arch Robison, one of the engineers here at KSL that has been looking at C# for some time, and his response was:
If the thread executes a small recursive routine first, and the base case of the recursion does the real work of interest, then the number of recursions could be used to control the stack offset, albeit not to as high a degree of control as with stackalloc.
As an example, he gave the following pseudo-code.
int stack_waster( int i ) { // Wastes i stack frames. if( i>0 ) return 1+stack_waster(i-1); // Thwart tail-call optimization else { // base case do_work_that_was_trying_to_avoid_64k_aliasing_issue; return 0; } }
Each thread calling stack_waster() would need to use a different value of i.
-- clay
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