summaryrefslogtreecommitdiff
path: root/tools/cnn_test.cc
AgeCommit message (Collapse)Author
34 hoursadd --save-intermediates to train.py and cnn_testskal
37 hoursfix: CNN test tool GPU readback with wgpuDevicePollskal
Fixed buffer mapping callback mode mismatch causing Unknown status. Changed from WaitAnyOnly+ProcessEvents to AllowProcessEvents+DevicePoll. Readback now functional but CNN output incorrect (all white). Issue isolated to tool-specific binding/uniform setup - CNNEffect in demo works correctly. Technical details: - WGPUCallbackMode_WaitAnyOnly requires wgpuInstanceWaitAny - Using wgpuInstanceProcessEvents with WaitAnyOnly never fires callback - Fixed by using AllowProcessEvents mode + wgpuDevicePoll - Removed debug output and platform warnings Status: 36/36 tests pass, readback works, CNN shader issue remains. handoff(Claude): CNN test tool readback fixed, output debugging needed
37 hoursdebug: Add shader load verification and GPU sync to CNN test toolskal
Debug additions: - Print loaded shader size (confirms assets work: 2274 bytes) - Add wgpuDevicePoll after each layer for GPU sync - Verify shader loading with null/empty checks Findings: - Shader loads correctly (2274 bytes) - GPU commands execute without validation errors - Pipeline compiles successfully - Output remains all-black despite correct architecture Likely causes: - Render setup differs from demo's CNNEffect - Possible issue with bind group bindings - Fragment shader may not be executing - Texture sampling might be failing Next steps: - Create minimal solid-color render test - Compare bind group setup with working CNNEffect - Add fragment shader debug output (if possible) - Test with demo's CNN effect to verify weights/shader work Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
37 hoursfix: CNN test tool ping-pong bug and RGBA16Float intermediatesskal
Bugfixes: - Fixed ping-pong logic: update current_input BEFORE flipping dst_idx - Use RGBA16Float for intermediate layers (preserve [-1,1] range from tanh) - Separate BGRA8Unorm final output texture for readback - Create two pipelines: intermediate (RGBA16Float) and final (BGRA8Unorm) - Fix all cleanup code to reference correct pipeline variables Implementation: - Intermediate textures use RGBA16Float to avoid clamping [-1,1] → [0,1] - Final layer renders to separate BGRA8Unorm texture - Correct texture view descriptors for each format - Layer 0-1: render to RGBA16Float ping-pong textures - Layer 2: render to BGRA8Unorm output texture Documentation: - Added CNN testing section to doc/HOWTO.md - Updated CNN_TEST_TOOL.md with ground-truth comparison workflow - Noted remaining black output bug (under investigation) Status: - Tool compiles and runs without GPU errors - Architecture correct: ping-pong, format conversion, separate pipelines - Output still all-black (unknown cause, needs debugging) - All 36 tests still pass handoff(Claude): CNN test tool bugfixes complete, black output remains Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
37 hoursfeat: Add CNN shader testing tool with GPU texture readbackskal
Core GPU Utility (texture_readback): - Reusable synchronous texture-to-CPU readback (~150 lines) - STRIP_ALL guards (0 bytes in release builds) - Handles COPY_BYTES_PER_ROW_ALIGNMENT (256-byte alignment) - Refactored OffscreenRenderTarget to use new utility CNN Test Tool (cnn_test): - Standalone PNG→3-layer CNN→PNG/PPM tool (~450 lines) - --blend parameter (0.0-1.0) for final layer mixing - --format option (png/ppm) for output format - ShaderComposer integration for include resolution Build Integration: - Added texture_readback.cc to GPU_SOURCES (both sections) - Tool target with STB_IMAGE support Testing: - All 36 tests pass (100%) - Processes 64×64 and 555×370 images successfully - Ground-truth validation setup complete Known Issues: - BUG: Tool produces black output (uninitialized input texture) - First intermediate texture not initialized before layer loop - MSE 64860 vs Python ground truth (expected <10) - Fix required: Copy input to intermediate[0] before processing Documentation: - doc/CNN_TEST_TOOL.md - Full technical reference - Updated PROJECT_CONTEXT.md and COMPLETED.md handoff(Claude): CNN test tool foundation complete, needs input init bugfix Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>