Commit Graph

21 Commits

Author SHA1 Message Date
c6c8f5f5a3 scripts: build llvm-mc 23.1.5 by default, so the pipeline library translates (#1923)
* scripts, tools: build llvm-mc 23.1.5 by default, so the pipeline library translates

LLVM 21.1.8's gfx1013 decoder cannot decode 840 of the 2,684 compute
programs in the pipeline library of 1.0.2.1: their listings carry 79,490
undecodable words and 8,310 exp invalid_target_N lines, the translator
refuses all of them as "fall-through into undecodable words", and the
shaders stage keeps 1,844 of 2,684. LLVM 21 does translate all 26,503
shaders of shaders.rpf; the library is what it loses.

The same bytes under llvm-mc 23.1.5 have no rejected word in those 840,
and 839 of them translate and pass spirv-val (the last wants s_sethalt,
which the translator does not implement, under either version). The 1,844
that already translated were re-disassembled too: 1,674 listings change
and all 1,674 still translate, the other 170 are byte-identical, so the
stage goes from 1,844/2,684 to 2,683/2,684.

The build helper now builds 23.1.5 by default. The docs that name the
minimum version (README, docs/design.md, docs/testing.md, docs/linux.md)
and the three user-facing messages that still said 21+ (make_game.py's
preflight, shader_disasm.py's probe error, mc_command.py's install hint)
now say 23+, with the tests that assert those texts updated.

AI-assisted (DeepSeek Harness).
Written with an AI assistant.

* docs: LLVM 23 is what the shaders stage needs, and a test pins the script's default
2026-12-01 11:48:54 +01:00
74e9e8012b Harden build_llvm_mc.ps1 Version/Temp resolution, VS/tool fallback, and literal copy 2026-11-25 21:46:08 +08:00
2a4f650b7b build_llvm_mc.ps1: a relative -Temp is checked as the full path it resolves to
Review by @QemmHD: a relative -Temp under a working directory with % skipped the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 08:52:50 +03:00
5dbd92b92d build scripts: refuse a folder with % in its path up front
cmd.exe expands %...% on every line of the generated _build.cmd (twice on a CALL line), and cl.exe rejects a % in the
path-valued /D definitions of the runtime's test targets (D8038) however it is quoted, so a checkout with % in its path
failed in configure, or a few hundred Ninja steps in once the batch was escaped (@ezbyDev's measurements in the original repository).
build_runtime.ps1 now stops before looking for Visual Studio when the checkout path has a %, and build_llvm_mc.ps1 when
-Temp has one, each naming the folder; docs/testing.md gets a Known-problems row. tests/test_build_percent_path.py runs
both scripts with such a path, with git, python and vswhere hidden so that a missing check can't start a real build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 07:09:02 +03:00
77bac1a8e8 Merge pull request #4031 from 0xTehuti
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:10:35 -05:00
bc425352cd scripts: robust recursive directory cleanup with readonly reset in build_llvm_mc.ps1 (BUILD-139)
When cleaning up temporary build and clone directories on Windows, files with
the ReadOnly attribute (such as git objects in the sparse clone) cause
PowerShell's Remove-Item to fail with an UnauthorizedAccessException or
IOException, leaving gigabytes of files behind in $Temp.

Implement Remove-DirectoryRobust:
1. Recursively strip ReadOnly attributes across all nested files and directories.
2. Retry Remove-Item with backoff for brief file handle locks.
3. Fall back to Windows cmd rmdir /s /q which handles read-only attribute trees natively.
4. Add unit test in tests/test_build_llvm_mc_cleanup.py verifying teardown of read-only hierarchies.
2026-11-22 23:59:52 +01:00
53ce9b6c7f Merge pull request #3554 from ezbyDev 2026-11-22 17:02:40 -05:00
fbacc54b1f Merge pull request #3515 from Catskan 2026-11-22 17:02:26 -05:00
fc3bda5cd7 scripts: start _build.cmd with cmd /s /c ""path"" so & and ^ survive
build_runtime.ps1 and build_llvm_mc.ps1 started the generated batch with
`cmd.exe /c "path"`. cmd.exe drops those quotes when the path holds a
special character such as & or ^, then runs only the part before it, so a
checkout (build_runtime) or -Temp/%TEMP% (build_llvm_mc) in a folder like
`a & b` failed at once with "C:\...\a is not recognized". With /s and a
second pair of quotes, cmd.exe strips only the outer pair.

tests/test_build_batch_launch.py takes each script's launch line as written
and runs it on a stub batch in folders named plain, `a & b`, `a&b`, `x^y`,
`sp (x)` and `東京 & co`: the stub must run and its exit code (0 and 7) must
come back. It also checks that the old form fails there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:53:58 +01:00
c9ab456da2 build_llvm_mc: check out libc, which LLVM 23 needs to configure
LLVM 23's llvm/CMakeLists.txt stops with "LLVM libc is not found" when the
sparse checkout leaves out libc. Add it to the checkout, and to a source a
failed LLVM 23 run of the old script left in -Temp, so the same -Temp works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:45:17 +01:00
012907537b Merge pull request #3029 from frnandoooo 2026-11-22 15:14:10 -05:00
6443233376 Merge pull request #2975 from frnandoooo 2026-11-22 15:13:44 -05:00
fb030b1036 build_llvm_mc: persist an absolute installation path 2026-11-22 20:08:58 +01:00
f6b09ce2ab build_llvm_mc: reject retained sources from another LLVM release 2026-11-22 19:59:39 +01:00
cc29f9be93 Restore the console code page after the LLVM build 2026-11-22 19:43:57 +01:00
7db5591f2f Preserve Unicode paths in the Windows LLVM builder 2026-11-22 18:19:27 +01:00
a3969c3a2c build_llvm_mc: check out LLVM with core.longpaths, so a deep -Temp works
Some llvm/docs paths are about 150 characters. With a -Temp of about 100
characters the sparse checkout failed with "Filename too long" (Windows'
260-character limit) and the script stopped at "git sparse-checkout
failed.". The clone now sets core.longpaths=true in its own config only;
the user's global git config is untouched.
2026-11-22 14:53:13 +03:00
342028959a build_llvm_mc: install llvm-mc outside AppData, where the install manager's python can see it
python from the Python install manager (the WindowsApps alias) doesn't see folders other programs create under %LOCALAPPDATA% or %APPDATA%, so the old default made make_game.py report llvm-mc missing and the fuzzers stop with WinError 2 although LLVM_MC named the file. The default -Dest is now %USERPROFILE%\.leonida\llvm-mc, and the preflight explains an LLVM_MC that points into AppData.
2026-11-22 15:39:48 +07:00
ddb1faf9b7 Reject llvm-mc install paths inside the cleanup directory 2026-11-21 22:50:24 -05:00
c2df6ab458 Warn when post-install llvm-mc cleanup fails 2026-11-21 22:31:40 -05:00
95b2c091c8 Build a native Windows llvm-mc with the AMDGPU target, no WSL needed
scripts/build_llvm_mc.ps1 sparse-clones the LLVM sources llvm-mc needs,
builds it alone with LLVM_TARGETS_TO_BUILD=AMDGPU, static CRT and the DIA
SDK off (its headers need ATL, which the C++ build tools don't always
include), checks it disassembles an s_endpgm for gfx1013, keeps only
llvm-mc.exe and sets LLVM_MC for the user. README, docs/design.md and the
make_game.py / shader_disasm.py hints mention it next to the WSL route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:50:01 +01:00