fix(hw-oracle): read the template and write the assembly source as UTF-8 #12084
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12084"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by legendary-cookie on 2026-10-27T19:47:50Z.
What
assemble()intools/hw-oracle/hw_oracle.pyreadtemplate.sand wrotek.swith the locale encoding, whilemain()reads the body file as UTF-8 and the HIP path encodes the assembled text as UTF-8. On Windows (cp1252 locale, HIP runtime by default) a body containing a character cp1252 cannot encode, such as→in a comment, stopped atwrite_textwith a rawUnicodeEncodeErrorbefore assembling. Both now use UTF-8.template.sis ASCII, so reading it is unchanged.Tested
python tools/hw-oracle/test_hw_oracle.py: 47 tests OK (3 skipped: Windows LLVM has no AMDGPU target, two POSIX fixtures). The newSourceEncodingTests.test_assembly_source_is_utf8fails onmainwithUnicodeEncodeError: 'charmap' codec can't encode character '→'and passes with the change.AssemblyTests.k.sfiles written on Windows by this change, with→andéin a body comment, assemble and link with-mcpu=gfx1030.hw_oracle.pywith bodyv_add_f32 v10, v4, v5 ; v4 + v5 → v10and rows1.0 2.0,3.0 0.5prints40400000,40600000, the same as an ASCII-only body onmain; the same body onmainstops with theUnicodeEncodeError.tools/check_conventions.py --base origin/mainpasses;tools/pr_overlap.pyreports no overlap.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T19:49:05Z.
Review: APPROVED
Reviewed exact head
3a91f8ab8e15a3a168f58e1c7099a41c50fc53a9. Explicit UTF-8 for both template input and assembled-source output matches the rest of the tool's UTF-8 handling. The new regression uses non-ASCII text and verifies the emitted bytes decode as UTF-8. I independently ran the fulltools/hw-oracle/test_hw_oracle.pysuite from the exact PR files on Linux: 47 tests passed, 2 skipped because this host lacks an AMDGPU-capable clang and the Windows driver COMGR runtime. The author reports the full suite on Windows and Debian, plus a Windows HIP hardware check that reproduces the prior failure and matches the ASCII-only output.Conventions, intake and labels pass. The hosted Windows build linked the changed host-only test executables but skipped the subsequent product build and CTest steps; the Windows unit and hardware results above are author-reported, not run by that CI job. No issue found in this focused fix.
Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-28T05:17:10Z.
Review: APPROVED
Checked head
3a91f8ab8eon macOS (no Windows needed): a non-UTF-8 locale reproduces the bug.git merge-treewithmain16954551edis clean.check_conventions.py --base upstream/mainpasses andpr_overlap.pyreports no overlap.main'shw_oracle.pyand this test, underLC_ALL=en_US.ISO8859-1 python3.13 -X utf8=0(locale.getencoding()=ISO8859-1), only the new test fails:ERROR: test_assembly_source_is_utf8 ... UnicodeEncodeError: 'latin-1' codec can't encode character '\u2192'. 46 others pass.hw_oracle.pythat depends on the locale.--rows/--bodyalready use UTF-8. The one left issubprocess.run(..., text=True)at L93, which reads the--targetoutput and is ASCII, so it's fine as it is.Non-blocking: if you reverted only the
template.sread, no test would catch it, because the template is ASCII. That's fine, as the PR body says.LGTM.
AI-assisted: yes