Skip to content

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

Open

Description

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

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

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:codegenGeneration of LLVM IR and native codepkgimagewon't changeIndicates that work won't continue on an issue or pull request

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions