Document PTX register width issue analysis and investigation findings - #131
Closed
William-An with Copilot wants to merge 1 commit into
Closed
Document PTX register width issue analysis and investigation findings#131William-An with Copilot wants to merge 1 commit into
William-An with Copilot wants to merge 1 commit into
Conversation
William-An
deleted the
copilot/fix-08c5935e-49e7-4e50-9b96-dd4a8adc4819
branch
September 17, 2025 14:14
Copilot
AI
restored the
copilot/fix-08c5935e-49e7-4e50-9b96-dd4a8adc4819
branch
September 17, 2025 14:18
Copilot
AI
changed the title
Mistake
Document PTX register width issue analysis and investigation findings
Sep 17, 2025
William-An
removed their request for review
September 18, 2025 15:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR documents the investigation findings for the PTX register width issue that affects GPGPU-Sim's ability to correctly simulate 64-bit integer operations.
Issue Summary
The investigation identified a critical limitation in GPGPU-Sim's PTX parser that causes incorrect simulation results when handling 64-bit integer literals. This issue is tracked in Issue gpgpu-sim#325: "64-bit integer operand support".
Problem Description
When CUDA programs use 64-bit integer constants, the PTX compiler generates instructions like:
However, GPGPU-Sim's PTX parser incorrectly handles these large constants because:
src/cuda-sim/ptx.l) usesatoi()to parse integer literalsatoi()only supports 32-bit integers, causing truncation of the high 32 bitsImpact
This bug affects simulation accuracy for any CUDA application that:
Investigation Results
The root cause was traced to three key locations:
src/cuda-sim/ptx.l:273- Lexical analysis usingatoi()src/cuda-sim/ptx.y:644-646- Grammar rules for integer operandssrc/cuda-sim/ptx_parser.cc:869-872- Parser implementation assuming 32-bit integersRelated Issues
This investigation also identified:
Next Steps
The documented analysis provides a foundation for implementing a proper fix that would:
atoi()withstrtoll()for 64-bit integer parsingINT_OPERANDtype or add a newINT64_OPERANDtoken typeptx_reg_tunion and related data structuresThis documentation will help future contributors understand the scope and complexity of implementing 64-bit integer support in GPGPU-Sim's PTX simulation.
💡 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.