Skip to content

Initial support for hwcaps-loader#102

Open
joebonrichie wants to merge 1 commit intomainfrom
hwcaps-bin-loader
Open

Initial support for hwcaps-loader#102
joebonrichie wants to merge 1 commit intomainfrom
hwcaps-bin-loader

Conversation

@joebonrichie
Copy link
Contributor

https://github.com/jrelvas-ipc/hwcaps-loader

The downside of glibc-hwcaps is it can only support loading higher micro-arch libraries, some packages may only provide binaries or their binary front-end does not link against their own library

The hwcaps-loader mechanism rectifies that

https://github.com/jrelvas-ipc/hwcaps-loader

The downside of glibc-hwcaps is it can only support loading higher
micro-arch _libraries_, some packages may only provide binaries or their
binary front-end does not link against their own library

The hwcaps-loader mechanism rectifies that
Copy link
Member

@EbonJaeger EbonJaeger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the post_execute_step() function could benefit from some comments explaining why it's doing what it's doing. For instance, why are we making symlinks in one case, but not the other?

Comment on lines +45 to +50
except FileNotFoundError as e:
print(f"File not found: {file_path} {e}")
return False
except Exception as e:
print(f"{e}")
return False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use the pretty-printing console_ui functions to print? If they were warnings, it would make it easier to see during the build.

end_time = timer()
console_ui.emit_success("Build", "{} successful ({})".
format(step, timedelta(seconds=end_time-start_time)))
post_execute_step(context, r_step, step, work_dir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is run on every step of the build. I think it would make more sense to check if we're on the "install" step before running it here instead of inside the post_execute_step() function; it also slightly simplifies that function.

hwcaps_v1_bin_dir = os.path.join(context.get_install_dir(), "usr", "hwcaps", "x86-64-v1", "bin")
bin_dir = os.path.join(context.get_install_dir(), "usr", "bin")

if context.avx2 and step_n == "install":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paired with my other suggestion about moving the step check, could we inverse this check and early return if the context is not avx2?

if is_elf_file(file_path):
shutil.move(file_path, hwcaps_v3_bin_dir)

if context.emul32 is False and context.avx2 is False and step_n == "install" and was_avx2_context is True:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if we could also inverse all of this for an early return. There are a lot of elements in this check as well that make it a bit hard to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants