discopop-project / discopop

DiscoPoP - Discovery of Potential Parallelism
http://www.discopop.org
BSD 3-Clause "New" or "Revised" License
40 stars 22 forks source link

Dependency loss caused by not instrumenting the STL standard library. #665

Open J1372628520 opened 1 month ago

J1372628520 commented 1 month ago

Additionally, we have identified an issue: when the code makes extensive use of the STL standard library, such as smart pointers, if we do not instrument the STL template class libraries, dependency loss occurs. We look forward to your response.

lukasrothenberger commented 1 month ago

hello @J1372628520

this is, if i understand your correctly, expected behavior.

Since only data accesses originating from parts of the code which are instrumented are known to DiscoPoP, data accesses which are caused by other code sections (for example, the STL in your example) can not be known and thus lead to the missed dependencies.

Unfortunately, i do not see a reliable way around this. If you have any suggestions, please let me know!

RainMolisa commented 3 weeks ago

hello @J1372628520

this is, if i understand your correctly, expected behavior.

Since only data accesses originating from parts of the code which are instrumented are known to DiscoPoP, data accesses which are caused by other code sections (for example, the STL in your example) can not be known and thus lead to the missed dependencies.

Unfortunately, i do not see a reliable way around this. If you have any suggestions, please let me know!

I have a suggestion. When the pass find a STL function caller, just insert __dp_read __dp_write for the caller's parameters and skip the STL function's callee.

lukasrothenberger commented 3 weeks ago

Hi @RainMolisa but in case of pointer accesses or similar, this will lead to missed data dependencies as well.

RainMolisa commented 3 weeks ago

Hi @RainMolisa but in case of pointer accesses or similar, this will lead to missed data dependencies as well.

yeah!It's true. However ,the data dependencies in STL case is prior knowledge. For example, in following code you know the 'resize' will read 'b' and write 'vec' and no other data dependencies may lose. (Also, you don't know write 'vec' in where, but user don't care.)

vector<int> vec;
void B(int b)
{
    vec.resize(b);
}

In discopop version 3.2.1, the 'resize' will expand and make may data dependencies which the user don't care. however, if you set DP_PROJECT_ROOT_DIR, you will lose 'vec' 's data dependencies.