You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(semantic): add translator tests for v_mul_f64 - #5490
Adds support and regression tests for v_mul_f64 (double-precision floating-point multiply) in tools/rdna2spirv.py and tests/semantic/test_valu_mul_f64_hw.py.
tools/rdna2spirv.py: Lower v_mul_f64 to OpFMul %double with 64-bit pair operand checks and modifier support (neg, abs, clamp).
tests/semantic/test_valu_mul_f64_hw.py: Exercises tools/rdna2spirv.py via support.translate_lines(...) and validates execution results with support.mrt0_words(...).
Independent test on Apple M4 at head 83c84106, merged onto main 3faac557. Setup: macOS 27.2.1, MoltenVK 1.4.2, Python 3.15.2 and 3.12.16, SPIRV-Tools v2026.4. The runtime is main's build, since the PR has no C++.
test_valu_mul_f64_hw.py (10/10) and test_semantic_translator_use.py pass on both Python versions, and compileall is clean. The M4 has no shaderFloat64, so OpFMul %double runs only in the CPU interpreter here, not on the GPU.
Duplicate: this is the same change as test(semantic): add translator tests for v_mul_f64 #5433, from the same author with the same title, opened 11 minutes earlier. The translator hunks differ only in where the v_mul_f64 branch sits and in the destination n == 2 check. One of the two should probably be closed.
The f64 rounding mode is ignored. In the same block, v_add_f64 applies MODE FP_ROUND[3:2] through f64_add_mode (rdna2spirv.py:6667), and docs/design.md says s_round_mode accepts FP16/64 toward zero. v_mul_f64 doesn't apply it:
Program: s_round_mode 0xc followed by v_mul_f64 of 3.0 × fl(1/3); the exact product is 1 − 2^-54.
Translated result: 0x3ff0000000000000, the round-to-nearest-even result.
Toward zero would give 0x3fefffffffffffff.
Either raise Unsupported when self.round_mode is set, or round the product the way f64_add_mode rounds the sum.
The new d.get("n") != 2 destination check also covers v_add/rcp/rsq/sqrt_f64 now. v_cvt_f32_f64 returns before it, so that is fine.
v_mul_f64 occurs in 0 of the corpus's 25,734 listings. Corpus shard 0/64 gives 415/415 translated and valid, byte-identical to main.
GPU suite: 152/217 passed, 58 skipped, the same results as main (ps_f64_* are skipped because of Float64).
GPU data point at 83c84106 (RTX 5080, NVIDIA 615.78.08, Linux; built against main 3faac557, before the current conflict with main): a hand-written compute fixture gives the exact expected words for rounding, -|x|, a subnormal product and clamp (main refuses v_mul_f64), and run_gpu_tests.py --filter f64 passes 3/3.
Gap, confirmed on the GPU: after s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3 (FP_ROUND[3:2] = round toward zero), v_mul_f64 of 3.0 × 0.1 returns 0x3fd3333333333334 (the round-to-nearest result); toward zero is 0x3fd3333333333333. v_add_f64 in the same program does round toward zero, so the mode write itself works. This matches the CPU-side observation sovljanskii posted; this is the first hardware confirmation. AI-assisted (Claude Code).
This looks like a duplicate of #5433 (same author, opened 10 minutes earlier): both add v_mul_f64 to the same f64 branch of tools/rdna2spirv.py and both add tests/semantic/test_valu_mul_f64_hw.py. The rules differ only in placement and this one also requires d["n"] == 2. #5433 is mergeable and passes its tests here; this one conflicts with main. Suggest closing one, or folding the n == 2 check into #5433. AI-assisted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Adds support and regression tests for
v_mul_f64(double-precision floating-point multiply) intools/rdna2spirv.pyandtests/semantic/test_valu_mul_f64_hw.py.tools/rdna2spirv.py: Lowerv_mul_f64toOpFMul %doublewith 64-bit pair operand checks and modifier support (neg,abs,clamp).tests/semantic/test_valu_mul_f64_hw.py: Exercisestools/rdna2spirv.pyviasupport.translate_lines(...)and validates execution results withsupport.mrt0_words(...).tests/test_semantic_translator_use.py.Tested
python -m compileall -q tests toolspython -I tests/semantic/test_valu_mul_f64_hw.py(10/10 passed)python -I tests/test_semantic_translator_use.py(Passed)unittest,struct,math)