Skip to content

Fix critical resolution mismatch and memory tracking bugs - #4

Draft
vmanam0451 with Copilot wants to merge 4 commits into
mainfrom
copilot/compile-serious-logic-errors
Draft

Fix critical resolution mismatch and memory tracking bugs#4
vmanam0451 with Copilot wants to merge 4 commits into
mainfrom
copilot/compile-serious-logic-errors

Conversation

Copilot AI commented Dec 16, 2025

Copy link
Copy Markdown

Two serious logic errors causing runtime failures in the distributed path tracer:

1. Resolution Calculation Mismatch

Master and worker nodes calculated pixel array dimensions differently, causing out-of-bounds access:

// master.cpp - WAS: missing +1
this->resolution = math::uvec2(
    (m_worker_info.max_x - m_worker_info.min_x) + 1,  // NOW: matches worker
    (m_worker_info.max_y - m_worker_info.min_y) + 1
);

// worker.cpp - always had +1
this->resolution = fvec2(
    (info.max_x - info.min_x) + 1,
    (info.max_y - info.min_y) + 1
);

Workers generated rays for (max-min+1) × (max-min+1) pixels, but master allocated only (max-min) × (max-min) array → memory corruption during accumulation.

2. Memory Tracking Broken

Preprocessor never incremented current_size, breaking memory-based work distribution:

# WAS: current_size always 0, condition never triggers
if (current_size + prim_size) >= self.memory_per_worker_GB:
    
# NOW: properly tracks accumulated size
current_size += prim_size
if current_size >= self.memory_per_worker_GB:

Workers could exceed memory limits → OOM crashes.

Original prompt

Review my code.

Compile all SERIOUS logic errors.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 16, 2025 23:57
Co-authored-by: vmanam0451 <25410102+vmanam0451@users.noreply.github.com>
… worker

Co-authored-by: vmanam0451 <25410102+vmanam0451@users.noreply.github.com>
Co-authored-by: vmanam0451 <25410102+vmanam0451@users.noreply.github.com>
Copilot AI changed the title [WIP] Review code for serious logic errors Fix critical resolution mismatch and memory tracking bugs Dec 17, 2025
Copilot AI requested a review from vmanam0451 December 17, 2025 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants