From bf33fee131b1eee03bc5a765ba360299bbcead06 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 21 Mar 2026 14:01:30 +0100 Subject: refactor(cnn_v3): code review — comments, simplifications, test fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C++: - cnn_v3_effect.cc: fix declare_nodes comment (output node declared by caller) - cnn_v3_effect.cc: add TODO(phase-7) marker for FiLM MLP replacement WGSL: - cnn_v3_bottleneck.wgsl: consolidate _pad fields onto one line, explain why array is invalid in uniform address space - cnn_v3_enc0.wgsl: fix "12xu8" → "12ch u8norm" in header comment - cnn_v3_dec0.wgsl: clarify parity note (sigmoid after FiLM+ReLU, not raw conv) - cnn_v3_common.wgsl: clarify unpack_8ch pack layout (low/high 16 bits) Python: - cnn_v3_utils.py: replace PIL-based _upsample_nearest (uint8 round-trip) with pure numpy index arithmetic; rename _resize_rgb → _resize_img (handles any channel count); add comment on normal zero-pad workaround - export_cnn_v3_weights.py: add cross-ref to cnn_v3_effect.cc constants; clarify weight count comments with Conv notation Test: - test_cnn_v3_parity.cc: enc0/dec1 layer failures now return 0 (were print-only) handoff(Gemini): CNN v3 review complete, 36/36 tests passing. --- cnn_v3/src/cnn_v3_effect.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cnn_v3/src') diff --git a/cnn_v3/src/cnn_v3_effect.cc b/cnn_v3/src/cnn_v3_effect.cc index 92178f7..759e7ef 100644 --- a/cnn_v3/src/cnn_v3_effect.cc +++ b/cnn_v3/src/cnn_v3_effect.cc @@ -198,11 +198,12 @@ void CNNv3Effect::declare_nodes(NodeRegistry& registry) { registry.declare_node(node_bottleneck_, NodeType::GBUF_RGBA32UINT, W / 4, H / 4); // dec1_tex: rgba16float half-res registry.declare_node(node_dec1_, NodeType::GBUF_ALBEDO, W / 2, H / 2); - // output_tex: rgba16float full-res (the declared output_nodes_[0]) + // output_nodes_[0]: rgba16float full-res — declared externally by caller } // --------------------------------------------------------------------------- -// set_film_params — simple linear mapping, no MLP yet +// set_film_params — simple linear mapping (placeholder, no MLP yet) +// TODO(phase-7): replace with CPU forward pass through cnn_v3_film_mlp.bin // --------------------------------------------------------------------------- void CNNv3Effect::upload_weights(WGPUQueue queue, const void* data, -- cgit v1.2.3