test: localised to FSdfCarveOp — now testing inlining context, the right variable
The SDF is bit-identical on 126 of 126 mismatches (0xBFE1C886 both sides), so the
lattice, hashes, edge set and VoxelSDF::Capsule are exactly right. The entire
difference is in FSdfCarveOp, whose expression is character-identical to the
original and whose inputs are bit-identical.
Identical inputs plus identical expression plus different output means the
arithmetic is being EVALUATED differently. SmoothStep01 is x*x*(3.0f - 2.0f*x),
and 3.0f - 2.0f*x is exactly the shape MSVC fuses into an FMA: one rounding
instead of two, ~1 ULP.
Why the three-way missed this, recorded because it is a reasoning error rather
than a coding one: A and C are both straight-line inlined code, while B goes
through a virtual IVoxelDensityOp call, so FSdfCarveOp::Eval is compiled
out-of-line and can get a different contraction decision. The three-way tested
whether the TRANSLATION UNIT boundary changes the result -- it does not -- but the
real variable is the OPTIMISATION CONTEXT. I built a clean experiment for the
wrong variable and then believed its answer. Hypothesis 3 was right about the
mechanism and wrong about the test.
The new experiment isolates exactly that: the same carve expression, same TU,
once FORCEINLINE and once FORCENOINLINE.
differ -> contraction confirmed, the port has NO bug, accept the ULP floor
identical -> contraction is not it, and FSdfCarveOp has a real logic bug that
has survived four readings
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -589,3 +589,45 @@ immediately.
|
||||
**Next single action:** rebuild, read `FIRST B-vs-C MISMATCH`. It names the file to open.
|
||||
|
||||
---
|
||||
|
||||
## 2026-07-27 — LOCALISED to the carve. Testing the right variable this time.
|
||||
|
||||
**The diagnostic pinned it exactly:**
|
||||
|
||||
```
|
||||
SDF stack -1.76393199 [0xBFE1C886] verbatim -1.76393199 [0xBFE1C886] IDENTICAL
|
||||
MC stack 7.83939362 [0x40FADC50] verbatim 7.83939266 [0x40FADC4E] 2 ULP apart
|
||||
across all mismatches: SDF differs 0, SDF identical but density differs 126
|
||||
```
|
||||
|
||||
So the lattice, the hashes, the edge set and `VoxelSDF::Capsule` are all **exactly right** — 126 of
|
||||
126. The entire difference is in `FSdfCarveOp`, whose expression is character-identical to the
|
||||
original and whose inputs (`Sdf`, `Blend` 2.0, `BaseDensity` 8) are bit-identical.
|
||||
|
||||
**Identical inputs + identical expression + different output ⇒ the arithmetic is being *evaluated*
|
||||
differently.** And `SmoothStep01` is `x * x * (3.0f - 2.0f * x)` — `3.0f - 2.0f*x` is exactly the
|
||||
shape MSVC fuses into an FMA, which is one rounding instead of two: **~1 ULP.**
|
||||
|
||||
**Why the three-way missed it — worth recording, because it is a reasoning error, not a coding one.**
|
||||
`A` (GetMazeDensity) and `C` (the verbatim copy) are both straight-line, inlined code. `B` goes
|
||||
through a **virtual** `IVoxelDensityOp` call, so `FSdfCarveOp::Eval` is compiled out-of-line and can
|
||||
get a different contraction decision. The three-way tested *"does the translation-unit boundary
|
||||
change the result?"* — it does not — but the real variable is *"does the optimisation context change
|
||||
the result?"*. **I designed a clean experiment for the wrong variable, and then believed its answer.**
|
||||
Hypothesis 3 was not wrong about the mechanism (`/fp:fast` contraction); it was wrong about the test.
|
||||
|
||||
**The experiment now added** isolates exactly that variable: the same carve expression, in the same
|
||||
translation unit, once `FORCEINLINE` and once `FORCENOINLINE`.
|
||||
|
||||
- **inlined != FORCENOINLINE** ⇒ FP contraction confirmed. **The port has no bug** — the operator
|
||||
stack is arithmetically correct and the residue is unavoidable wherever an op is a virtual call.
|
||||
Then: correct the docs with the *real* reason, accept the ULP floor, move on to step 3.
|
||||
- **inlined == FORCENOINLINE** ⇒ contraction is not it, and there is a real logic bug in
|
||||
`FSdfCarveOp` that has now survived four readings.
|
||||
|
||||
**UNVERIFIED:** the experiment.
|
||||
|
||||
**Next single action:** rebuild, read `INLINING EXPERIMENT`. Either way the answer is final — the
|
||||
inputs are proven bit-identical, so only the evaluation can differ.
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user