Skip to content

Commit f89b8de

Browse files
authored
[Commit Slider] AC mode extended (#26497)
### Details: - *item1* - *...* ### Tickets: - *ticket-id*
1 parent 2c1287f commit f89b8de

File tree

5 files changed

+96
-28
lines changed

5 files changed

+96
-28
lines changed

src/plugins/intel_cpu/tools/commit_slider/tests/commit_slider_test.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
BenchmarkAppDataUnstable, BenchmarkAppDataStable, BenchmarkAppNoDegradationData,\
1515
BenchmarkAppUnstableDevData, BenchmarkAppWrongPathData, BenchmarkAppPathFoundData,\
1616
BenchmarkFirstFixedAppData, AcModeData, BenchmarkMetricData, CustomizedLogData, \
17-
MultiConfigData, ConfigMultiplicatorData, ConfigMultiplicatorWithKeyData
17+
MultiConfigData, ConfigMultiplicatorData, ConfigMultiplicatorWithKeyData, \
18+
AcModeDataBitwise
1819

1920
class CommitSliderTest(TestCase):
2021
@skip_commit_slider_devtest
@@ -81,9 +82,9 @@ def testBmStable(self):
8182
self.assertEqual(breakCommit, actualCommit)
8283

8384
@skip_commit_slider_devtest
84-
def testACMode(self):
85+
def testACModeBitwise(self):
8586
breakCommit, updatedData = getExpectedCommit(
86-
AcModeData())
87+
AcModeDataBitwise())
8788
actualCommit, _ = getActualCommit(updatedData)
8889
self.assertEqual(breakCommit, actualCommit)
8990

src/plugins/intel_cpu/tools/commit_slider/tests/test_data.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ class TestCase(Enum):
7171
CustomizedLog = 15,
7272
MultiConfig = 16,
7373
ConfigMultiplicator = 17,
74-
MultiConfigWithKey = 18
74+
MultiConfigWithKey = 18,
75+
AcModeDataBitwise = 19
7576

7677
def requireTestData(self, reqLambda):
7778
# mapping json to test data holder
@@ -190,6 +191,19 @@ def __init__(self):
190191
requireBinarySearchData
191192
)
192193

194+
class AcModeDataBitwise(TestData):
195+
def getTestCase():
196+
return TestData.TestCase.AcModeDataBitwise
197+
198+
def getTestName(self):
199+
return "ACMode"
200+
201+
def __init__(self):
202+
from test_util import requireBinarySearchData
203+
self.requireTestData(
204+
requireBinarySearchData
205+
)
206+
193207
class BenchmarkFirstFixedAppData(TestData):
194208
def getTestCase():
195209
return TestData.TestCase.BmFirstFixed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include <iostream>
2+
3+
int main () {
4+
const char *patchGenerator = R"V0G0N(
5+
[
6+
{
7+
"str": "std::cout << \"prefix\\Perplexity: 100.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
8+
"comment": "success_1"
9+
},
10+
{
11+
"str": "std::cout << \"prefix\\Perplexity: 100.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
12+
"comment": "success_2"
13+
},
14+
{
15+
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
16+
"comment": "error_1",
17+
"state": "BREAK"
18+
},
19+
{
20+
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
21+
"comment": "error_2"
22+
},
23+
{
24+
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
25+
"comment": "error_1"
26+
},
27+
{
28+
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
29+
"comment": "error_2"
30+
},
31+
{
32+
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
33+
"comment": "error_1"
34+
},
35+
{
36+
"str": "std::cout << \"prefix\\Perplexity: 50.0% [FAILED: abs error = 9.118 | relative error = 0.3144]\\n\";",
37+
"comment": "error_2"
38+
}
39+
]
40+
)V0G0N";
41+
return 0;
42+
}

src/plugins/intel_cpu/tools/commit_slider/tests/tests_res/tests_res.json

+21-2
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,27 @@
345345
}
346346
}
347347
},
348+
"ACModeBitwise": {
349+
"repoName": "ACModeBitwise",
350+
"patchedFile": "tests_res/fbv_ac_mode_bitwise.cpp",
351+
"testCfg": {
352+
"appCmd" : "{appCmd}",
353+
"appPath": "{appPath}",
354+
"gitPath" : "{gitPath}",
355+
"buildPath" : "{buildPath}",
356+
"verboseOutput": false,
357+
"runConfig" : {
358+
"commitList" : {
359+
"getCommitListCmd" : "git log {start}..{end} --boundary --pretty=\"%h\""
360+
},
361+
"mode" : "ac",
362+
"traversal" : "firstFailedVersion",
363+
"threshold": "80%"
364+
}
365+
}
366+
},
348367
"ACMode": {
349-
"repoName": "BmBinarySearchUnstable",
368+
"repoName": "ACMode",
350369
"patchedFile": "tests_res/fbv_ac_mode.cpp",
351370
"testCfg": {
352371
"appCmd" : "{appCmd}",
@@ -359,7 +378,7 @@
359378
"getCommitListCmd" : "git log {start}..{end} --boundary --pretty=\"%h\""
360379
},
361380
"mode" : "ac",
362-
"traversal" : "firstFailedVersion",
381+
"traversal" : "allBreaks",
363382
"threshold": "80%"
364383
}
365384
}

src/plugins/intel_cpu/tools/commit_slider/utils/modes.py

+14-22
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class AccuracyCheckerMode(Mode):
288288
def __init__(self, cfg):
289289
super().__init__(cfg)
290290
self.thresholdPattern = ":\s([0-9]*[.][0-9]*)%.*abs error"
291-
self.breakThroughput = 0
291+
self.curMetric = None
292292
self.createCash()
293293

294294
def prepareRun(self, list, cfg):
@@ -317,29 +317,21 @@ def prepareRun(self, list, cfg):
317317
self.sampleThroughput = float(foundThroughput)
318318
return list
319319

320-
def checkCfg(self, cfg):
321-
super().checkCfg(cfg)
322-
if not ("threshold" in cfg["runConfig"]):
323-
raise CfgError("Threshold is not configured")
324-
else:
325-
self.threshold = cfg["runConfig"]["threshold"]
326-
self.threshold = float(self.threshold.strip('%'))
327-
328-
329320
def compareCommits(self, lCommit: str, rCommit: str, cfg: map):
330-
leftThroughput = self.getPseudoMetric(lCommit, cfg)
331-
rightThroughput = self.getPseudoMetric(rCommit, cfg)
332-
isLeftGood = leftThroughput >= float(self.threshold)
333-
isRightGood = rightThroughput >= float(self.threshold)
334-
if not isRightGood:
335-
self.breakThroughput = rightThroughput
321+
leftMetric = self.getPseudoMetric(lCommit, cfg)
322+
rightMetric = self.getPseudoMetric(rCommit, cfg)
323+
isDiff = leftMetric != rightMetric
324+
if isDiff:
325+
self.curMetric = rightMetric
336326
curCommit = rCommit.replace('"', "")
337327
commitLogger = getCommitLogger(cfg, curCommit)
338-
commitLogger.info("Current accuracy is {}%".format(rightThroughput))
328+
commitLogger.info("Current accuracy is {}%".format(rightMetric))
339329
commitLogger.info(
340-
"Commit is {status}".format(status=("bad" if isRightGood else "good"))
330+
"Commit {status} from {c}".format(
331+
status=("differs" if isDiff else "doesn't differ"),
332+
c=lCommit)
341333
)
342-
return isLeftGood != isRightGood
334+
return isDiff
343335

344336
def getPseudoMetric(self, commit, cfg):
345337
commit = commit.replace('"', "")
@@ -372,12 +364,12 @@ def getPseudoMetric(self, commit, cfg):
372364
return curThroughput
373365

374366
def setOutputInfo(self, pathCommit):
375-
pathCommit.breakThroughput = self.breakThroughput
367+
pathCommit.metric = self.curMetric
376368

377369
def getCommitInfo(self, commit):
378-
return "{ci}, throughput = {d}".format(
370+
return "{ci}, metric = {d}".format(
379371
ci=super().getCommitInfo(commit),
380-
d=commit.breakThroughput)
372+
d=commit.metric)
381373

382374

383375
class CompareBlobsMode(Mode):

0 commit comments

Comments
 (0)