Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#16434: DPRINT to read buffer once #16586

Merged
merged 3 commits into from
Jan 17, 2025
Merged

#16434: DPRINT to read buffer once #16586

merged 3 commits into from
Jan 17, 2025

Conversation

tt-dma
Copy link
Contributor

@tt-dma tt-dma commented Jan 9, 2025

Ticket

#16434

Also including a fix for #15694, as well as changing the default TT_METAL_DPRINT_CHIPS to all (an issue run into by model team on TG/TGG)

Problem description

@miawangTT hit what appears to be a very specific race condition w/ dprint + inter-risc dependencies resulting in some old data being read (specifically wpos was out of sync with print data). Although I have so far been unable to determine exact location where this race is coming from, switching dprint from a double read to single read does seem to fix the cases where I was able to reproduce this.

I do think single read is correct over what we had before, since we were using wpos/rpos from the first read and data from the second read.

What's changed

Switch DPRINT from reading buffer twice (once first 8 bytes, then conditional second) to a single read. Wasn't sure if the previous method even gave any performance benefit, but it should be fine either way since this is a debug only path.

Checklist

Copy link
Contributor

@pgkeller pgkeller left a comment

Choose a reason for hiding this comment

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

the "read once" vs "read check read" is a good change, makes sense

@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

copyright's on new files are out of date

Previously read twice (with the first read being eight bytes). Switching
to single read appears to alleviate some specific race conditions where
both dprint and risc-to-risc dependencies are present.
@tt-dma tt-dma force-pushed the dma/16434_dprint_race branch from 889a498 to 83972d4 Compare January 17, 2025 18:02
@tt-dma tt-dma merged commit 0ddcfed into main Jan 17, 2025
9 checks passed
@tt-dma tt-dma deleted the dma/16434_dprint_race branch January 17, 2025 18:10
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