Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiversioning does not rewrite instruction uses on the first target #50212

Open
pchintalapudi opened this issue Jun 19, 2023 · 1 comment
Open
Labels
compiler:codegen Generation of LLVM IR and native code kind:bug Indicates an unexpected problem or unintended behavior pkgimage status:won't change Indicates that work won't continue on an issue or pull request

Comments

@pchintalapudi
Copy link
Member

pchintalapudi commented Jun 19, 2023

In the context of multiversioning, when a function for a clone_all target calls a function that is cloned for a different target, we need to convert that direct call into a load from a global variable and an indirect call. This allows us to swap out which function we actually call based on the currently loaded target that we run on. However, on 1.9 and below we do not perform this direct->indirect call conversion when the clone_all target is the first target at index 0. This means that we don't dispatch to the target-specific clones of functions unless they use a nonzero base target index, or if the target is marked clone_all.

To observe the bug, simply output an LLVM bitcode file from the system image with an offending JULIA_CPU_TARGET string, disassemble it with llvm-dis, grep for calls to functions with a .clone suffix, and check for the existence of direct calls to the same function without a .clone suffix. Such calls should not exist when multiversioning is working properly.

Note that this does not apply to master/1.10, as multiversioning has been significantly modified and does not have this issue anymore.

cc @vchuravy

@pchintalapudi pchintalapudi added the regression 1.9 Regression in the 1.9 release label Jun 19, 2023
@vchuravy vchuravy added kind:bug Indicates an unexpected problem or unintended behavior status:won't change Indicates that work won't continue on an issue or pull request compiler:codegen Generation of LLVM IR and native code pkgimage and removed regression 1.9 Regression in the 1.9 release labels Jun 19, 2023
@vchuravy
Copy link
Sponsor Member

vchuravy commented Jun 19, 2023

Got fixed in #47797 as part of the multi-versioning rewrite. Which is not back-portable.

So this is issue is more FYI for user of multi-versioning on 1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code kind:bug Indicates an unexpected problem or unintended behavior pkgimage status:won't change Indicates that work won't continue on an issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants