Skip to content

Unify per-lane address decoding - #563

Open
benlaflen wants to merge 7 commits into
accel-sim:devfrom
benlaflen:unify-address-decoding
Open

benlaflen wants to merge 7 commits into
accel-sim:devfrom
benlaflen:unify-address-decoding

Conversation

@benlaflen

Copy link
Copy Markdown

Includes patch from Issue #561 as well as a unified address decoding pipeline shared in tracer_nvbit and trace-parser

@JRPan JRPan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The #561 logic is right, but this doesn't build yet (the post-processor and trace-parser both fail; inline comments below). I've opened #564 with just the #561 fix so it can merge now. Let's land the shared decoder here afterwards. Please also: fold in or drop the TMA formats (tma_* decoding is still separate, so the title overclaims), squash the two identically named commits, and add a small fixture test (a base_delta ARRIVE that hits an mbarrier only via a delta lane must keep its TRYWAIT). Once it builds, the post-processed .tracez should be byte-identical to #564's.

Comment thread util/tracer_nvbit/tracer_tool/decode.h Resolved
Comment thread util/tracer_nvbit/tracer_tool/decode.h Resolved
Comment thread util/tracer_nvbit/tracer_tool/decode.h Resolved
Comment thread util/tracer_nvbit/tracer_tool/decode.h Resolved
Comment thread util/tracer_nvbit/tracer_tool/decode.h Resolved
@benlaflen
benlaflen force-pushed the unify-address-decoding branch 5 times, most recently from 9bf10f0 to ba54b5b Compare October 20, 2026 15:40
@benlaflen
benlaflen force-pushed the unify-address-decoding branch from ba54b5b to 0d7125a Compare October 20, 2026 16:31
@benlaflen benlaflen changed the title Unify address decoding Unify per-lane address decoding Oct 20, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@JRPan JRPan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review on d71a20e (I pushed a clang-format-only commit; no logic changes). The earlier compile/include comments look addressed, but two blockers remain:

  1. decode_base_stride returns 31 entries when the active run ends before lane 31, so trace_parser.cc's memcpy of 32 entries reads out of bounds.
  2. The address_format enum was deleted from tracer_tool.cu but is still used there (lines 1458-1468 and 1568-1576), and decode.h does not define it, so the tracer no longer builds.

Also still open: decode() does not handle the TMA modes (3/4), so the title overclaims, and assert(!ss.fail()) vanishes under NDEBUG. See the inline comments. The earlier request for a base_delta fixture test and a byte-identical .tracez check against #564 still stands.

addr += stride;
addrs.push_back(addr);
} else
last_bit1_found = true;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: the lane that ends the run sets last_bit1_found but pushes nothing, so for any mask whose run ends before lane 31 the vector has 31 entries. The old code assigned addrs[s] by index. trace_parser.cc then memcpys WARP_SIZE * 8 bytes from it, reading 8 bytes past the end. Size the vector up front (std::vector<uint64_t> addrs(WARP_SIZE, 0)) and assign addrs[s], or push 0 here. Please also assert addrs.size() == WARP_SIZE before returning from decode().

return addrs;
}

inline std::vector<uint64_t> decode(unsigned address_mode,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decode() only handles modes 0-2 and throws for 3/4 (TMA), which are still decoded separately in trace_parser.cc and post-traces-processing.cpp. Either fold the TMA formats in here, or drop the unification claim from the title and state they are out of scope. Also, assert(!ss.fail()) is compiled out under NDEBUG, so a truncated line silently decodes to garbage in release builds; throw on failure instead.

#include "watchdog.h"

/* for general utils functions */
#include "decode.h"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR deletes enum address_format from this file, but it is still used at lines 1458, 1462, 1468 (base_stride, base_delta, list_all) and 1568, 1576 (tma_base_delta, tma_list_all). decode.h does not define it, so the tracer does not compile. Move the full enum (0-4) into decode.h and use it from the tracer, the parser and decode().

tma_list_all = 3,
tma_base_delta = 4
};
enum address_format { tma_list_all = 3, tma_base_delta = 4 };

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enum is now split: here only the TMA values remain, while the tracer used to carry all five. Keep a single address_format definition in the shared header so the tracer and parser cannot drift apart.

@JRPan
JRPan self-requested a review October 20, 2026 17:23
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