Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
5135 Discussions

Inspector taking too long with memset but only with 32-bit builds

Steve_H
Novice
4,171 Views

Hi,

I have just upgraded from a 2019 version of Inspector to 2023.0, running on Windows 10 with MSVS2019. It is definitely improved but I have encountered one very significant regression.

When running it on unit-tests that memset structures of fairly significant size to zero before running a test (to avoid uninitialized memory use), there is no problem with 64-bit builds but, with 32-bit builds, the time taken to run the test suite goes from a few 10s of seconds to over 30 minutes (at which point the test suite is terminated.)

I have written a fairly basic replacement for memset and the time drops right back down again but, using memset and breaking in the debugger, it seems that the issue is with the "REP STOSB" instruction in the standard library. The test suite seems to be "hung" - or possibly making progress but very, very slowly - on that instruction.

Is this a known issue? I there a work around for it (other than having to rewrite memset!)?

Many thanks in advance for any help,

Steve.

0 Kudos
15 Replies
Ruslan_M_Intel
Employee
4,158 Views

Hi Steve,

 

No, it doesn't look like known issue. Could you please share application sample you are using? (source file if possible + build options you used + exact compiler version). If you can't share the whole app please share a code snippet which triggers the problem.

 

Ruslan

0 Kudos
Steve_H
Novice
4,139 Views

Hi Ruslan,

 

I've managed to produce a stripped down test case that exhibits the problem:

#include "CppUTest/TestHarness.h"

TEST_GROUP(MyCode)
{
   int Foo[100000];
   void setup()
   {
      memset(&Foo, 0, sizeof (Foo));
   }

   void teardown()
   {
   }
};

TEST(MyCode, test1)
{
}

When built as 64-bit, this runs in 180ms:

##teamcity[testSuiteStarted name='MyCode']
##teamcity[testStarted name='test1']
##teamcity[testFinished name='test1' duration='180']
##teamcity[testSuiteFinished name='MyCode']

However, build as 32-bit and it takes nearly 3 minutes:

##teamcity[testSuiteStarted name='MyCode']
##teamcity[testStarted name='test1']
##teamcity[testFinished name='test1' duration='171888']
##teamcity[testSuiteFinished name='MyCode']

FYI, we are building with MSVS version 16.10.31410.357 (a.k.a. 16.10.2):

Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30038.1 for x86

The compile and link options are the same for both builds:

cl /c foo.cpp /TP /Ob0 /Oy- /Z7 /MT /W3 /EHs /wd4312 /wd4477 /wd4313 /wd4838 /nologo <defines> <includes>
link /DYNAMICBASE:NO /DEBUG /OPT:REF /OPT:ICF /nologo /incremental:no /LARGEADDRESSAWARE /NXCOMPAT /MACHINE:X86 /OUT:foo_unittest.exe winmm.lib psapi.lib legacy_stdio_definitions.lib /PDB:foo_unittest.pdb /DEBUG <object files>

Please let me know if there is anything else that I can do to help diagnose the issue.

 

Thanks,

 

Steve.

Ruslan_M_Intel
Employee
4,127 Views

Hi Steve. Thanks for the detailed answer! Have you noticed the same behavior using another compilers? Gcc or Intel Compiler?

 

 

0 Kudos
Steve_H
Novice
4,116 Views

I'm afraid that we only use the Microsoft compiler. However, I was able to get it to build with a 2017 version of MSVS:

Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26732.1 for x86

The results were the same so, although it might or might not be MSVS specific, it is certainly not related to a single version of the compiler.

 

Thanks,

 

S.

0 Kudos
Ruslan_M_Intel
Employee
3,830 Views

Hi Steve,

 

Thank you! I believe the scenario is clear enough to start working with it. I will keep you updated

 

Best regards,

Ruslan

0 Kudos
DiyaN_Intel
Moderator
3,938 Views

Hi, 


We are investigating your issue at our end and working on this internally. We will get back to you with an update soon.


Regards, 

Diya


DiyaN_Intel
Moderator
3,895 Views

Hi , 

 

Could you please share the following details so that it helps to investigate from our end- 

 

1. Complete reproducer code that can be compiled and run to verify behavior.

 

2. Exact steps and the commands used.

 

3. OS details.

 

Regards,

Diya

 

0 Kudos
DiyaN_Intel
Moderator
3,849 Views

Hi, 


Good day to you.


We have not heard back from you.


Could you please share the above mentioned details so that we can try to fix the issue from our end.


Regards,

Diya


0 Kudos
Steve_H
Novice
3,835 Views

Hi Diya,

 

Sorry, I have been trying to get to this but have been really busy with other things. I will try to get on to this today. In the meantime, here is what I can give you immediately:

  1. I have given a heavily trimmed down reproducer above; is that not enough?
  2. Will have to get back to you on this; I didn't write the infrastructure that supports Inspector
  3. Here is the Windows version that I am using:
    Edition Windows 10 Enterprise
    Version 22H2
    OS build 19045.2486
    Experience Windows Feature Experience Pack 120.2212.4190.0

 

Regards,

 

S.

0 Kudos
Steve_H
Novice
3,808 Views

Hi Diya,

 

I've tracked down the command line used when we are running Inspector:

inspxe-cl.exe -user-data-dir=<dir> -collect mi3 -knob detect-invalid-accesses=true -knob analyze-stack=false -knob detect-leaks-on-exit=false -knob detect-resource-leaks=false -knob enable-memory-growth-detection=false -knob enable-on-demand-leak-detection=false -knob remove-duplicates=true -knob still-allocated-memory=false -knob stack-depth=32 -module-filter-mode=include -s-f <suppression file> -r <results dir> -- <executable to run> <arguments for the executable ...>

I hope that helps you get further with this.

 

Regards,

 

S.

DiyaN_Intel
Moderator
3,695 Views

Hi,


Thanks for reporting this issue. 


We were able to reproduce it and we have informed the development team about it.


The engineering team has confirmed it as a bug and we are working on this internally.


We will get back to you with an update soon.


Regards,

Diya



0 Kudos
Steve_H
Novice
3,683 Views

Great news! Thanks for the update.

 

S.

0 Kudos
Steve_H
Novice
3,323 Views


> The engineering team has confirmed it as a bug and we are working on this internally.

 

@DiyaN_Intel, have you got any idea when we might see a fix for this bug in a release of Inspector?

0 Kudos
DiyaN_Intel
Moderator
3,310 Views

Hi,


Good day to you.

Thank you for your patience. Our dev team is working on your issue and currently, we don't have any ETA on when the fix will be implemented.

We will notify you once we have an update on this thread.

Sorry for the inconvenience caused.


Thanks and Regards,

Diya


0 Kudos
DiyaN_Intel
Moderator
2,993 Views

Hi,

 

Thanks for your patience.

We are sorry to inform you that the issue you reported is no longer targeted for fixes.

Please check out the new versions of Intel Inspector for many other latest features. 

Apologies for the inconvenience caused.

This thread will no longer be monitored by Intel.

If you need further assistance, please post a new question.

 

Regards,

Diya

 

0 Kudos
Reply