Sure, just go for it and make a Pull Request! Would be nice being able to say you found and fixed a bug in the standard library on day 1 learning Zig And if there are any difficulties, there are enough people able to help you.
But wait, that means it also happens outside of the compiler, and in the process of executing the compiled binary of the build system.
This means there must be something wrong with Zig’s CPU feature detection.
I agree.
I don’t have the knowledge yet to attack this problem in a timely manner and/or ask the right questions.
I still have the issue of needing to ‘turn on’ AVX/2 in my VM. I’m going to chip at that first and then circle back.
Unless anyone has some things they want me to try in my setup? I have two VM’s going and even if I fix one, the other can stay broken to investigate further.
Minutiae like this really gets my brain moving. I think we’ll get it eventually, but probably not today
At this point it might be best to just make an issue for it on github, so that someone who knows more about the compiler internals in regards to architecture detection can work on this.
I’m not sure this is a Zig issue. Certainly, his CPU has AVX, and Zig correctly detected that. It seems that the VM is just not enabling it. This stackoverflow question discusses this issue.
There are many applications that switch to a vectorized version of a function if the hardware supports it (I think operations like memcpy usually do this). So the VM must have some way of telling applications that AVX is disabled (I think this can be done with the cpuid instruction), otherwise most applications would fail. Now Zig does not seem to detect this correctly.
The VM has not exposed access to AVX/2 to the guest, as far as I can tell, and Zig has incorrectly detected (assumed?) that. Zig is running guest side here.
… and Zig generated a VMOVD instruction for use in the build executable.
This is my overall understanding so far.
I also cannot turn off Hyper-V because $CORP just backs it out on the next policy update I’m pretty much stuck on falling back to the host (windows) and can continue from there. I hesitantly mark the solution as ‘untested’ because I can’t confirm it myself.
I’ll open an issue and let it run its course: #23385