Repository navigation
Conversation
util::mac_host(): the process runs under Wine on a Mac (CrossOver or the Game Porting Toolkit), where D3D12 is Apple's D3DMetal and the title's code runs through Rosetta 2. ntdll's wine_get_host_version names the host's system; "Darwin" is a Mac. XCL_MAC_HOST=1 / 0 overrides it. Nothing calls it yet. The Mac changes that need to know they run there (the barrier default, title textures on shared pages) build on it; until now only Ahmet-Dedeler's mac7 branch had it. Part of xcl-dev#258.
Apple's metal-shaderconverter, which D3DMetal runs on every pipeline, does not handle DXIL UMul (binaryWithTwoOuts, opcode 42) in every program: on some it overflows its stack and the compile never returns. The direct translator emits UMul for the stride * index term of a windowed buffer address (lower_window.rs), so on a Mac every test and title pipeline with such an address can stop there. On a Mac (util::mac_host), umul_wide now builds the high half from 16-bit parts, as the HLSL kernel's mul_hi_u32 does, so the window code still needs no Int64Ops. Windows keeps UMul. Measured on an M5 Pro, macOS 27.2.1, CrossOver 26.3 + D3DMetal, on main 9dfbe3e with xcl-dev#2361: - gpu_memory_windows_above_4_gib, gpu_memory_windows_reject_out_of_uma_aliasing and gpu_sparse_vram_descriptors_buffers_and_xmem: on main each reports "has overflowed its stack" and hangs; with this change all three pass. - umul_wide_without_umul_matches_cpu (new): passes on 32 lanes; its kernel has no binaryWithTwoOuts and no Int64Ops. - window_at_lowers_to_32bit_carry_without_int64 now expects no UMul on a Mac: it passes, and with XCL_MAC_HOST=0 it still finds UMul, as before (with the Mac branch disabled it failed, measured on my Mac branch on 27 Nov). - gpu_window_at_32bit_carry_edge_cases: passes.
|
Review (head 3ebde06, diff read, not a merge-check; draft with
Fine: AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
Stacked on #2361: the first commit (69c0b04, AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
Stacked on #2361; only the top commit belongs here. Part of #258.
Apple's metal-shaderconverter, which D3DMetal runs on every pipeline, does not handle DXIL
UMul(binaryWithTwoOuts, opcode 42) in every program: on some it overflows its stack and the compile never returns. The direct translator emitsUMulfor thestride * indexterm of a windowed buffer address, so on a Mac those pipelines can stop there. On a Mac (util::mac_host),umul_widenow builds the high half from 16-bit parts, as the HLSL kernel'smul_hi_u32does, so the window code still needs noInt64Ops. Windows keepsUMul. #2172 would useumul_widein more places; on a Mac those go through the same halves.What is in it
crates/xcl/src/gpu/dxil/ops.rs:umul_widetakesumul_wide_halveson a Mac.crates/xcl/src/gpu/dxil/ops_tests.rs: newumul_wide_without_umul_matches_cpu.crates/xcl/src/gpu/dxil/core_tests.rs:window_at_lowers_to_32bit_carry_without_int64expects noUMulon a Mac andUMulelsewhere.Tested
x86_64-pc-windows-gnu, debug; this branch onmain9dfbe3ewith Memory: detect a macOS host under Wine (mac_host) #2361.gpu_memory_windows_above_4_gib,gpu_memory_windows_reject_out_of_uma_aliasing,gpu_sparse_vram_descriptors_buffers_and_xmem: onmaineach reports "has overflowed its stack" and hangs; with this PR all three pass.umul_wide_without_umul_matches_cpu(new),window_at_lowers_to_32bit_carry_without_int64,gpu_window_at_32bit_carry_edge_cases,a_mac_host_is_darwin_under_wine_unless_forced: pass. WithXCL_MAC_HOST=0thewindow_attest still findsUMul.Regression run
scripts/smoke.ps1. On Windowsmac_host()is false, so the code path there is unchanged.Not tested
IMul's high half is also wrong on D3DMetal (1 * 0x9e377939gives 0); the runtime does not emitIMultoday, and this PR does not change it.AI use