kernelx: GetThreadName/SetThreadName set the Win32 error of NT failures #1674
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1684"
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 ivall/xcl. Originally posted by emirduran707 on 2026-11-24T19:15:06Z.
SetThreadNameandGetThreadNamepass on the failure ofSetThreadDescription/GetThreadDescriptionas a Win32 error throughhresult_to_win32. That function only understoodHRESULT_FROM_WIN32codes (0x8007xxxx) and setERROR_INVALID_PARAMETERfor everything else. Both functions fail withHRESULT_FROM_NTof the NT status instead: on Windows 11 26300, a null handle gives 0xD0000008, i.e. STATUS_INVALID_HANDLE with the NT facility bit. So a bad handle set error 87 instead ofERROR_INVALID_HANDLE(6), and a handle without access set 87 instead ofERROR_ACCESS_DENIED.hresult_to_win32now maps anHRESULT_FROM_NTcode back throughRtlNtStatusToDosError.What is in it
crates/xcl/src/hle/kernelx.rs: the NT case inhresult_to_win32, andRtlNtStatusToDosErrorin the existing ntdll import block. Testget_thread_name_sizing_truncation_and_errorsnow expectsERROR_INVALID_HANDLEfor a null handle from both functions; before, it only checked that some error was set.Tested
cargo test --workspace -- --test-threads=4onbb6f91b: 858 passed, 0 failed, 42 ignored; SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)left: 87,right: 6(ERROR_INVALID_PARAMETER instead of ERROR_INVALID_HANDLE)Regression run
main:
this PR:
Not tested
GetThreadNamesets; this follows the existing function's intent of turning the HRESULT back into the Win32 error. The smoke title's run is a regression check only.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by MiharaxD on 2026-11-24T21:44:16Z.
Test report on an NVIDIA card, head
bb6f91b(onmainc160d86), which covers the "NVIDIA" line.Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4(debug) onbb6f91b: 858 passed, 0 failed, 42 ignored (lib tests 809 / 0 / 22).gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64).Regression run
scripts/smoke.ps1 -Game <game folder> -Seconds 60(release builds, start screen, no input).mainisc160d86:main:
this PR's head:
Not tested
GetThreadName/SetThreadName: the smoke run is a regression check only.AI use: Claude Code (Claude Opus 5.5) built the PR, ran the tests and both smoke runs, read the logs and wrote this report; I checked it before posting.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:47:33Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T04:44:27Z.
PR #1684 verification
Clean head
bb6f91b58e8d9942abe80a3ff4f88f218e447581on STOR-WINLAB. Windows 11 x64 (10.0.26200.9974), AMD Ryzen 7 3800X, Intel Arc A770 (16 GB, driver 32.0.101.9175), DXC 1.9.2609.5, and rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc).Tested
cargo build --workspaceandcargo test --workspace --no-runboth exited 0 outside the Arc lock. Test compilation produced 19 test binaries. Dev and test profiles were unoptimized, with debug info and incremental compilation disabled.cargo test -p xcl --lib hle::kernelx::tests::get_thread_name_sizing_truncation_and_errors -- --exact --nocapturewithXCL_ADAPTER=NONE_CPU_ONLYoutside the lock. 1 passed, 0 failed, 0 ignored, 0 explicit skips. The test incrates/xcl/src/hle/kernelx.rsverified that bothGetThreadNameandSetThreadNamereturn FALSE and setERROR_INVALID_HANDLEfor a null thread handle. It also checked name round trips, empty names, buffer sizing, and null-buffer validation.cargo test --workspace --no-fail-fast -- --test-threads=4ran once insideInvoke-ArcTest.ps1withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1. Exit 101. The 20 result summaries inpr1684-suite.log(19 test binaries and one doc-test harness) totaled 840 passed, 18 failed, and 42 ignored. The thread-name test passed again.Workspace failures and skips
CreateComputePipelineStateerror0x80070057. The other four reported output mismatches involving fused multiply-add, implicit mip LOD, f16 output, and wave64 pixel reductions. One end-to-end test failed because the test title'sRSSetDepthBiasXcheck read a blue pixel where it expected green.SKIPPED. The reasons were unavailable wave64 (2), tiled-resource tier below 2 (1), unavailable heap windows (1), and missing debug-layer support (2). These skips provide no coverage.Not tested
Matched
mainrun, retail title smoke, and other GPUs.XCL_SAMPLE_*inputs were unset. The workspace failures have no matched baseline for comparison.AI use
T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1684-suite.logand published.upstream-sync referenced this pull request2026-11-25 07:04:28 +00:00
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T13:38:05Z.
Independent desktop NVIDIA verification of PR #1684 at head
bb6f91b58e8d9942abe80a3ff4f88f218e447581(1commit; exact parent & merge-base:c160d86ef2efe3a07e4dfb473e4fa72eafb413c0, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted tests & build (
bb6f91b5)cargo test --release -p xcl --lib -- --nocapture get_thread_name_sizing_truncation_and_errors(3 consecutive runs)1 passed; 0 failed; 0 ignored; 830 filtered out× 3 (0.00s,0.00s,0.00s,0skipped)cargo test --release -p xcl --lib -- --nocapture hle::kernelx::(3 consecutive runs)31 passed; 0 failed; 1 ignored; 799 filtered out× 3 (0.21s,0.21s,0.22s,0runtime skips;1pre-existing#[ignore]timing harnessscatter_timing)cargo build --release -p xcl1m 25s, exit0,0new warnings inkernelx.rs)Paired quiet 60 s retail smoke (
title: 29640639)(Note:
scripts/smoke.ps1atc160d86epredates9683e7a6and printed the local folder basename ontitle:; replaced below with the standard9683e7a6title hash29640639, with all measured fields verbatim.)Exact parent & merge-base (
c160d86ef2efe3a07e4dfb473e4fa72eafb413c0, cached baseline on the same machine):PR #1684 (
bb6f91b58e8d9942abe80a3ff4f88f218e447581):Limits of coverage
get_thread_name_sizing_truncation_and_errorsand all31activehle::kernelx::tests (31/31executed,0runtime skips;1pre-existing#[ignore]scatter_timing) passed3/3on native Windows 1126200, directly verifying thathresult_to_win32mapsHRESULT_FROM_NTfailures fromGetThreadDescription/SetThreadDescriptionviaRtlNtStatusToDosErrortoERROR_INVALID_HANDLEon null handles.HRESULT_FROM_NTfailure codes beyond invalid thread handles were not individually probed, and the 60 s retail smoke confirms overall runtime stability (0device removals,0crashes, steady 60 Hz); single-run frame/commit delta vs. the cached parent reflects normal startup variance.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T14:12:36Z.
merge-check claim
head:
bb6f91b58eImported from ivall/xcl. Originally posted by throny on 2026-11-28T14:26:28Z.
merge-check
base:
b937fbabhead:
bb6f91b58emerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2140 passed, 1 failed, 48 ignored (26 SKIPPED lines). The one failure is gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions, which fails on main without this PR too (reported on #3093) and in every tree of this batch; the nine failures main had since #2959 are gone at
b937fbab. I did not runb937fbabalone: the last base-only run ise13d6250(2130 passed, 10 failed, 48 ignored).review: none. For an HRESULT that carries an NT status the helper now clears the marker bit and maps the status through RtlNtStatusToDosError, so an invalid handle comes out as ERROR_INVALID_HANDLE; the import joins the existing ntdll block, and the helper is used by SetThreadName and GetThreadName only.
performance: none (error path only).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-30T01:04:34Z.
merge-check
base:
53e85fb124head:
bb6f91b58emerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2792 passed, 1 failed, 49 ignored; SKIPPED: 29 (mostly "no wave64"); failing:
hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, which fails on the base53e85fbalone too (#2369's test againstlate_release, see #2369), not this PRreview: none blocking, after reading the whole diff (
kernelx.rs).HRESULT_FROM_NTsets bit 28, so clearing it gives the NTSTATUS back forRtlNtStatusToDosError(in ntdll with the otherRtl*imports). In Rust&binds tighter than!=, so the test is(hr & 0x1000_0000) != 0. An unknown status maps toERROR_MR_MID_NOT_FOUND, still a nonzero error.get_thread_name_sizing_truncation_and_errorspasses 3/3; with the new branch disabled (scratch) it fails (left: 87,ERROR_INVALID_PARAMETERinstead ofERROR_INVALID_HANDLE).performance: none (error path only).
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug / Claude Code (Claude Opus 5.5)