Enable ssse3 feature for rust windows tragets?

Hello,

While looking at this PR I realised we enable sse3 for all windows targets. I propose to enable ssse3 feature as well since cpus which support cx16 also support ssse3 feature as well as explained below.

If I look at the gcc options for -march=cpu-type we can see the list of instruction set enable for each cpu type. If we look at all the cpus which have cx16 support we can see all of them also have ssse3 instruction set support as well. I did some greps as below to showcase the same

rg "(SSSE3.*CX16)|(CX16.*SSSE3)" options.md > SSE3_CX16.txt;
rg "CX16" options.md > CX16.txt;
diff -d SSE3_CX16.txt CX16.txt #this wont emit anything as the files are same

let me know your thoughts on this.

Thanks for the help in advance.

The GCC documentation is, unfortunately, wrong. Nocona, among others has CX16 but not SSSE3 and is supported on Windows 10. The processor_alias_table is a better source than the documentation, since if that's wrong, the compiler output will be wrong.

As a result, until Windows 11 is the baseline, there are SSE3 and CX16 CPUs supported that do not have SSSE3 (incidentally, a horrible name for an ISA extension).

3 Likes

Thanks for the information, I wasnt aware of this.

Also when we update to windows 11, I we can jump to sse4.1 as thats the baseline.

Obviously if developers only care about targeting Win11, they can use -Ctarget-cpu to tweak the CPU baseline. But until the x86_64-pc-windows-msvc target eventually requires Win11, could it be potentially beneficial to have a separate x86_64-win11-windows-msvc target (tier 3, still uses x86_64-pc-windows-msvc std) which ups the default baseline? (c.f. the existing tier 3 win7 support.)

2 Likes

I'm not sure I like that. An ssse3 enabled standard library can run perfectly well on Windows 10, assuming the hardware support is there. Making a Win11 target for this reason does not make sense to me, even if the reverse situation does.

Rather than a separate target, can we make it like ELF psABI x96-64 microarchitecture levels, and have it be a separate CPU type? So there would be x86-64-win10 and x86-64-win11, along with aarch64-win10 and aarch-64-win11 CPUs, representing the minimum CPU standards for each Windows version we do this to?

Windows 11 minimum supported target is x86-64-v2?

But I wouldn't mix target-cpu with os, as there should be a clear distinction, even though you could argue that Windows 11 base-line creates a new x86-64 target milestone.

Anyway we rely on the operating system, not allowing to run on unsupported processors. And that's why Rust can't use features safely which aren't in the minimal requirements of the operating system it's running on.

Setting target-cpu/target-feature doesn't solve the more fundamental problem, that nothing prevents you from running the application on an unsupported target.

(Check if target features are available at start)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.