<feed xmlns='http://www.w3.org/2005/Atom'>
<title>demo.git/workspaces/main/shaders/cnn_v2, branch main</title>
<subtitle>Vide-coded 64k demo system</subtitle>
<id>https://git.taar-o.com/demo.git/atom?h=main</id>
<link rel='self' href='https://git.taar-o.com/demo.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/'/>
<updated>2026-02-15T17:44:17Z</updated>
<entry>
<title>refactor(cnn): isolate CNN v2 to cnn_v2/ subdirectory</title>
<updated>2026-02-15T17:44:17Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-15T17:44:17Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=161a59fa50bb92e3664c389fa03b95aefe349b3f'/>
<id>urn:sha1:161a59fa50bb92e3664c389fa03b95aefe349b3f</id>
<content type='text'>
Move all CNN v2 files to dedicated cnn_v2/ directory to prepare for CNN v3 development. Zero functional changes.

Structure:
- cnn_v2/src/ - C++ effect implementation
- cnn_v2/shaders/ - WGSL shaders (6 files)
- cnn_v2/weights/ - Binary weights (3 files)
- cnn_v2/training/ - Python training scripts (4 files)
- cnn_v2/scripts/ - Shell scripts (train_cnn_v2_full.sh)
- cnn_v2/tools/ - Validation tools (HTML)
- cnn_v2/docs/ - Documentation (4 markdown files)

Changes:
- Update CMake source list to cnn_v2/src/cnn_v2_effect.cc
- Update assets.txt with relative paths to cnn_v2/
- Update includes to ../../cnn_v2/src/cnn_v2_effect.h
- Add PROJECT_ROOT resolution to Python/shell scripts
- Update doc references in HOWTO.md, TODO.md
- Add cnn_v2/README.md

Verification: 34/34 tests passing, demo runs correctly.

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>Fix: CNN v2 compute shader validation error</title>
<updated>2026-02-14T11:40:57Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-14T11:40:57Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=48beb6b1c10d7ca42205000a5bb420a1e3282d92'/>
<id>urn:sha1:48beb6b1c10d7ca42205000a5bb420a1e3282d92</id>
<content type='text'>
Replace textureSample() with textureSampleLevel() in compute shader.
textureSample() requires derivative calculations only available in fragment
shaders. Compute shaders must explicitly specify mip level.

Fixes: DemoEffectsTest CNNv2Effect initialization

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>CNN v2: bilinear mip-level sampling and UI improvements</title>
<updated>2026-02-14T06:24:51Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-14T06:22:17Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=0f53ed1ed8ed7c07cd7ea8e88e21b5be5d5494e5'/>
<id>urn:sha1:0f53ed1ed8ed7c07cd7ea8e88e21b5be5d5494e5</id>
<content type='text'>
**CNN v2 Changes:**
- Replace point sampling with bilinear interpolation for mip-level features
- Add linear sampler (binding 6) to static features shader
- Update CNNv2Effect, cnn_test, and HTML tool

**HTML Tool UI:**
- Move controls to floating bottom bar in central view
- Consolidate video controls + Blend/Depth/Save PNG in single container
- Increase left panel width: 300px → 315px (+5%)
- Remove per-frame debug messages (visualization, rendering logs)

**Technical:**
- WGSL: textureSample() with linear_sampler vs textureLoad()
- C++: Create WGPUSampler with Linear filtering
- HTML: Change sampler from 'nearest' to 'linear'

handoff(Claude): CNN v2 now uses bilinear mip-level sampling across all tools
</content>
</entry>
<entry>
<title>Replace hard clamp with sigmoid activation in CNN v2</title>
<updated>2026-02-14T01:12:12Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-14T01:12:12Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=043044ae7563c2f92760c428765e35b411da82ea'/>
<id>urn:sha1:043044ae7563c2f92760c428765e35b411da82ea</id>
<content type='text'>
Fixes training collapse where p1/p2 channels saturate due to gradient
blocking at clamp boundaries. Sigmoid provides smooth [0,1] mapping
with continuous gradients.

Changes:
- Layer 0: clamp(x, 0, 1) → sigmoid(x)
- Final layer: clamp(x, 0, 1) → sigmoid(x)
- Middle layers: ReLU unchanged (already stable)

Updated files:
- training/train_cnn_v2.py: PyTorch model activations
- workspaces/main/shaders/cnn_v2/cnn_v2_compute.wgsl: WGSL shader
- tools/cnn_v2_test/index.html: HTML validation tool
- doc/CNN_V2.md: Documentation

Validation:
- Build clean (no shader errors)
- 34/36 tests pass (2 unrelated script tests fail)
- 10-epoch training: loss 0.153 → 0.088 (good convergence)
- cnn_test processes images successfully

Breaking change: Old checkpoints trained with clamp() incompatible.
Retrain from scratch required.

handoff(Claude): CNN v2 sigmoid activation implemented and validated.
</content>
</entry>
<entry>
<title>CNN v2: Alpha channel depth handling and layer visualization</title>
<updated>2026-02-13T22:17:42Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-13T22:17:42Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=6fa9ccf86b0bbefb48cefae19d4162115a3d63d3'/>
<id>urn:sha1:6fa9ccf86b0bbefb48cefae19d4162115a3d63d3</id>
<content type='text'>
Training changes:
- Changed p3 default depth from 0.0 to 1.0 (far plane semantics)
- Extract depth from target alpha channel in both datasets
- Consistent alpha-as-depth across training/validation

Test tool enhancements (cnn_test):
- Added load_depth_from_alpha() for R32Float depth texture
- Fixed bind group layout for UnfilterableFloat sampling
- Added --save-intermediates with per-channel grayscale composites
- Each layer saved as 4x wide PNG (p0-p3 stacked horizontally)
- Global layers_composite.png for vertical layer stack overview

Investigation notes:
- Static features p4-p7 ARE computed and bound correctly
- Sin_20_y pattern visibility difference between tools under investigation
- Binary weights timestamp (Feb 13 20:36) vs HTML tool (Feb 13 22:12)
- Next: Update HTML tool with canonical binary weights

handoff(Claude): HTML tool weights update pending - base64 encoded
canonical weights ready in /tmp/weights_b64.txt for line 392 replacement.

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>CNN v2: Fix WebGPU validation error in uniform buffer alignment</title>
<updated>2026-02-13T16:16:56Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-13T16:16:56Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=f6b3ea72a03850654b69986bc82bb249aaabe2e3'/>
<id>urn:sha1:f6b3ea72a03850654b69986bc82bb249aaabe2e3</id>
<content type='text'>
Fix two issues causing validation errors in test_demo:
1. Remove redundant pipeline creation without layout (static_pipeline_)
2. Change vec3&lt;u32&gt; to 3× u32 fields in StaticFeatureParams struct

WGSL vec3&lt;u32&gt; aligns to 16 bytes (std140), making struct 32 bytes,
while C++ struct was 16 bytes. Explicit fields ensure consistent layout.

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>CNN v2: Change feature #6 from sin(10*x) to sin(20*y)</title>
<updated>2026-02-13T15:57:29Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-13T15:57:29Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=0793c20c1dd0c5f0c535f7da90337081939b2cfc'/>
<id>urn:sha1:0793c20c1dd0c5f0c535f7da90337081939b2cfc</id>
<content type='text'>
Update positional encoding to use vertical coordinate at higher frequency.

Changes:
- train_cnn_v2.py: sin10_x → sin20_y (computed from uv_y)
- cnn_v2_static.wgsl: sin10_x → sin20_y (computed from uv_y)
- index.html: sin10_x → sin20_y (STATIC_SHADER)
- CNN_V2.md: Update feature descriptions and examples
- CNN_V2_BINARY_FORMAT.md: Update static features documentation

Feature vector: [p0, p1, p2, p3, uv_x, uv_y, sin20_y, bias]

Rationale: Higher frequency (20 vs 10) + vertical axis provides better
spatial discrimination for position encoding.

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>CNN v2: Add TODO for flexible feature layout in binary format v3</title>
<updated>2026-02-13T15:54:47Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-13T15:54:47Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=4c21145ce5e408dd38e8374eed320fcfac97c0c4'/>
<id>urn:sha1:4c21145ce5e408dd38e8374eed320fcfac97c0c4</id>
<content type='text'>
Document future enhancement for arbitrary feature vector layouts.

Proposed feature descriptor in binary format v3:
- Specify feature types, sources, and ordering
- Enable runtime experimentation without shader recompilation
- Examples: [R,G,B,dx,dy,uv_x,bias] or [mip1.r,mip2.g,laplacian,uv_x,sin20_x,bias]

Added TODOs in:
- CNN_V2_BINARY_FORMAT.md: Detailed proposal with struct layout
- CNN_V2.md: Future extensions section
- train_cnn_v2.py: compute_static_features() docstring
- cnn_v2_static.wgsl: Shader header comment
- cnn_v2_effect.cc: Version check comment

Current limitation: Hardcoded [p0,p1,p2,p3,uv_x,uv_y,sin10_x,bias] layout.

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>CNN v2: Add mip-level support to runtime effect</title>
<updated>2026-02-13T15:48:02Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-13T15:48:02Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=ced248b0a8973db6d11b79e8290e2f5bb17ffcaa'/>
<id>urn:sha1:ced248b0a8973db6d11b79e8290e2f5bb17ffcaa</id>
<content type='text'>
Binary format v2 includes mip_level in header (20 bytes, was 16).
Effect reads mip_level and passes to static features shader via uniform.
Shader samples from correct mip texture based on mip_level.

Changes:
- export_cnn_v2_weights.py: Header v2 with mip_level field
- cnn_v2_effect.h: Add StaticFeatureParams, mip_level member, params buffer
- cnn_v2_effect.cc: Read mip_level from weights, create/bind params buffer, update per-frame
- cnn_v2_static.wgsl: Accept params uniform, sample from selected mip level

Binary format v2:
- Header: 20 bytes (magic, version=2, num_layers, total_weights, mip_level)
- Backward compatible: v1 weights load with mip_level=0

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>CNNv2Effect: Document per-layer kernel sizes support</title>
<updated>2026-02-13T11:43:03Z</updated>
<author>
<name>skal</name>
<email>pascal.massimino@gmail.com</email>
</author>
<published>2026-02-13T11:43:03Z</published>
<link rel='alternate' type='text/html' href='https://git.taar-o.com/demo.git/commit/?id=5a17ed664edc5a66d3b43d3596c389ab58a4ec19'/>
<id>urn:sha1:5a17ed664edc5a66d3b43d3596c389ab58a4ec19</id>
<content type='text'>
Updated comments to clarify that per-layer kernel sizes are supported.
Code already handles this correctly via LayerInfo.kernel_size field.

Changes:
- cnn_v2_effect.h: Add comment about per-layer kernel sizes
- cnn_v2_compute.wgsl: Clarify LayerParams provides per-layer config

Co-Authored-By: Claude Sonnet 4.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
</feed>
