docs(debt): correct stale f64 denormal and RSRC1 float mode statements #8281
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8281"
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 thuanquang on 2026-10-20T08:31:11Z.
What
Four technical-debt statements are stale: three about f64 denormals (two went stale when #7036 and #7042 merged) and one about where a raw compute program's float mode comes from.
docs/dev/debt/libSceAgcDriver.md, shader float mode entry: "Other f64 arithmetic does not model these denormal controls." Onmainthe translation reads theFLOAT_MODEf16/f64 denormal field forv_min_f64andv_max_f64(this entry), the f64 compares,v_floor_f64,v_ceil_f64,v_fract_f64,v_frexp_mant_f64,v_frexp_exp_i32_f64,v_add_f64,v_mul_f64,v_div_fixup_f64andds_min/max/cmpst_f64, each with its own entry inshader.md. The sentence now names the f64 arithmetic that still does not read the field:v_fma_f64,v_div_fmas_f64,v_div_scale_f64,v_ldexp_f64,v_rcp_f64,v_rsq_f64,v_sqrt_f64andv_trig_preop_f64.docs/dev/debt/shader.md, the #7036 entry: "and 16 of them with neg and abs modifiers". The modifier run used 13 of the 23 values plus -1.5 (0xbff8000000000000), 2.75 (0x4006000000000000) and 1 - 2^-53 (0x3fefffffffffffff). The entry now says so.docs/dev/debt/shader.md, thev_fma_f64andv_div_fmas_f64entry: "Elsewhere (including lavapipe), the driver may flush f64 subnormals, andagc_driver_f64_fma_subnormalsis skipped."F64FmaSubnormals.cpp(lines 216-233 onmain) skips only without a device orshaderFloat64, or when a row differs and the target has no f64DenormPreserve; otherwise it runs.5e00b269c(#2977) removed the unconditional skip without updating this sentence, and inmain's CI run 39390834287 the linux job, which runs on lavapipe, passes it (Test #524: agc_driver_f64_fma_subnormals ... Passed 0.14 sec). The sentence now reads "Elsewhere the driver may flush f64 subnormals, andagc_driver_f64_fma_subnormalsskips if it does."docs/dev/debt/libSceAgcDriver.md, the same shader float mode entry: "A title that rewrites RSRC1 at run time, or a raw compute program with no header, compiles with that mode or none." Sinceee1e34197("take an unregistered compute shader's float mode from the live COMPUTE_PGM_RSRC1", merged in #5180),Dispatch.cpp:167builds the float mode withDispatchFloatMode(ShaderRegistry.cpp:1120-1123), which decodes the liveCOMPUTE_PGM_RSRC1when the shader is not registered;testDispatchFloatModeintests/Submit.cppchecks it. Registered shaders and draws (DrawCapture.cpp:25) still take the header's mode. The sentence now reads "A registered shader keeps that mode when a title rewrites RSRC1; a raw compute program takes the live RSRC1."Docs only. No code changes.
Tested
Not built or run, because only docs change. What was checked:
main661f8b717, by reading the code (none of the files named here changed between it and9d6adeb550, which this branch is now on, exceptDispatch.cpp, where the call is now at line 167): the field (floatMode & 0x40/0x80) is read infloat64Operation(inputs of add, mul and frexp_exp, and add/mul results throughflushTinyF64Result),float64Unary(inputs of floor, ceil, fract and frexp_mant, and the fract result),minMaxF64andvDivFixupF64inFloat64Instructions.cpp,emitFloat64CompareinCompareInstructions.cpp, andfloatAtomicFlushinMemoryResourceHelpers.cpp(the f64 shared, buffer and flat atomics). The fma (float64Operationwithout the flush), div_fmas, div_scale, ldexp, rcp, rsq, sqrt and trig_preop paths do not read it. The SPIR-V backend receives no guest float mode for those opcodes.v_trunc_f64andv_rndne_f64(their entry says the results are the same either way), and the conversions andv_cmp_class_f64. A local sweep from 2026-10-17 (RX 6700 XT through HIP, against the recompiler before #7036 and #7042) found thatv_cvt_i32_f64,v_cvt_u32_f64andv_cmp_class_f64matched the GPU in all four f16/f64 denormal modes.v_cvt_f32_f64differed on 3 of 29 rows, the same count in every f16/f64 mode, and on none with f32 denormals flushed. In the same sweep,v_ldexp_f64andv_fma_f64matched the GPU in mode 3 and not in modes 0 to 2.v_div_scale_f64, with src0 equal to the denominator or to the numerator, differed on 175 of 529 rows in modes 0 and 2 and on none in mode 3.v_trig_preop_f64was not swept.-v[4:5]for floor, frexp_mant and frexp_exp,|v[4:5]|for ceil and-|v[4:5]|for fract, at IEEE 0 and 1 with denorm16 0 to 3. Compared with the 23-value list of the sweep script, 13 of the 16 are among the 23 and 3 are not. That run's rows were not saved.main865166414, and the call again on9d6adeb550, by readingDispatchFloatModeandRegisteredFloatModeinShaderRegistry.cpp, their callers inDispatch.cppandDrawCapture.cpp, andtestDispatchFloatModeintests/Submit.cpp.python tools/check_conventions.py --base origin/mainwith this title and body: 0 errors and 2debt-lengthwarnings: the shader float mode entry (3249 characters; 3151 before this change) and thev_fma_f64entry (1081 characters; 1097 before, so this change shortens it).maine78acf4bdafor the conflict with #8339 (merged) indocs/dev/debt/shader.md: main's text is kept and this PR's change is unchanged; the statements were rechecked on that commit.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 harisibrar1 on 2026-10-21T05:59:44Z.
Review: APPROVED
Checked against main:
FLOAT_MODEf16/f64 denormal field is read by add/mul (Float64Instructions.cpp:20,43), min/max (:55), floor/ceil/fract/frexp_mant (:83-88), div_fixup (:184), the f64 compares (CompareInstructions.cpp:229) and the f64 ds min/max/cmpst (SharedMemoryInstructions.cpp:216-226).v_fma_f64,v_ldexp_f64,v_rcp_f64,v_rsq_f64,v_sqrt_f64andv_trig_preop_f64take the no-flush paths atVectorInstructions.cpp:966-990, andv_div_fmas_f64andv_div_scale_f64have no floatMode reference.DispatchFloatMode(ShaderRegistry.cpp:837-840, used atDispatch.cpp:157) returns the registered header's mode when the shader is registered and decodes the liveCOMPUTE_PGM_RSRC1otherwise. Draws useRegisteredFloatModeonly (DrawCapture.cpp:25).tests/Submit.cpp:715-732pins both cases.F64FmaSubnormals.cpp:216-233skips only without Float64, or on a mismatch when the target lacks f64 DenormPreserve, so the old unconditional "is skipped" was stale. Not checked: the CI run and the 2026-10-17 sweep behind the "13 of 23" correction.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.