From 2f32af0e979ac87a5f2807ad2158bfa84487bb31 Mon Sep 17 00:00:00 2001 From: XNNPACK Team Date: Mon, 12 Aug 2024 08:55:51 -0700 Subject: [PATCH] Always emit an amalgam file, even if it contains no microkernels; this ensures that all expected files are present for the build system, even during early stages of a new ISA when it might be empty. PiperOrigin-RevId: 662104545 --- tools/update-microkernels.py | 37 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/tools/update-microkernels.py b/tools/update-microkernels.py index c6db2aa0a27..7dda758b58e 100755 --- a/tools/update-microkernels.py +++ b/tools/update-microkernels.py @@ -592,25 +592,24 @@ def main(args): prod_microkernels.intersection(microkernels), key=human_sort_key, ) - if microkernels: - filepaths = [ - fp if os.path.isabs(fp) else os.path.join(root_dir, fp) - for fp in microkernels - ] - if '_' in isa_spec: - isa, arch = isa_spec.split('_') - amalgam_filename = f'{isa}-{arch}.c' - else: - isa = isa_spec - amalgam_filename = f'{isa}.c' - header = ISA_TO_HEADER_MAP.get(isa) - amalgam_text = amalgamate_microkernel_sources( - filepaths, include_header=header - ) - xnncommon.overwrite_if_changed( - os.path.join(src_dir, 'amalgam', 'gen', amalgam_filename), - amalgam_text, - ) + filepaths = [ + fp if os.path.isabs(fp) else os.path.join(root_dir, fp) + for fp in microkernels + ] + if '_' in isa_spec: + isa, arch = isa_spec.split('_') + amalgam_filename = f'{isa}-{arch}.c' + else: + isa = isa_spec + amalgam_filename = f'{isa}.c' + header = ISA_TO_HEADER_MAP.get(isa) + amalgam_text = amalgamate_microkernel_sources( + filepaths, include_header=header + ) + xnncommon.overwrite_if_changed( + os.path.join(src_dir, 'amalgam', 'gen', amalgam_filename), + amalgam_text, + ) if __name__ == '__main__':