Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[Commit slider] ARM + MAC support (#26591)

Yury Gaydaychuk36f08f921063
diff --git a/src/plugins/intel_cpu/tools/commit_slider/tests/commit_slider_test.py b/src/plugins/intel_cpu/tools/commit_slider/tests/commit_slider_test.py
index a0f7cffc25c..9ebce6ae2b3 100644
--- a/src/plugins/intel_cpu/tools/commit_slider/tests/commit_slider_test.py
+++ b/src/plugins/intel_cpu/tools/commit_slider/tests/commit_slider_test.py
@@ -13,7 +13,7 @@ from test_data import FirstBadVersionData, FirstValidVersionData,\
BmStableData, BmValidatorSteppedBreakData, BmValidatorSteppedBreakData2,\
BenchmarkAppDataUnstable, BenchmarkAppDataStable, BenchmarkAppNoDegradationData,\
BenchmarkAppUnstableDevData, BenchmarkAppWrongPathData, BenchmarkAppPathFoundData,\
- BenchmarkFirstFixedAppData, AcModeData
+ BenchmarkFirstFixedAppData, AcModeData, BenchmarkMetricData
class CommitSliderTest(TestCase):
@@ -60,6 +60,13 @@ class CommitSliderTest(TestCase):
actualCommit, _ = getActualCommit(updatedData)
self.assertEqual(breakCommit, actualCommit)
+ @skip_commit_slider_devtest
+ def testBmLatencyMetric(self):
+ breakCommit, updatedData = getExpectedCommit(
+ BenchmarkMetricData("latency:average"))
+ actualCommit, _ = getActualCommit(updatedData)
+ self.assertEqual(breakCommit, actualCommit)
+
@skip_commit_slider_devtest
def testBmNoDegradation(self):
_, updatedData = getExpectedCommit(
diff --git a/src/plugins/intel_cpu/tools/commit_slider/tests/test_data.py b/src/plugins/intel_cpu/tools/commit_slider/tests/test_data.py
index 4e554a735f1..eed382aba58 100644
--- a/src/plugins/intel_cpu/tools/commit_slider/tests/test_data.py
+++ b/src/plugins/intel_cpu/tools/commit_slider/tests/test_data.py
@@ -65,7 +65,8 @@ class TestData():
BmWrongPath = 10,
BmPathFound = 11,
BmFirstFixed = 12,
- ACModeData = 13
+ BmLatencyMetric = 13,
+ ACModeData = 14
def requireTestData(self, reqLambda):
# mapping json to test data holder
@@ -142,6 +143,32 @@ class BenchmarkFirstFixedAppData(TestData):
requireBinarySearchData
)
+class BenchmarkMetricData(TestData):
+ def getTestCase():
+ return TestData.TestCase.BmLatencyMetric
+
+ def getTestName(self):
+ return "BmLatencyMetric"
+
+ def formatConfig(self, content):
+ # todo - use by-step replacement and super().formatConfig(content)
+ return content.format(
+ appCmd="./{}".format(self.repoName),
+ appPath="tests/{}/build".format(self.repoName),
+ buildPath="tests/{}/build".format(self.repoName),
+ gitPath="tests/{}".format(self.repoName),
+ start=self.start,
+ end=self.end,
+ metric=self.metric
+ )
+
+ def __init__(self, metric: str):
+ from test_util import requireBinarySearchData
+ self.requireTestData(
+ requireBinarySearchData
+ )
+ self.metric = metric
+
class BenchmarkAppNoDegradationData(TestData):
def getTestCase():
return TestData.TestCase.BmNoDegradation
diff --git a/src/plugins/intel_cpu/tools/commit_slider/tests/tests_res/fbv_bm_latency.cpp b/src/plugins/intel_cpu/tools/commit_slider/tests/tests_res/fbv_bm_latency.cpp
new file mode 100644
index 00000000000..093327d02a0
--- /dev/null
+++ b/src/plugins/intel_cpu/tools/commit_slider/tests/tests_res/fbv_bm_latency.cpp
@@ -0,0 +1,42 @@
+#include <iostream>
+
+int main () {
+ const char *patchGenerator = R"V0G0N(
+[
+ {
+ "str": "std::cout << \"Latency:\\nAverage: 700.0 ms\\n\";",
+ "comment": "success_1"
+ },
+ {
+ "str": "std::cout << \"Latency:\\nAverage: 700.0 ms\\n\";",
+ "comment": "success_2"
+ },
+ {
+ "str": "std::cout << \"Latency:\\nAverage: 500.0 ms\\n\";",
+ "comment": "error_1",
+ "state": "BREAK"
+ },
+ {
+ "str": "std::cout << \"Latency:\\nAverage: 500.0 ms\\n\";",
+ "comment": "error_2"
+ },
+ {
+ "str": "std::cout << \"Latency:\\nAverage: 500.0 ms\\n\";",
+ "comment": "error_1"
+ },
+ {
+ "str": "std::cout << \"Latency:\\nAverage: 500.0 ms\\n\";",
+ "comment": "error_2"
+ },
+ {
+ "str": "std::cout << \"Latency:\\nAverage: 500.0 ms\\n\";",
+ "comment": "error_1"
+ },
+ {
+ "str": "std::cout << \"Latency:\\nAverage: 500.0 ms\\n\";",
+ "comment": "error_2"
+ }
+]
+)V0G0N";
+ return 0;
+}
\ No newline at end of file
diff --git a/src/plugins/intel_cpu/tools/commit_slider/tests/tests_res/tests_res.json b/src/plugins/intel_cpu/tools/commit_slider/tests/tests_res/tests_res.json
index ca2f8f2609d..008b762e781 100644
--- a/src/plugins/intel_cpu/tools/commit_slider/tests/tests_res/tests_res.json
+++ b/src/plugins/intel_cpu/tools/commit_slider/tests/tests_res/tests_res.json
@@ -191,6 +191,26 @@
}
}
},
+ "BmLatencyMetric": {
+ "repoName": "BmLatencyMetric",
+ "patchedFile": "tests_res/fbv_bm_latency.cpp",
+ "testCfg": {
+ "appCmd" : "{appCmd}",
+ "appPath": "{appPath}",
+ "gitPath" : "{gitPath}",
+ "buildPath" : "{buildPath}",
+ "verboseOutput": false,
+ "runConfig" : {
+ "commitList" : {
+ "getCommitListCmd" : "git log {start}..{end} --boundary --pretty=\"%h\""
+ },
+ "mode" : "bmPerf",
+ "traversal" : "firstFailedVersion",
+ "perfAppropriateDeviation" : 0.05,
+ "metric": "{metric}"
+ }
+ }
+ },
"FirstValidVersion": {
"repoName": "firstValidVersion",
"patchedFile": "tests_res/fvv_main.cpp",
diff --git a/src/plugins/intel_cpu/tools/commit_slider/utils/cfg.json b/src/plugins/intel_cpu/tools/commit_slider/utils/cfg.json
index 444e04d8177..d31439f1a54 100644
--- a/src/plugins/intel_cpu/tools/commit_slider/utils/cfg.json
+++ b/src/plugins/intel_cpu/tools/commit_slider/utils/cfg.json
@@ -84,6 +84,7 @@
"venvDir": "{workPath}/venv/",
"venvName": "tempVenv"
},
+ "buildEnvVars": [],
"preliminaryCheckCfg": {
"leftCheck": true,
"rightCheck": false,
diff --git a/src/plugins/intel_cpu/tools/commit_slider/utils/cfg_samples/bm_arm_mac.json b/src/plugins/intel_cpu/tools/commit_slider/utils/cfg_samples/bm_arm_mac.json
new file mode 100644
index 00000000000..f8e2007720d
--- /dev/null
+++ b/src/plugins/intel_cpu/tools/commit_slider/utils/cfg_samples/bm_arm_mac.json
@@ -0,0 +1,20 @@
+{
+ "buildEnvVars" : [
+ {"name" : "ALL_PROXY", "val" : "<path_1>"},
+ {"name" : "http_proxy", "val" : "<path_2>"},
+ {"name" : "https_proxy", "val" : "<path_3>"}
+ ],
+ "appCmd" : "./benchmark_app -m <model_path> -d CPU -hint latency -inference_only=false -t 60",
+ "makeCmd" : "cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=OFF -DTHREADING=TBB -DENABLE_INTEL_GPU=OFF -DENABLE_SAMPLES=ON -DENABLE_TESTS=OFF -DENABLE_HETERO=OFF -DENABLE_TEMPLATE=OFF -DENABLE_CPU_DEBUG_CAPS=OFF -DENABLE_DEBUG_CAPS=OFF -DENABLE_OPENVINO_DEBUG=OFF -DCMAKE_CXX_FLAGS=-Wno-deprecated -DCMAKE_C_FLAGS=-Wno-deprecated -DCMAKE_CXX_FLAGS=-Wno-deprecated-declarations -DCMAKE_C_FLAGS=-Wno-deprecated-declarations ..",
+ "appPath" : "../../../../../bin/arm64/Release/",
+ "runConfig" : {
+ "commitList" : {
+ "getCommitListCmd" : "git log <start>..<end> --boundary --pretty=\"%h\""
+ },
+ "mode" : "bmPerf",
+ "traversal" : "firstFixedVersion",
+ "perfAppropriateDeviation" : 0.1,
+ "metric": "latency:average"
+ },
+ "verboseOutput" : true
+}
\ No newline at end of file
diff --git a/src/plugins/intel_cpu/tools/commit_slider/utils/helpers.py b/src/plugins/intel_cpu/tools/commit_slider/utils/helpers.py
index 8185946c1ae..970974637bd 100644
--- a/src/plugins/intel_cpu/tools/commit_slider/utils/helpers.py
+++ b/src/plugins/intel_cpu/tools/commit_slider/utils/helpers.py
@@ -112,7 +112,7 @@ def getBlobDiff(file1, file2):
def absolutizePaths(cfg):
pl = sys.platform
- if pl == "linux" or pl == "linux2":
+ if pl in ["linux", "linux2", "darwin"]:
cfg["workPath"] = cfg["linWorkPath"]
cfg["os"] = "linux"
elif pl == "win32":
@@ -198,6 +198,12 @@ def runCommandList(commit, cfgData):
gitPath = cfgData["gitPath"]
buildPath = cfgData["buildPath"]
defRepo = gitPath
+ newEnv = os.environ.copy()
+ if "buildEnvVars" in cfgData:
+ for env in cfgData["buildEnvVars"]:
+ envKey = env["name"]
+ envVal = env["val"]
+ newEnv[envKey] = envVal
for cmd in commandList:
if "tag" in cmd:
if cmd["tag"] == "preprocess":
@@ -241,7 +247,8 @@ def runCommandList(commit, cfgData):
proc = subprocess.Popen(
formattedCmd, cwd=cwd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
- encoding="utf-8", errors="replace"
+ encoding="utf-8", errors="replace",
+ env=newEnv
)
for line in proc.stdout:
if cfgData["verboseOutput"]:
diff --git a/src/plugins/intel_cpu/tools/commit_slider/utils/modes.py b/src/plugins/intel_cpu/tools/commit_slider/utils/modes.py
index 5e77ed1e02d..45133e82915 100644
--- a/src/plugins/intel_cpu/tools/commit_slider/utils/modes.py
+++ b/src/plugins/intel_cpu/tools/commit_slider/utils/modes.py
@@ -89,7 +89,6 @@ class CheckOutputMode(Mode):
class BenchmarkAppPerformanceMode(Mode):
def __init__(self, cfg):
super().__init__(cfg)
- self.outPattern = "Throughput:\s*([0-9]*[.][0-9]*)\s*FPS"
self.perfRel = 0
self.createCash()
@@ -128,6 +127,31 @@ class BenchmarkAppPerformanceMode(Mode):
raise CfgError("Appropriate deviation is not configured")
else:
self.apprDev = cfg["runConfig"]["perfAppropriateDeviation"]
+ if ("metric" in cfg["runConfig"]):
+ self.outPattern = self.specifyMetric(cfg["runConfig"]["metric"])
+ else:
+ self.outPattern = self.specifyMetric()
+
+
+ def specifyMetric(self, metric: str = "throughput"):
+ if metric in [
+ "throughput",
+ "latency:max",
+ "latency:min",
+ "latency:median",
+ "latency:average"]:
+ spec = metric.split(":")
+ idStr = "FPS"
+ if len(spec) == 2:
+ spec = spec[1]
+ idStr = "ms"
+ else:
+ spec = spec[0]
+ spec = spec.title()
+ res = r'{spec}:\s*([0-9]*[.][0-9]*)\s*{idStr}'.format(
+ spec=spec, idStr=idStr)
+ return res
+ raise CfgError("Benchmark metric {} is not supported".format(metric))
def preliminaryCheck(self, list, cfg):
# model path checking