Honor PTX_SIM_KERNELFILE override on CUDA >= 6.0 - #136
Open
hzb0402 wants to merge 1 commit into
Open
Conversation
The PTX_SIM_USE_PTX_FILE / PTX_SIM_KERNELFILE override, documented in the README for simulating a hand-edited PTX file without recompiling the application, was only implemented in the legacy pre-CUDA-6.0 PTX loading branch of cuobjdumpParseBinary. On CUDA 6.0+ the active #if (CUDART_VERSION >= 6000) branch loads PTX solely from the cuobjdump-extracted filename (which is regenerated on every run), so the override silently had no effect even though the "overriding embedded ptx ... (PTX_SIM_USE_PTX_FILE is set)" message was still printed during initialization. Honor PTX_SIM_KERNELFILE in the CUDART_VERSION >= 6000 loading loop as well, gated on both PTX_SIM_USE_PTX_FILE and PTX_SIM_KERNELFILE being set so default behavior is unchanged. PTXInfo (register/shared-memory usage) is still loaded from the originally extracted file.
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.
Problem
The
PTX_SIM_USE_PTX_FILE/PTX_SIM_KERNELFILEoverride — documented in theREADME for simulating a hand-edited PTX file without recompiling the
application — has no effect on CUDA 6.0+.
The override is only implemented in the legacy pre-CUDA-6.0 branch of
cuobjdumpParseBinary. On CUDA 6.0+ the active#if (CUDART_VERSION >= 6000)branch loads PTX solely from the cuobjdump-extracted filename (which is
regenerated on every run via
cuobjdump -xptx), so a hand-edited PTX file cannever be picked up. The misleading part is that the
"overriding embedded ptx ... (PTX_SIM_USE_PTX_FILE is set)"message is stillprinted during initialization, so it looks like the override is active when it
is not.
Fix
Honor
PTX_SIM_KERNELFILEin theCUDART_VERSION >= 6000loading loop as well,gated on both
PTX_SIM_USE_PTX_FILEandPTX_SIM_KERNELFILEbeing set so thedefault behavior is unchanged. PTXInfo (register / shared-memory usage) is still
loaded from the originally extracted file, so occupancy is unaffected.
Testing
make clean && make).vectoradd(no env vars) still PASSES, confirming default behavior isunchanged.
PTX_SIM_USE_PTX_FILE=1 PTX_SIM_KERNELFILE=<edited>.ptx, a hand-editedPTX (e.g. changing the stored value) is now correctly picked up and changes the
computed result, whereas on the unpatched build it was silently ignored.
Made with Cursor