Skip to content

Commit

Permalink
[Commit Slider] AC mode extended (#26497)
Browse files Browse the repository at this point in the history
### Details:
 - *item1*
 - *...*

### Tickets:
 - *ticket-id*
  • Loading branch information
yury-intel authored Nov 29, 2024
1 parent 03aa902 commit 096cde3
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
BenchmarkAppDataUnstable, BenchmarkAppDataStable, BenchmarkAppNoDegradationData,\
BenchmarkAppUnstableDevData, BenchmarkAppWrongPathData, BenchmarkAppPathFoundData,\
BenchmarkFirstFixedAppData, AcModeData, BenchmarkMetricData, CustomizedLogData, \
MultiConfigData, ConfigMultiplicatorData, ConfigMultiplicatorWithKeyData
MultiConfigData, ConfigMultiplicatorData, ConfigMultiplicatorWithKeyData, \
AcModeDataBitwise

class CommitSliderTest(TestCase):
@skip_commit_slider_devtest
Expand Down Expand Up @@ -81,9 +82,9 @@ def testBmStable(self):
self.assertEqual(breakCommit, actualCommit)

@skip_commit_slider_devtest
def testACMode(self):
def testACModeBitwise(self):
breakCommit, updatedData = getExpectedCommit(
AcModeData())
AcModeDataBitwise())
actualCommit, _ = getActualCommit(updatedData)
self.assertEqual(breakCommit, actualCommit)

Expand Down
16 changes: 15 additions & 1 deletion src/plugins/intel_cpu/tools/commit_slider/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class TestCase(Enum):
CustomizedLog = 15,
MultiConfig = 16,
ConfigMultiplicator = 17,
MultiConfigWithKey = 18
MultiConfigWithKey = 18,
AcModeDataBitwise = 19

def requireTestData(self, reqLambda):
# mapping json to test data holder
Expand Down Expand Up @@ -190,6 +191,19 @@ def __init__(self):
requireBinarySearchData
)

class AcModeDataBitwise(TestData):
def getTestCase():
return TestData.TestCase.AcModeDataBitwise

def getTestName(self):
return "ACMode"

def __init__(self):
from test_util import requireBinarySearchData
self.requireTestData(
requireBinarySearchData
)

class BenchmarkFirstFixedAppData(TestData):
def getTestCase():
return TestData.TestCase.BmFirstFixed
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <iostream>

int main () {
const char *patchGenerator = R"V0G0N(
[
{
"str": "std::cout << \"prefix\\Perplexity: 100.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
"comment": "success_1"
},
{
"str": "std::cout << \"prefix\\Perplexity: 100.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
"comment": "success_2"
},
{
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
"comment": "error_1",
"state": "BREAK"
},
{
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
"comment": "error_2"
},
{
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
"comment": "error_1"
},
{
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
"comment": "error_2"
},
{
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
"comment": "error_1"
},
{
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
"comment": "error_2"
}
]
)V0G0N";
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,27 @@
}
}
},
"ACModeBitwise": {
"repoName": "ACModeBitwise",
"patchedFile": "tests_res/fbv_ac_mode_bitwise.cpp",
"testCfg": {
"appCmd" : "{appCmd}",
"appPath": "{appPath}",
"gitPath" : "{gitPath}",
"buildPath" : "{buildPath}",
"verboseOutput": false,
"runConfig" : {
"commitList" : {
"getCommitListCmd" : "git log {start}..{end} --boundary --pretty=\"%h\""
},
"mode" : "ac",
"traversal" : "firstFailedVersion",
"threshold": "80%"
}
}
},
"ACMode": {
"repoName": "BmBinarySearchUnstable",
"repoName": "ACMode",
"patchedFile": "tests_res/fbv_ac_mode.cpp",
"testCfg": {
"appCmd" : "{appCmd}",
Expand All @@ -359,7 +378,7 @@
"getCommitListCmd" : "git log {start}..{end} --boundary --pretty=\"%h\""
},
"mode" : "ac",
"traversal" : "firstFailedVersion",
"traversal" : "allBreaks",
"threshold": "80%"
}
}
Expand Down
36 changes: 14 additions & 22 deletions src/plugins/intel_cpu/tools/commit_slider/utils/modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class AccuracyCheckerMode(Mode):
def __init__(self, cfg):
super().__init__(cfg)
self.thresholdPattern = ":\s([0-9]*[.][0-9]*)%.*abs error"
self.breakThroughput = 0
self.curMetric = None
self.createCash()

def prepareRun(self, list, cfg):
Expand Down Expand Up @@ -317,29 +317,21 @@ def prepareRun(self, list, cfg):
self.sampleThroughput = float(foundThroughput)
return list

def checkCfg(self, cfg):
super().checkCfg(cfg)
if not ("threshold" in cfg["runConfig"]):
raise CfgError("Threshold is not configured")
else:
self.threshold = cfg["runConfig"]["threshold"]
self.threshold = float(self.threshold.strip('%'))


def compareCommits(self, lCommit: str, rCommit: str, cfg: map):
leftThroughput = self.getPseudoMetric(lCommit, cfg)
rightThroughput = self.getPseudoMetric(rCommit, cfg)
isLeftGood = leftThroughput >= float(self.threshold)
isRightGood = rightThroughput >= float(self.threshold)
if not isRightGood:
self.breakThroughput = rightThroughput
leftMetric = self.getPseudoMetric(lCommit, cfg)
rightMetric = self.getPseudoMetric(rCommit, cfg)
isDiff = leftMetric != rightMetric
if isDiff:
self.curMetric = rightMetric
curCommit = rCommit.replace('"', "")
commitLogger = getCommitLogger(cfg, curCommit)
commitLogger.info("Current accuracy is {}%".format(rightThroughput))
commitLogger.info("Current accuracy is {}%".format(rightMetric))
commitLogger.info(
"Commit is {status}".format(status=("bad" if isRightGood else "good"))
"Commit {status} from {c}".format(
status=("differs" if isDiff else "doesn't differ"),
c=lCommit)
)
return isLeftGood != isRightGood
return isDiff

def getPseudoMetric(self, commit, cfg):
commit = commit.replace('"', "")
Expand Down Expand Up @@ -372,12 +364,12 @@ def getPseudoMetric(self, commit, cfg):
return curThroughput

def setOutputInfo(self, pathCommit):
pathCommit.breakThroughput = self.breakThroughput
pathCommit.metric = self.curMetric

def getCommitInfo(self, commit):
return "{ci}, throughput = {d}".format(
return "{ci}, metric = {d}".format(
ci=super().getCommitInfo(commit),
d=commit.breakThroughput)
d=commit.metric)


class CompareBlobsMode(Mode):
Expand Down

0 comments on commit 096cde3

Please sign in to comment.