Repository navigation
hw_oracle: an amdclang launcher on PATH is followed to the clang it is installed as - #3949
Conversation
…s installed as The rocm-sdk wheels put `amdclang` in the Python environment's Scripts (bin) folder. find_clang() takes it first, because it is on PATH and lists the amdgcn target, but ld.lld and amdgpu-arch sit beside the real clang, in the folder the launcher reports as InstalledDir. With the wheels in a Python outside the checkout the oracle then stopped with "no ld.lld next to the AMD clang", also when HIP_PATH named a complete toolchain, and LEONIDA_AMD_CLANG was the only way around it. find_clang() now returns the clang in InstalledDir when the one it found has no ld.lld beside it. A clang that has its linker is used where it was found, and a launcher that names a folder without a clang is kept, so every setup that worked resolves to the same compiler as before. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…NA4 (gfx1201) crosslane_fuzz.py --oracle hw on an RX 9070 XT (gfx1201, Adrenalin 26.11.2, amdhip64_7.dll, AMD clang 23.0.0git from the rocm-sdk wheels): - --dpp, seeds 1 to 8, 1,000 programs each: all 8,000 match (984 hyp_dpp, 1,964 hyp_permlane, the counts of the RX 6700 XT run). - --dpp-sweep --wave both: 14,412 cases, 14,412 match, 0 failing in every family. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
|
Tested 16a53cd on Windows, CPython 3.14.7, CPU only (no GPU, no game files): pass. The test is partial.
I do not have an AMD clang. I used a stand-in for the compiler output and called I did not test a real AMD clang or the RX 9070 XT results in the documentation. I found no defect. AI-assisted. |
|
Tested 16a53cd merged with main d974c88 on Linux (WSL2, Python 3.12.16) and native Windows (Python 3.13.1): pass
|
Claimed in #3918 (new item: "hw_oracle: find_clang takes the rocm-sdk wheels'
amdclanglauncher from PATH ...").The problem
With the
rocm-sdkwheels installed in a Python outside the checkout,amdclangis on PATH.find_clang()takes it first: it is on PATH and lists the amdgcn target. It is only a launcher, though.ld.lldandamdgpu-archsit beside the real clang, in the folder the launcher reports asInstalledDir, so the oracle stopped withon a machine where that same wheel, and a HIP SDK named by
HIP_PATH, each hold a complete toolchain. SettingLEONIDA_AMD_CLANGby hand was the only way around it.The change
find_clang()returns the clang inInstalledDirwhen the one it found has nold.lldbeside it (_installed_clang). Nothing else moves:_find_lldreports it as before;LEONIDA_AMD_CLANGis still taken as given.So every setup that worked resolves to the same compiler as before.
docs/shader_validation.mdand the header ofrunner.pysay that the launcher is followed.Tests
Three new tests in
tests/test_hw_oracle.py(ClangOnPath), with real files in a temporary folder and a stand-in for what the compilers print:find_clang()returned the launcher);The last two pass with and without the change; each was seen failing against a deliberately wrong version of the fix (follow always; return the folder's clang without checking that it exists).
Overlap
Checked against the 1,018 pull requests open at the time. Only #2681 and #3603 also change
tools/hw_oracle/runner.py, both inbuild_command, not infind_clang/_find_lld. 22 open pull requests edit one of the three files this one touches; a trial merge of this branch with each of them adds no conflict (seven of them already conflict withmainin those files and need a rebase either way). The new test class sits afterUnavailable.What I ran
Machine: RX 9070 XT (gfx1201), Adrenalin 26.11.2 (32.0.32029.2010), Windows 11,
amdhip64_7.dll, AMD clang 23.0.0git from therocm-sdkwheels in a Python 3.12 outside the checkout, tests under Python 3.14.5. Branch rebased onmainat aa2988c.python -I tools/hw_oracle/runner.pywithLEONIDA_AMD_CLANGunset. Before:hardware oracle unavailable: no ld.lld next to the AMD clang(exit 77). After:hardware oracle ready: device=AMD Radeon RX 9070 XT arch=gfx1201; clang <python>\Lib\site-packages\_rocm_sdk_devel\lib\llvm\bin\clang.exe.python -I tests/test_hw_oracle.py: 54 tests, OK (1 skipped).mainonceLEONIDA_AMD_CLANGis set by hand:test_f32_fuzz.py,test_f16_trans_sweep.py(the MODE probe on gfx1170+) andtest_lds_fuzz_hw.py(s_barrieron gfx1201). They are a gfx12 matter, posted as afinding:in Coordinating who works on what (20) (moved to #4084) #3918, not part of this change (the MODE probe part is FUZZ-43, hw_oracle: a MODE that gfx1170+ cannot set is reported, not assembled (FUZZ-43) #1620, seen here on RDNA4 hardware). Worth knowing: this fix makes the oracle available on machines where it was hidden, so on an RDNA4 card those three now run instead of skipping.python -m compileall -q tools tests, thetest_docs_*.pyfiles,test_csv_line_endings.pyandtest_text_write_line_endings.py: OK.python -I, pytest files with pytest,tests/semantic), withouttests/test_make_game_*.py: 265 files, 258 exit 0. Besides the three above, four failed there and failed identically on unmodifiedmainon this machine:test_build_llvm_mc_batch.py,test_build_runtime_fallback.py,test_report_paths.py,test_vk_pipeline_check_index.py(the last one uses avk_pipeline_checkbuilt at an older commit, which may be why).tests/semantic: 7322 tests, OK (1 expected failure). I did not repeat the whole suite after the rebase.Not run: Linux, and a machine without the wheels.
Second commit: RDNA4 results for the cross-lane fuzzer
With the oracle working I ran
crosslane_fuzz.py --oracle hwon the RX 9070 XT and added the numbers todocs/shader_validation.md, next to the RX 6700 XT ones. An RX 9070 run of 8k cross-lane programs is mentioned in the gfx12 claim in #1006, but the docs record that card only forsalu_diff, and I found no RDNA4 result for the DPP sweep:--dpp, seeds 1 to 8, 1,000 programs each: all 8,000 match, with the same 984hyp_dppand 1,964hyp_permlaneprograms as the RX 6700 XT run;--dpp-sweep --wave both: 14,412 cases, 14,412 match, 0 failing in every family, 40hyp_dpp.Both were repeated after the rebase with the same numbers. gfx1201 is not RDNA2, and the text says so. It is a separate commit: drop it or ask me to split it into its own pull request if you prefer.
No game files were used anywhere. This pull request was AI-assisted (Claude Code); everything above ran on my own machine.
🤖 Generated with Claude Code