From 5a50edb2d2f93e02c6d42b1cf7f6c4c227b8e61f Mon Sep 17 00:00:00 2001 From: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com> Date: Mon, 16 Nov 2026 07:41:09 -0500 Subject: [PATCH 1/2] Model K: k_approx create note names the option without a claim of exactness The player-visible create note of the opt-in k_approx option now reads "(opt-in faster approximation; the default is the standard path)". The wording rule avoids claims of exactness in player-visible text. Tests: test_k_option_text.py (new, host): the note's fixed part carries the new wording and no "exact"; test_k_runtime_d3d12.py test_k_approx_each_tag checks the note on a device. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com> --- clean/k/runtime/runtime_k.cpp | 2 +- clean/k/tests/test_k_option_text.py | 32 +++++++++++++++++++++++++++ clean/k/tests/test_k_runtime_d3d12.py | 2 ++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 clean/k/tests/test_k_option_text.py diff --git a/clean/k/runtime/runtime_k.cpp b/clean/k/runtime/runtime_k.cpp index ed0d6424..067ab6e0 100644 --- a/clean/k/runtime/runtime_k.cpp +++ b/clean/k/runtime/runtime_k.cpp @@ -523,7 +523,7 @@ bool KRuntime::create(const WgRtConfig& c, Device* dev, AllocFn alloc_fn, bool e if (approx_a2_ && !compact_head_) return fail("model K: k_approx=a2 needs the compact head (k_head=compact, the default)"); approx_note_ = std::string("model K: close approximation k_approx=") + (approx_a1_ ? "a1" : "") + (approx_a1_ && approx_a2_ ? "," : "") + (approx_a2_ ? "a2" : "") + - " (opt-in, not bit-exact; the default path is exact)" + + " (opt-in faster approximation; the default is the standard path)" + (approx_a1_ ? std::string("; a1 applies to the tiled input stage, frames on the legacy input path " "run the exact input stage") : std::string()); diff --git a/clean/k/tests/test_k_option_text.py b/clean/k/tests/test_k_option_text.py new file mode 100644 index 00000000..8dda139a --- /dev/null +++ b/clean/k/tests/test_k_option_text.py @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: MIT +"""Model K's player-visible option text (host check, no GPU). + +The create note of the opt-in k_approx option (clean/k/runtime/runtime_k.cpp, approx_note_) reaches the player's log +through the front end. It names the option as a faster approximation and the default as the standard path; it makes no +claim of exactness (the project's wording rule). The note itself is checked on a device by +clean/k/tests/test_k_runtime_d3d12.py test_k_approx_each_tag. + +Run: python -m unittest clean.k.tests.test_k_option_text +""" +import os +import re +import unittest + +ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) + + +class TestKOptionText(unittest.TestCase): + def test_k_approx_note_wording(self): + with open(os.path.join(ROOT, "clean", "k", "runtime", "runtime_k.cpp"), encoding="utf-8") as f: + src = f.read() + m = re.search(r"approx_note_ = std::string\(\"model K: close approximation k_approx=\"\)(.*?);\n", src, re.S) + self.assertIsNotNone(m, "approx_note_ assignment not found") + stmt = m.group(1) + fixed = stmt.split("(approx_a1_ ? std::string(")[0] # the part every k_approx note carries + self.assertIn('" (opt-in faster approximation; the default is the standard path)"', fixed) + self.assertNotIn("exact", fixed) + self.assertNotIn("default path is exact", src) + + +if __name__ == "__main__": + unittest.main() diff --git a/clean/k/tests/test_k_runtime_d3d12.py b/clean/k/tests/test_k_runtime_d3d12.py index 6070a6f4..4f31df9b 100644 --- a/clean/k/tests/test_k_runtime_d3d12.py +++ b/clean/k/tests/test_k_runtime_d3d12.py @@ -408,6 +408,8 @@ def test_k_approx_each_tag(self): self.assertEqual(got["k_approx"], tags) self.assertEqual(len(got["notes"]), 1, got) self.assertIn("close approximation k_approx=" + tags, got["notes"][0]) + self.assertIn("(opt-in faster approximation; the default is the standard path)", got["notes"][0]) + self.assertNotIn("default path is exact", got["notes"][0]) self.need_dev_build() fb = self.leg("k_approx=a1,a2;k_smx_test=mix_fail") self.assertTrue(fb["ok"], fb) From 071a940f81717b41d178ec3fb27e14a7dae055f3 Mon Sep 17 00:00:00 2001 From: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com> Date: Mon, 16 Nov 2026 07:44:55 -0500 Subject: [PATCH 2/2] Model K: the mode line and the a1 lines name the standard path The front end's K mode line reads ", the standard path" for the default and ", an approximation (opt-in)" for an opt-in mode, and k_approx=a1's create note and its legacy-input line say such frames run the standard input stage. Player-visible text; the wording rule avoids claims of exactness. Tests: test_k_option_text.py covers the a1 lines and the mode line; test_k_approx_executor.py reads the new mode line. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com> --- clean/k/runtime/runtime_k.cpp | 4 ++-- clean/k/tests/test_k_approx_executor.py | 8 ++++---- clean/k/tests/test_k_option_text.py | 23 ++++++++++++++++++++--- clean/runtime/interop/backend.cpp | 2 +- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/clean/k/runtime/runtime_k.cpp b/clean/k/runtime/runtime_k.cpp index 067ab6e0..76bb1133 100644 --- a/clean/k/runtime/runtime_k.cpp +++ b/clean/k/runtime/runtime_k.cpp @@ -525,7 +525,7 @@ bool KRuntime::create(const WgRtConfig& c, Device* dev, AllocFn alloc_fn, bool e (approx_a1_ && approx_a2_ ? "," : "") + (approx_a2_ ? "a2" : "") + " (opt-in faster approximation; the default is the standard path)" + (approx_a1_ ? std::string("; a1 applies to the tiled input stage, frames on the legacy input path " - "run the exact input stage") + "run the standard input stage") : std::string()); } const std::string krule = option(c, "k_expo_rule"); @@ -1247,7 +1247,7 @@ bool KRuntime::frame(const WgRtFrame& fr, const FrameIo* io) { // log, the first time in this context (take_frame_note) if (approx_a1_ && !use_tiled && !a1_legacy_noted_) { a1_legacy_noted_ = true; - frame_note_ = "model K: k_approx=a1 applies to the tiled input stage only; this context's frames on the legacy input path (a render size above 0.68 x the output, a jitter outside [-0.5, 0.5], or input_tiled=0) run the exact input stage (this line once per context)"; + frame_note_ = "model K: k_approx=a1 applies to the tiled input stage only; this context's frames on the legacy input path (a render size above 0.68 x the output, a jitter outside [-0.5, 0.5], or input_tiled=0) run the standard input stage (this line once per context)"; } // k_in_exact: the output colour taps by k_out_color (KFrame's exact plan), not by the tiled input kernel const bool use_tiled_color = use_tiled && !in_exact_ && !reset && 4LL * Bw_ >= W_ && 4LL * Bh_ >= H_; diff --git a/clean/k/tests/test_k_approx_executor.py b/clean/k/tests/test_k_approx_executor.py index 0d421346..804e0215 100644 --- a/clean/k/tests/test_k_approx_executor.py +++ b/clean/k/tests/test_k_approx_executor.py @@ -6,7 +6,7 @@ k_approx=a2 output form; the executor runs the direct one) runs test_interop_d3d12.exe's `matrix` case at 1080p (every usual upscaler-mode ratio, HDR and LDR, both declared maximum sizes): with nothing set every context is taken by the D3D12 executor and its frame runs (the executor's warm-up does not -compile the unselected form) and its mode line names the exact path; with k_approx=a2 every context is refused, naming +compile the unselected form) and its mode line names the standard path; with k_approx=a2 every context is refused, naming the shader. The unchanged build passes with k_approx=a2 (control: the refusal comes from the changed byte) and its mode line names k_approx=a2 and an approximation. @@ -84,17 +84,17 @@ def test_selected_form_runs(self): self.assertTrue(out.rstrip().endswith("PASS"), out) modes = mode_lines(out) self.assertEqual(len(modes), 20, modes) - self.assertTrue(all(";k_approx=a2;" in m and "an approximation (not bit-exact)" in m for m in modes), modes) + self.assertTrue(all(";k_approx=a2;" in m and "an approximation (opt-in)" in m for m in modes), modes) def test_unselected_form_is_not_prepared(self): - """The changed shader, nothing set: every context runs on the exact path (the warm-up skips the form).""" + """The changed shader, nothing set: every context runs on the standard path (the warm-up skips the form).""" rc, out = self.run_case(True, []) self.assertEqual(rc, 0, out) self.assertTrue(out.rstrip().endswith("PASS"), out) self.assertNotIn("integrity mismatch", out) modes = mode_lines(out) self.assertEqual(len(modes), 20, modes) - self.assertTrue(all("k_approx" not in m and "the exact path" in m for m in modes), modes) + self.assertTrue(all("k_approx" not in m and "the standard path" in m for m in modes), modes) def test_a1_legacy_line_once_per_context(self): """The a1 contract through the executor: the matrix's DLAA contexts (render size = output: the legacy input path) diff --git a/clean/k/tests/test_k_option_text.py b/clean/k/tests/test_k_option_text.py index 8dda139a..8d154615 100644 --- a/clean/k/tests/test_k_option_text.py +++ b/clean/k/tests/test_k_option_text.py @@ -1,9 +1,10 @@ # SPDX-License-Identifier: MIT """Model K's player-visible option text (host check, no GPU). -The create note of the opt-in k_approx option (clean/k/runtime/runtime_k.cpp, approx_note_) reaches the player's log -through the front end. It names the option as a faster approximation and the default as the standard path; it makes no -claim of exactness (the project's wording rule). The note itself is checked on a device by +The create note of the opt-in k_approx option (clean/k/runtime/runtime_k.cpp, approx_note_), its a1 legacy-input line +and the front end's K mode line (clean/runtime/interop/backend.cpp) reach the player's log. They name the option as a +faster approximation and the default as the standard path (input stage); they make no claim of exactness (the project's +wording rule). The note itself is checked on a device by clean/k/tests/test_k_runtime_d3d12.py test_k_approx_each_tag. Run: python -m unittest clean.k.tests.test_k_option_text @@ -26,6 +27,22 @@ def test_k_approx_note_wording(self): self.assertIn('" (opt-in faster approximation; the default is the standard path)"', fixed) self.assertNotIn("exact", fixed) self.assertNotIn("default path is exact", src) + a1 = stmt.split("(approx_a1_ ? std::string(")[1] # the a1 part of the note + self.assertIn("run the standard input stage", a1) + self.assertNotIn("exact", a1) + m = re.search(r'frame_note_ = "(model K: k_approx=a1 [^"]*)";', src) + self.assertIsNotNone(m, "the a1 legacy-input line not found") + self.assertIn("run the standard input stage", m.group(1)) + self.assertNotIn("exact", m.group(1)) + + def test_k_mode_line_wording(self): + """The front end's K mode line (clean/runtime/interop/backend.cpp) names the default as the standard path and an + opt-in mode as an approximation, with no claim of exactness.""" + with open(os.path.join(ROOT, "clean", "runtime", "interop", "backend.cpp"), encoding="utf-8") as f: + src = f.read() + m = re.search(r'network model K mode: network=.*?\(exact \? "([^"]*)" : "([^"]*)"\)', src, re.S) + self.assertIsNotNone(m, "the K mode line not found") + self.assertEqual(m.groups(), (", the standard path", ", an approximation (opt-in)")) if __name__ == "__main__": diff --git a/clean/runtime/interop/backend.cpp b/clean/runtime/interop/backend.cpp index 4efe2ebe..7719176d 100644 --- a/clean/runtime/interop/backend.cpp +++ b/clean/runtime/interop/backend.cpp @@ -803,7 +803,7 @@ class Context { say(WG_LOG_INFO, std::string("network model K mode: network=") + (net.empty() ? "fused" : net) + ";k_fast=" + (fast.empty() ? "0" : fast) + (approx.empty() ? std::string() : ";k_approx=" + approx) + ";handover=" + (staged_out_ ? "staged" : "fence") + - (exact ? ", the exact path" : ", an approximation (not bit-exact)") + + (exact ? ", the standard path" : ", an approximation (opt-in)") + (k_default_ ? " (the default mode; network=fused8;k_fast=1;handover=staged selects the " "fastest mode)" : " (from the options)"));