Skip to content

llama-bench : fix unexpected global variable initialize sequence issue #11832

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

Merged
merged 2 commits into from
Feb 14, 2025
Merged

llama-bench : fix unexpected global variable initialize sequence issue #11832

merged 2 commits into from
Feb 14, 2025

Conversation

theraininsky
Copy link
Contributor

@theraininsky theraininsky commented Feb 12, 2025

Global variable initialize sequence is undefined across multiple components, and could introduce unexpected behaviors.
In my case, llama-bench is completely broken with my MSVC compiler.
In short, the initialize sequence of these two global variable causes the problem:
const std::string test::cpu_info = get_cpu_info(); and static vk_instance_t vk_instance;
Here's the detailed calling sequence:
1.Firstly, const std::string test::cpu_info = get_cpu_info(); getting initialized, and get_cpu_info() uses the uninitialized global variable static vk_instance_t vk_instance; unexpectedly:
vk_instance.instance = vk::createInstance(instance_create_info);
2.Then static vk_instance_t vk_instance; getting initialized, and zeroed out the previous filled vk_instance.instance, and causing all the following calling sequence failed.

@slaren slaren merged commit a7b8ce2 into ggml-org:master Feb 14, 2025
1 check passed
orca-zhang pushed a commit to orca-zhang/llama.cpp that referenced this pull request Feb 26, 2025
ggml-org#11832)

* llama-bench : fix unexpected global variable initialize sequence issue

* Update examples/llama-bench/llama-bench.cpp

---------

Co-authored-by: Diego Devesa <slarengh@gmail.com>
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Feb 26, 2025
ggml-org#11832)

* llama-bench : fix unexpected global variable initialize sequence issue

* Update examples/llama-bench/llama-bench.cpp

---------

Co-authored-by: Diego Devesa <slarengh@gmail.com>
mglambda pushed a commit to mglambda/llama.cpp that referenced this pull request Mar 8, 2025
ggml-org#11832)

* llama-bench : fix unexpected global variable initialize sequence issue

* Update examples/llama-bench/llama-bench.cpp

---------

Co-authored-by: Diego Devesa <slarengh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants