Skip to content

[stinkytofu] RawAsmParser: block-comment-aware // and ; stripping#7728

Open
darrenhsieh-amd wants to merge 1 commit into
developfrom
users/darrenh/stinkytofu-fix-comment-strip
Open

[stinkytofu] RawAsmParser: block-comment-aware // and ; stripping#7728
darrenhsieh-amd wants to merge 1 commit into
developfrom
users/darrenh/stinkytofu-fix-comment-strip

Conversation

@darrenhsieh-amd
Copy link
Copy Markdown
Contributor

Motivation

Block comments that contain // (e.g. /* temp = (wg//CU_Count) */, common when // denotes Python integer division in generated code) were truncated by the parser's naive // scan. The closing */ was dropped and an unterminated /* ended up in the output, which the downstream assembler then extended over the following instructions. This will silently dropping them from the resulting .co.

Technical Details

  • Add findLineCommentOutsideBlock helper: walks the line, skips /* … */ blocks, returns first // or ; position outside any
    block (or npos).
  • Use it at all three stripping sites in RawAsmParser::parseRawAsmString:
    • preserveComments capture
    • // strip + st.token: annotation parser
    • ; strip

Test Plan

ctest all passed.
Round-trip a real kernel passed.

Submission Checklist

Naive scan truncated `/* foo//bar */` at the inner `//`, leaving an
unterminated `/*` that the assembler extended across following instructions.
Add findLineCommentOutsideBlock helper; use it at all three comment-strip sites.
@darrenhsieh-amd darrenhsieh-amd force-pushed the users/darrenh/stinkytofu-fix-comment-strip branch from 59323c8 to 801013e Compare May 25, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants