def _get_libdevice_paths(): by, libdir = _get_libdevice_path_decision() # Search for pattern pat = r'libdevice(\.\d+)*\.bc$' candidates = find_file(re.compile(pat), libdir) # Keep only the max (most recent version) of the bitcode files. out = max(candidates, default=None) return _env_path_tuple(by, out)
def _get_libdevice_paths(): by, libdir = _get_libdevice_path_decision() # Search for pattern pat = r'libdevice(\.(?P<arch>compute_\d+))?(\.\d+)*\.bc$' candidates = find_file(re.compile(pat), libdir) # Grouping out = defaultdict(list) for path in candidates: m = re.search(pat, path) arch = m.group('arch') out[arch].append(path) # Keep only the max (most recent version) of the bitcode files. out = {k: max(v) for k, v in out.items()} return _env_path_tuple(by, out)