Skip to content

Commit 32064da

Browse files
Move extract_artifacts to inside run_extractions (#274)
1 parent 06885c3 commit 32064da

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

compiler_opt/tools/extract_ir_lib.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import re
2020
import shutil
2121
import subprocess
22-
import functools
2322
import multiprocessing
2423
import json
2524

@@ -294,14 +293,6 @@ def make_spec(obj_file: str):
294293
return [make_spec(path) for path in paths]
295294

296295

297-
def extract_artifacts(obj: TrainingIRExtractor, llvm_objcopy_path: str,
298-
cmd_filter: str, thinlto_build: str,
299-
cmd_section_name: str,
300-
bitcode_section_name) -> Optional[str]:
301-
return obj.extract(llvm_objcopy_path, cmd_filter, thinlto_build,
302-
cmd_section_name, bitcode_section_name)
303-
304-
305296
def run_extraction(objs: List[TrainingIRExtractor], num_workers: int,
306297
llvm_objcopy_path: str, cmd_filter: str, thinlto_build: str,
307298
cmd_section_name: str, bitcode_section_name: str):
@@ -323,15 +314,13 @@ def run_extraction(objs: List[TrainingIRExtractor], num_workers: int,
323314
bitcode_section_name: The name of the bitcode section created by the
324315
bitcode embedding.
325316
"""
326-
extract_artifacts_function = functools.partial(
327-
extract_artifacts,
328-
llvm_objcopy_path=llvm_objcopy_path,
329-
cmd_filter=cmd_filter,
330-
thinlto_build=thinlto_build,
331-
cmd_section_name=cmd_section_name,
332-
bitcode_section_name=bitcode_section_name)
317+
318+
def extract_artifacts(obj: TrainingIRExtractor) -> Optional[str]:
319+
return obj.extract(llvm_objcopy_path, cmd_filter, thinlto_build,
320+
cmd_section_name, bitcode_section_name)
321+
333322
with multiprocessing.Pool(num_workers) as pool:
334-
relative_output_paths = pool.map(extract_artifacts_function, objs)
323+
relative_output_paths = pool.map(extract_artifacts, objs)
335324
pool.close()
336325
pool.join()
337326
return relative_output_paths

0 commit comments

Comments
 (0)