Skip to content

Commit

Permalink
fix compiler version parsing issue (#4468)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZailiWang authored Jul 12, 2024
1 parent 9b96efa commit 50b2b59
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions intel_extension_for_pytorch/xpu/cpp_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,15 +820,14 @@ def get_compiler_abi_compatibility_and_version(compiler) -> Tuple[bool, TorchVer
versionstr = subprocess.check_output(
[compiler, "-dumpfullversion", "-dumpversion"]
)
version = versionstr.decode(*SUBPROCESS_DECODE_ARGS).strip().split(".")
else:
minimum_required_version = MINIMUM_MSVC_VERSION
compiler_info = subprocess.check_output(compiler, stderr=subprocess.STDOUT)
match = re.search(
r"(\d+)\.(\d+)\.(\d+)",
compiler_info.decode(*SUBPROCESS_DECODE_ARGS).strip(),
)
version = ["0", "0", "0"] if match is None else list(match.groups())
versionstr = subprocess.check_output(compiler, stderr=subprocess.STDOUT)
match = re.search(
r"(\d+)\.(\d+)\.(\d+)",
versionstr.decode(*SUBPROCESS_DECODE_ARGS).strip(),
)
version = ["0", "0", "0"] if match is None else list(match.groups())
except Exception:
_, error, _ = sys.exc_info()
warnings.warn(f"Error checking compiler version for {compiler}: {error}")
Expand Down

0 comments on commit 50b2b59

Please sign in to comment.