Skip to content

Conversation

@candrews
Copy link

MSVC doesn't define BMI2 so it must be defined by by CMake. It was being set whenever GGML_BMI2 is set, but that results in a failure (error LNK2019: unresolved external symbol __pdep_u64) when targeting x86 (aka 32 bit) Windows. The fix is to only set BMI2 when targeting amd64.

Make sure to read the contributing guidelines before submitting a PR

MSVC doesn't define __BMI2__ so it must be defined by by CMake. It was being set  whenever GGML_BMI2 is set, but that results in a failure (`error LNK2019: unresolved external symbol __pdep_u64`) when targeting x86 (aka 32 bit) Windows. The fix is to only set __BMI2__ when targeting amd64.
@candrews candrews requested a review from ggerganov as a code owner November 26, 2025 18:16
@github-actions github-actions bot added the ggml changes relating to the ggml tensor library for machine learning label Nov 26, 2025
@angt
Copy link
Collaborator

angt commented Nov 27, 2025

Thanks!
I don’t know about MSVC, but all the features I see around BMI2 are also AMD64 only.
Can you share more about the target configuration and the build failure?

@candrews
Copy link
Author

Here's a build log in GitHub Actions which I believe provides all that info, demonstrating the failure when targeting win32:
https://github.com/candrews/pywhispercpp/actions/runs/19691916887/job/56409457483#step:5:431

@angt
Copy link
Collaborator

angt commented Nov 27, 2025

Ok i guess it's because of this line:

option(GGML_BMI2 "ggml: enable BMI2" ${INS_ENB})

As a quick hack, maybe you can set the env SOURCE_DATE_EPOCH and select the flags you want?

A normal build gives:

-- x86 detected
-- Adding CPU backend variant ggml-cpu: -msse4.2;-mf16c;-mfma;-mbmi2;-mavx;-mavx2 GGML_SSE42;GGML_F16C;GGML_FMA;GGML_BMI2;GGML_AVX;GGML_AVX2

But with SOURCE_DATE_EPOCH=1:

-- x86 detected
-- Adding CPU backend variant ggml-cpu:

Then add the flags you want (GGML_AVX , etc)

edit: not GGML_AVX2 :)

@candrews
Copy link
Author

That's a workaround, but that won't fix the GGML_CPU_ALL_VARIANTS=1 GGML_BACKEND_DL=1 case, which I'm eager to use :-)

@angt
Copy link
Collaborator

angt commented Nov 27, 2025

after taking a look, i think its just because of the missing -DGGML_NATIVE=OFF flag:

https://github.com/angt/pywhispercpp/actions/runs/19744492579/job/56575850622

code: angt/pywhispercpp@d287338

@angt
Copy link
Collaborator

angt commented Nov 29, 2025

@candrews, can we close this PR?

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

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants