Gcenx / macOS_Wine_builds

Official Winehq macOS Packages
515 stars 23 forks source link

Running AVX2 binaries #115

Open twoplan opened 18 hours ago

twoplan commented 18 hours ago

Hi, shouldn´t it be possible to run AVX2 binaries with Rosetta 2?

I installed wine 9.21 with "brew install --cask --no-quarantine wine@staging" on my M4 mac running macOS 15.1.1. Windows x86_64 stockfish and other chess engines are working nice with wine. But compiles using avx2 instructions crash at startup.

Do I miss something? Is configuration or additional software needed for AVX2?

You can download the open source stockfish 17 chess engines from https://stockfishchess.org/download/windows/ . They provide optimized builds for different x86 cpus including avx2 and avx512. A chess engine needs a gui for playing against. But you can use them from the terminal too.

Run the chess engine in a terminal, i.e. with "wine ./stockfish-windows-x86-64-avx2.exe bench > /dev/null". This gives a benchmark result of how much chess positions (nodes) are calculated per second. Here is the result for the popcnt version on my mac:

wine ./stockfish-windows-x86-64-sse41-popcnt.exe bench > /dev/null
...
...
===========================
Total time (ms) : 1850
Nodes searched  : 1484730
Nodes/second    : 802556

BTW, how to suppress the wine start messages?

% wine ./stockfish-windows-x86-64-sse41-popcnt.exe
002c:fixme:winediag:loader_init wine-staging 9.21 is a testing version containing experimental patches.
002c:fixme:winediag:loader_init Please mention your exact version when filing bug reports on winehq.org.
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd059f0ade0 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd059f0b200 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f29090 (vid 05ac, pid 8104): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f28c70 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd059f04340 (vid 05ac, pid 8104): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f28850 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd059f0af40 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f257d0 (vid 05ac, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f28dd0 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f289b0 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd059f0b0a0 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f28590 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd059f0ac80 (vid 05ac, pid 8104): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f28f30 (vid 05ac, pid 8104): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f28b10 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd059f041e0 (vid 0000, pid 0000): not a joystick or gamepad
0094:err:hid:handle_DeviceMatchingCallback Ignoring HID device 0x7fd079f286f0 (vid 0000, pid 0000): not a joystick or gamepad
[mvk-info] MoltenVK version 1.2.10, supporting Vulkan version 1.2.290.
    The following 110 Vulkan extensions are supported:
    VK_KHR_16bit_storage v1
    VK_KHR_8bit_storage v1
    VK_KHR_bind_memory2 v1
    VK_KHR_buffer_device_address v1
    VK_KHR_calibrated_timestamps v1
    VK_KHR_copy_commands2 v1
    VK_KHR_create_renderpass2 v1
    VK_KHR_dedicated_allocation v3
    VK_KHR_deferred_host_operations v4
    VK_KHR_depth_stencil_resolve v1
    VK_KHR_descriptor_update_template v1
    VK_KHR_device_group v4
    VK_KHR_device_group_creation v1
    VK_KHR_driver_properties v1
    VK_KHR_dynamic_rendering v1
    VK_KHR_external_fence v1
    VK_KHR_external_fence_capabilities v1
    VK_KHR_external_memory v1
    VK_KHR_external_memory_capabilities v1
    VK_KHR_external_semaphore v1
    VK_KHR_external_semaphore_capabilities v1
    VK_KHR_fragment_shader_barycentric v1
    VK_KHR_format_feature_flags2 v2
    VK_KHR_get_memory_requirements2 v1
    VK_KHR_get_physical_device_properties2 v2
    VK_KHR_get_surface_capabilities2 v1
    VK_KHR_imageless_framebuffer v1
    VK_KHR_image_format_list v1
    VK_KHR_incremental_present v2
    VK_KHR_maintenance1 v2
    VK_KHR_maintenance2 v1
    VK_KHR_maintenance3 v1
    VK_KHR_map_memory2 v1
    VK_KHR_multiview v1
    VK_KHR_portability_subset v1
    VK_KHR_push_descriptor v2
    VK_KHR_relaxed_block_layout v1
    VK_KHR_sampler_mirror_clamp_to_edge v3
    VK_KHR_sampler_ycbcr_conversion v14
    VK_KHR_separate_depth_stencil_layouts v1
    VK_KHR_shader_draw_parameters v1
    VK_KHR_shader_float_controls v4
    VK_KHR_shader_float16_int8 v1
    VK_KHR_shader_integer_dot_product v1
    VK_KHR_shader_non_semantic_info v1
    VK_KHR_shader_subgroup_extended_types v1
    VK_KHR_spirv_1_4 v1
    VK_KHR_storage_buffer_storage_class v1
    VK_KHR_surface v25
    VK_KHR_swapchain v70
    VK_KHR_swapchain_mutable_format v1
    VK_KHR_synchronization2 v1
    VK_KHR_timeline_semaphore v2
    VK_KHR_uniform_buffer_standard_layout v1
    VK_KHR_variable_pointers v1
    VK_KHR_vertex_attribute_divisor v1
    VK_EXT_4444_formats v1
    VK_EXT_buffer_device_address v2
    VK_EXT_calibrated_timestamps v2
    VK_EXT_debug_marker v4
    VK_EXT_debug_report v10
    VK_EXT_debug_utils v2
    VK_EXT_descriptor_indexing v2
    VK_EXT_extended_dynamic_state v1
    VK_EXT_extended_dynamic_state2 v1
    VK_EXT_extended_dynamic_state3 v2
    VK_EXT_external_memory_host v1
    VK_EXT_fragment_shader_interlock v1
    VK_EXT_hdr_metadata v3
    VK_EXT_headless_surface v1
    VK_EXT_host_image_copy v1
    VK_EXT_host_query_reset v1
    VK_EXT_image_robustness v1
    VK_EXT_inline_uniform_block v1
    VK_EXT_layer_settings v2
    VK_EXT_memory_budget v1
    VK_EXT_metal_objects v2
    VK_EXT_metal_surface v1
    VK_EXT_pipeline_creation_cache_control v3
    VK_EXT_pipeline_creation_feedback v1
    VK_EXT_post_depth_coverage v1
    VK_EXT_private_data v1
    VK_EXT_robustness2 v1
    VK_EXT_sample_locations v1
    VK_EXT_scalar_block_layout v1
    VK_EXT_separate_stencil_usage v1
    VK_EXT_shader_atomic_float v1
    VK_EXT_shader_demote_to_helper_invocation v1
    VK_EXT_shader_stencil_export v1
    VK_EXT_shader_subgroup_ballot v1
    VK_EXT_shader_subgroup_vote v1
    VK_EXT_shader_viewport_index_layer v1
    VK_EXT_subgroup_size_control v2
    VK_EXT_surface_maintenance1 v1
    VK_EXT_swapchain_colorspace v5
    VK_EXT_swapchain_maintenance1 v1
    VK_EXT_texel_buffer_alignment v1
    VK_EXT_texture_compression_astc_hdr v1
    VK_EXT_vertex_attribute_divisor v3
    VK_AMD_gpu_shader_half_float v2
    VK_AMD_negative_viewport_height v1
    VK_AMD_shader_image_load_store_lod v1
    VK_AMD_shader_trinary_minmax v1
    VK_IMG_format_pvrtc v1
    VK_INTEL_shader_integer_functions2 v1
    VK_GOOGLE_display_timing v1
    VK_MVK_macos_surface v3
    VK_MVK_moltenvk v37
    VK_NV_fragment_shader_barycentric v1
    VK_NV_glsl_shader v1
[mvk-info] GPU device:
    model: Apple M4 Pro
    type: Integrated
    vendorID: 0x106b
    deviceID: 0xf0103f1
    pipelineCacheUUID: EDBDCF05-0F01-03F1-0000-000000000000
    GPU memory available: 16384 MB
    GPU memory used: 0 MB
    Metal Shading Language 3.1
    supports the following GPU Features:
        GPU Family Metal 3
        GPU Family Apple 9
        GPU Family Apple 8
        GPU Family Apple 7
        GPU Family Apple 6
        GPU Family Apple 5
        GPU Family Apple 4
        GPU Family Apple 3
        GPU Family Apple 2
        GPU Family Apple 1
        GPU Family Mac 2
        GPU Family Mac 1
        GPU Family Common 3
        GPU Family Common 2
        GPU Family Common 1
        macOS GPU Family 2 v1
        macOS GPU Family 1 v4
        macOS GPU Family 1 v3
        macOS GPU Family 1 v2
        macOS GPU Family 1 v1
[mvk-info] Created VkInstance for Vulkan version 1.0.0, as requested by app, with the following 2 Vulkan extensions enabled:
    VK_KHR_external_memory_capabilities v1
    VK_KHR_get_physical_device_properties2 v2
2024-11-30 12:31:48.181 wine[5509:287439] +[IMKClient subclass]: chose IMKClient_Modern
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
0024:fixme:process:GetProcessGroupAffinity (FFFFFFFFFFFFFFFF,000000000021FDC0,00000000007B2680): stub
Stockfish 17 by the Stockfish developers (see AUTHORS file)
twoplan commented 14 hours ago

Cpu-Z can't detect AVX2 instructions with wine 9.21.

Cpu-Z (Wine 9 21)
Gcenx commented 13 hours ago

This isn’t a wine problem but a Rosetta2 problem.

You can force advertise AVX using the following env

export ROSETTA_ADVERTISE_AVX=1