-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[flang][runtime] Debug PRINT *, "HI" on GPU #172087
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
Conversation
Decrease memory allocation for buffers, allocate the pseudo-unit only once on demand, and avoid using a "%*.s" format.
| char save{buffer[bytes]}; | ||
| mutableBuffer[bytes] = '\0'; | ||
| std::printf("%s", buffer); | ||
| mutableBuffer[bytes] = save; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering why we need to care about this byte?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be a NUL at the end of the string for "%s" formatting to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is clear to me :) but why do we need to restore the original byte value, if we always allocate an extra byte?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a circular buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Thanks!
Decrease memory allocation for buffers, allocate the pseudo-unit only once on demand, and avoid using a "%*.s" format.
Decrease memory allocation for buffers, allocate the pseudo-unit only once on demand, and avoid using a "%*.s" format.
Decrease memory allocation for buffers, allocate the pseudo-unit only once on demand, and avoid using a "%*.s" format.
Decrease memory allocation for buffers, allocate the pseudo-unit only once on demand, and avoid using a "%*.s" format.