Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and Update PAMM #655

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ if (NOT PHASAR_ENABLE_PAMM)
set_property(CACHE PHASAR_ENABLE_PAMM PROPERTY STRINGS "Off" "Core" "Full")
endif()
if(PHASAR_ENABLE_PAMM STREQUAL "Core" AND NOT PHASAR_BUILD_UNITTESTS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPAMM_CORE")
message("PAMM metric severity level: Core")
add_compile_definitions(PAMM_CORE)
message(STATUS "PAMM metric severity level: Core")
elseif(PHASAR_ENABLE_PAMM STREQUAL "Full" AND NOT PHASAR_BUILD_UNITTESTS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPAMM_FULL")
message("PAMM metric severity level: Full")
elseif(PHASAR_BUILD_UNITTESTS)
message("PAMM metric severity level: Off (due to unittests)")
add_compile_definitions(PAMM_FULL)
message(STATUS "PAMM metric severity level: Full")
elseif(PHASAR_BUILD_UNITTESTS AND (PHASAR_ENABLE_PAMM STREQUAL "Core" OR PHASAR_ENABLE_PAMM STREQUAL "Full"))
message(WARNING "PAMM metric severity level: Off (due to unittests)")
else()
message("PAMM metric severity level: Off")
message(STATUS "PAMM metric severity level: Off")
endif()

option(PHASAR_ENABLE_DYNAMIC_LOG "Makes it possible to switch the logger on and off at runtime (default is ON)" ON)
Expand Down
82 changes: 41 additions & 41 deletions include/phasar/DataFlow/IfdsIde/Solver/FlowEdgeFunctionCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,35 +144,35 @@ class FlowEdgeFunctionCache {
AutoAddZero(Problem.getIFDSIDESolverConfig().autoAddZero()),
ZV(Problem.getZeroValue()) {
PAMM_GET_INSTANCE;
REG_COUNTER("Normal-FF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Normal-FF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Normal-FF Construction", 0, Full);
REG_COUNTER("Normal-FF Cache Hit", 0, Full);
// Counters for the call flow functions
REG_COUNTER("Call-FF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Call-FF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Call-FF Construction", 0, Full);
REG_COUNTER("Call-FF Cache Hit", 0, Full);
// Counters for return flow functions
REG_COUNTER("Return-FF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Return-FF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Return-FF Construction", 0, Full);
REG_COUNTER("Return-FF Cache Hit", 0, Full);
// Counters for the call to return flow functions
REG_COUNTER("CallToRet-FF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("CallToRet-FF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("CallToRet-FF Construction", 0, Full);
REG_COUNTER("CallToRet-FF Cache Hit", 0, Full);
// Counters for the summary flow functions
REG_COUNTER("Summary-FF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Summary-FF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Summary-FF Construction", 0, Full);
REG_COUNTER("Summary-FF Cache Hit", 0, Full);
// Counters for the normal edge functions
REG_COUNTER("Normal-EF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Normal-EF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Normal-EF Construction", 0, Full);
REG_COUNTER("Normal-EF Cache Hit", 0, Full);
// Counters for the call edge functions
REG_COUNTER("Call-EF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Call-EF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Call-EF Construction", 0, Full);
REG_COUNTER("Call-EF Cache Hit", 0, Full);
// Counters for the return edge functions
REG_COUNTER("Return-EF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Return-EF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Return-EF Construction", 0, Full);
REG_COUNTER("Return-EF Cache Hit", 0, Full);
// Counters for the call to return edge functions
REG_COUNTER("CallToRet-EF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("CallToRet-EF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("CallToRet-EF Construction", 0, Full);
REG_COUNTER("CallToRet-EF Cache Hit", 0, Full);
// Counters for the summary edge functions
REG_COUNTER("Summary-EF Construction", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Summary-EF Cache Hit", 0, PAMM_SEVERITY_LEVEL::Full);
REG_COUNTER("Summary-EF Construction", 0, Full);
REG_COUNTER("Summary-EF Cache Hit", 0, Full);
}

~FlowEdgeFunctionCache() = default;
Expand All @@ -194,7 +194,7 @@ class FlowEdgeFunctionCache {
auto SearchNormalFlowFunction = NormalFunctionCache.find(Key);
if (SearchNormalFlowFunction != NormalFunctionCache.end()) {
PHASAR_LOG_LEVEL(DEBUG, "Flow function fetched from cache");
INC_COUNTER("Normal-FF Cache Hit", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Normal-FF Cache Hit", 1, Full);
if (SearchNormalFlowFunction->second.FlowFuncPtr != nullptr) {
return SearchNormalFlowFunction->second.FlowFuncPtr;
}
Expand All @@ -205,7 +205,7 @@ class FlowEdgeFunctionCache {
SearchNormalFlowFunction->second.FlowFuncPtr = FF;
return FF;
}
INC_COUNTER("Normal-FF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Normal-FF Construction", 1, Full);
auto FF = (AutoAddZero)
? std::make_shared<ZeroedFlowFunction<d_t, Container>>(
Problem.getNormalFlowFunction(Curr, Succ), ZV)
Expand All @@ -227,10 +227,10 @@ class FlowEdgeFunctionCache {
auto SearchCallFlowFunction = CallFlowFunctionCache.find(Key);
if (SearchCallFlowFunction != CallFlowFunctionCache.end()) {
PHASAR_LOG_LEVEL(DEBUG, "Flow function fetched from cache");
INC_COUNTER("Call-FF Cache Hit", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Call-FF Cache Hit", 1, Full);
return SearchCallFlowFunction->second;
}
INC_COUNTER("Call-FF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Call-FF Construction", 1, Full);
auto FF = (AutoAddZero)
? std::make_shared<ZeroedFlowFunction<d_t, Container>>(
Problem.getCallFlowFunction(CallSite, DestFun), ZV)
Expand All @@ -257,10 +257,10 @@ class FlowEdgeFunctionCache {
auto SearchReturnFlowFunction = ReturnFlowFunctionCache.find(Key);
if (SearchReturnFlowFunction != ReturnFlowFunctionCache.end()) {
PHASAR_LOG_LEVEL(DEBUG, "Flow function fetched from cache");
INC_COUNTER("Return-FF Cache Hit", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Return-FF Cache Hit", 1, Full);
return SearchReturnFlowFunction->second;
}
INC_COUNTER("Return-FF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Return-FF Construction", 1, Full);
auto FF = (AutoAddZero)
? std::make_shared<ZeroedFlowFunction<d_t, Container>>(
Problem.getRetFlowFunction(CallSite, CalleeFun,
Expand Down Expand Up @@ -291,10 +291,10 @@ class FlowEdgeFunctionCache {
auto SearchCallToRetFlowFunction = CallToRetFlowFunctionCache.find(Key);
if (SearchCallToRetFlowFunction != CallToRetFlowFunctionCache.end()) {
PHASAR_LOG_LEVEL(DEBUG, "Flow function fetched from cache");
INC_COUNTER("CallToRet-FF Cache Hit", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("CallToRet-FF Cache Hit", 1, Full);
return SearchCallToRetFlowFunction->second;
}
INC_COUNTER("CallToRet-FF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("CallToRet-FF Construction", 1, Full);
auto FF =
(AutoAddZero)
? std::make_shared<ZeroedFlowFunction<d_t, Container>>(
Expand All @@ -308,7 +308,7 @@ class FlowEdgeFunctionCache {

FlowFunctionPtrType getSummaryFlowFunction(n_t CallSite, f_t DestFun) {
// PAMM_GET_INSTANCE;
// INC_COUNTER("Summary-FF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
// INC_COUNTER("Summary-FF Construction", 1, Full);
IF_LOG_ENABLED(
PHASAR_LOG_LEVEL(DEBUG, "Summary flow function factory call");
PHASAR_LOG_LEVEL(DEBUG,
Expand Down Expand Up @@ -338,13 +338,13 @@ class FlowEdgeFunctionCache {
auto SearchEdgeFunc = SearchInnerMap->second.EdgeFunctionMap.find(
createEdgeFunctionNodeKey(CurrNode, SuccNode));
if (SearchEdgeFunc != SearchInnerMap->second.EdgeFunctionMap.end()) {
INC_COUNTER("Normal-EF Cache Hit", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Normal-EF Cache Hit", 1, Full);
PHASAR_LOG_LEVEL(DEBUG, "Edge function fetched from cache");
PHASAR_LOG_LEVEL(DEBUG,
"Provide Edge Function: " << SearchEdgeFunc->second);
return SearchEdgeFunc->second;
}
INC_COUNTER("Normal-EF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Normal-EF Construction", 1, Full);
auto EF = Problem.getNormalEdgeFunction(Curr, CurrNode, Succ, SuccNode);

SearchInnerMap->second.EdgeFunctionMap.insert(
Expand All @@ -354,7 +354,7 @@ class FlowEdgeFunctionCache {
PHASAR_LOG_LEVEL(DEBUG, "Provide Edge Function: " << EF);
return EF;
}
INC_COUNTER("Normal-EF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Normal-EF Construction", 1, Full);
auto EF = Problem.getNormalEdgeFunction(Curr, CurrNode, Succ, SuccNode);

NormalFunctionCache.try_emplace(
Expand Down Expand Up @@ -383,13 +383,13 @@ class FlowEdgeFunctionCache {
auto Key = std::tie(CallSite, SrcNode, DestinationFunction, DestNode);
auto SearchCallEdgeFunction = CallEdgeFunctionCache.find(Key);
if (SearchCallEdgeFunction != CallEdgeFunctionCache.end()) {
INC_COUNTER("Call-EF Cache Hit", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Call-EF Cache Hit", 1, Full);
PHASAR_LOG_LEVEL(DEBUG, "Edge function fetched from cache");
PHASAR_LOG_LEVEL(
DEBUG, "Provide Edge Function: " << SearchCallEdgeFunction->second);
return SearchCallEdgeFunction->second;
}
INC_COUNTER("Call-EF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Call-EF Construction", 1, Full);
auto EF = Problem.getCallEdgeFunction(CallSite, SrcNode,
DestinationFunction, DestNode);
CallEdgeFunctionCache.insert(std::make_pair(Key, EF));
Expand Down Expand Up @@ -420,13 +420,13 @@ class FlowEdgeFunctionCache {
RetNode);
auto SearchReturnEdgeFunction = ReturnEdgeFunctionCache.find(Key);
if (SearchReturnEdgeFunction != ReturnEdgeFunctionCache.end()) {
INC_COUNTER("Return-EF Cache Hit", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Return-EF Cache Hit", 1, Full);
PHASAR_LOG_LEVEL(DEBUG, "Edge function fetched from cache");
PHASAR_LOG_LEVEL(
DEBUG, "Provide Edge Function: " << SearchReturnEdgeFunction->second);
return SearchReturnEdgeFunction->second;
}
INC_COUNTER("Return-EF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Return-EF Construction", 1, Full);
auto EF = Problem.getReturnEdgeFunction(CallSite, CalleeFunction, ExitInst,
ExitNode, RetSite, RetNode);
ReturnEdgeFunctionCache.insert(std::make_pair(Key, EF));
Expand Down Expand Up @@ -462,13 +462,13 @@ class FlowEdgeFunctionCache {
auto SearchEdgeFunc = SearchInnerMap->second.find(
createEdgeFunctionNodeKey(CallNode, RetSiteNode));
if (SearchEdgeFunc != SearchInnerMap->second.end()) {
INC_COUNTER("CallToRet-EF Cache Hit", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("CallToRet-EF Cache Hit", 1, Full);
PHASAR_LOG_LEVEL(DEBUG, "Edge function fetched from cache");
PHASAR_LOG_LEVEL(DEBUG,
"Provide Edge Function: " << SearchEdgeFunc->second);
return SearchEdgeFunc->second;
}
INC_COUNTER("CallToRet-EF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("CallToRet-EF Construction", 1, Full);
auto EF = Problem.getCallToRetEdgeFunction(CallSite, CallNode, RetSite,
RetSiteNode, Callees);

Expand All @@ -480,7 +480,7 @@ class FlowEdgeFunctionCache {
return EF;
}

INC_COUNTER("CallToRet-EF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("CallToRet-EF Construction", 1, Full);
auto EF = Problem.getCallToRetEdgeFunction(CallSite, CallNode, RetSite,
RetSiteNode, Callees);

Expand Down Expand Up @@ -510,13 +510,13 @@ class FlowEdgeFunctionCache {
auto Key = std::tie(CallSite, CallNode, RetSite, RetSiteNode);
auto SearchSummaryEdgeFunction = SummaryEdgeFunctionCache.find(Key);
if (SearchSummaryEdgeFunction != SummaryEdgeFunctionCache.end()) {
INC_COUNTER("Summary-EF Cache Hit", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Summary-EF Cache Hit", 1, Full);
PHASAR_LOG_LEVEL(DEBUG, "Edge function fetched from cache");
PHASAR_LOG_LEVEL(DEBUG, "Provide Edge Function: "
<< SearchSummaryEdgeFunction->second);
return SearchSummaryEdgeFunction->second;
}
INC_COUNTER("Summary-EF Construction", 1, PAMM_SEVERITY_LEVEL::Full);
INC_COUNTER("Summary-EF Construction", 1, Full);
auto EF = Problem.getSummaryEdgeFunction(CallSite, CallNode, RetSite,
RetSiteNode);
SummaryEdgeFunctionCache.insert(std::make_pair(Key, EF));
Expand Down
Loading
Loading