forked from openvinotoolkit/nncf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Release] Set environment variable on LNL CPUs before compression mod…
…el compilation (openvinotoolkit#3233) ### Changes Set `export DNNL_MAX_CPU_ISA=AVX2_VNNI` during weights compression on LNL CPUs. ### Reason for changes Fix compression on LNL CPUs. ### Related tickets 161336 ### Tests - https://github.com/openvinotoolkit/nncf/actions/runs/13075940656 ✅ - https://github.com/openvinotoolkit/nncf/actions/runs/13075938396 ✅ - NNCF/job/nightly/job/sdl/job/nightly_trigger/426/ ✅ --------- Co-authored-by: Alexander Suslov <[email protected]>
- Loading branch information
1 parent
cf36f3f
commit bc7c2f1
Showing
6 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2025 Intel Corporation | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import re | ||
|
||
import cpuinfo # type: ignore | ||
|
||
_IS_LNL_CPU = None | ||
|
||
|
||
def is_lnl_cpu() -> bool: | ||
global _IS_LNL_CPU | ||
if _IS_LNL_CPU is None: | ||
_IS_LNL_CPU = re.search(r"Ultra \d 2\d{2}", cpuinfo.get_cpu_info()["brand_raw"]) is not None | ||
return _IS_LNL_CPU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2025 Intel Corporation | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import os | ||
|
||
from nncf.common.utils.helpers import set_env_variable | ||
|
||
|
||
def test_set_env_variable(): | ||
# Test the case when the variable is not set | ||
assert os.environ.get("TEST_VAR") is None | ||
with set_env_variable("TEST_VAR", "test_value"): | ||
assert os.environ.get("TEST_VAR") == "test_value" | ||
assert os.environ.get("TEST_VAR") is None | ||
|
||
# Test the case when the variable is already set | ||
os.environ["TEST_VAR"] = "original_value" | ||
assert os.environ.get("TEST_VAR") == "original_value" | ||
with set_env_variable("TEST_VAR", "test_value"): | ||
assert os.environ.get("TEST_VAR") == "test_value" | ||
assert os.environ.get("TEST_VAR") == "original_value" |