Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions op_builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,17 @@ def cpu_arch(self):
try:
from cpuinfo import get_cpu_info
except ImportError as e:
cpu_info = _backup_cpuinfo()
cpu_info = self._backup_cpuinfo()
if cpu_info is None:
return "-march=native"

try:
cpu_info = get_cpu_info()
except json.decoder.JSONDecodeError as e:
#FIXME: temp workaround, seeing strange JSON stack trace from
# cpuinfo on A100-80GB machines and possibly others.
cpu_info = _backup_cpuinfo()
except Exception as e:
self.warning(
f"{self.name} attempted to use `py-cpuinfo` but failed (exception type: {type(e)}, {e}), "
"falling back to `lscpu` to get this information.")
cpu_info = self._backup_cpuinfo()
if cpu_info is None:
return "-march=native"

Expand Down Expand Up @@ -318,16 +319,17 @@ def simd_width(self):
try:
from cpuinfo import get_cpu_info
except ImportError as e:
cpu_info = _backup_cpuinfo()
cpu_info = self._backup_cpuinfo()
if cpu_info is None:
return '-D__SCALAR__'

try:
cpu_info = get_cpu_info()
except json.decoder.JSONDecodeError as e:
cpu_info = _backup_cpuinfo()
#FIXME: temp workaround, seeing strange JSON stack trace from
# cpuinfo on A100-80GB machines and possibly others.
except Exception as e:
self.warning(
f"{self.name} attempted to use `py-cpuinfo` but failed (exception type: {type(e)}, {e}), "
"falling back to `lscpu` to get this information.")
cpu_info = self._backup_cpuinfo()
if cpu_info is None:
return '-D__SCALAR__'

Expand Down