Skip to content

Commit 50b2b59

Browse files
authored
fix compiler version parsing issue (#4468)
1 parent 9b96efa commit 50b2b59

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

intel_extension_for_pytorch/xpu/cpp_extension.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -820,15 +820,14 @@ def get_compiler_abi_compatibility_and_version(compiler) -> Tuple[bool, TorchVer
820820
versionstr = subprocess.check_output(
821821
[compiler, "-dumpfullversion", "-dumpversion"]
822822
)
823-
version = versionstr.decode(*SUBPROCESS_DECODE_ARGS).strip().split(".")
824823
else:
825824
minimum_required_version = MINIMUM_MSVC_VERSION
826-
compiler_info = subprocess.check_output(compiler, stderr=subprocess.STDOUT)
827-
match = re.search(
828-
r"(\d+)\.(\d+)\.(\d+)",
829-
compiler_info.decode(*SUBPROCESS_DECODE_ARGS).strip(),
830-
)
831-
version = ["0", "0", "0"] if match is None else list(match.groups())
825+
versionstr = subprocess.check_output(compiler, stderr=subprocess.STDOUT)
826+
match = re.search(
827+
r"(\d+)\.(\d+)\.(\d+)",
828+
versionstr.decode(*SUBPROCESS_DECODE_ARGS).strip(),
829+
)
830+
version = ["0", "0", "0"] if match is None else list(match.groups())
832831
except Exception:
833832
_, error, _ = sys.exc_info()
834833
warnings.warn(f"Error checking compiler version for {compiler}: {error}")

0 commit comments

Comments
 (0)