Repository navigation
hip.py: clean the process environment before the HIP runtime is loaded - #97
Merged
Merged
Conversation
Every variable whose name contains HIP, LLVM, ROCM or HSA is removed, except HIP_PLATFORM and HIP_PATH_72, and ROCM_PATH is set to the HIP SDK (the rocm_dir given, else C:\Program Files\AMD\ROCm\7.2). Applied in Hip.__init__ before amdhip64 is loaded, so the runtime and every child process of the runner see the cleaned environment. Per process only: the user's and the machine's environment are not changed. A stray inherited variable can point the vendor runtime at an unrelated folder; an LLVM_PATH outside the SDK made hipModuleLoadData crash. hip_child_environment() gives the same cleaned copy for callers that start HIP or clang processes themselves. No change for Model M: hip.py is a Python runner module only and is not part of any build output. Refs #89 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
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.
The runner's HIP wrapper now cleans its own process environment before
amdhip64is loaded. Refs #89HIP_PLATFORMandHIP_PATH_72, andROCM_PATHis set to the HIP SDK (therocm_dirgiven, elseC:\Program Files\AMD\ROCm\7.2).Hip.__init__, so the runtime and every child process of the runner see the cleaned environment. Per process only: the user's and the machine's environment are not changed.hip_child_environment()gives the same cleaned copy for callers that start HIP or clang processes themselves.Why: a stray inherited variable can point the vendor runtime at an unrelated folder (an
LLVM_PATHoutside the SDK madehipModuleLoadDatacrash; the existing warning in_check_environmentdescribed this).No change for Model M:
hip.pyis a Python runner module and is not part of any build output.Tested
python -m unittest clean.tests.test_hip_env(new, CPU): removal, kept names,ROCM_PATH, in-place process cleanup.clean/runner/selftest.pyon the sameprobe.co(built fromclean/kernels/probe.hip), in one GPU session: main (started with the same cleaned environment by a wrapper) and this branch print byte-identical reports (1464 bytes, every probe passing). This branch started from an uncleaned environment that holds a strayLLVM_PATHprints the same bytes and no warning.python tools/ci/check_line_endings.py: 0 problems.Not tested
rocm_diris given).