Repository navigation
[Other] Setup: quote the ROCm paths in CMAKE_HIP_FLAGS so a HIP build works from a folder with a space - #353
Open
aravindraju98 wants to merge 1 commit into
Open
aravindraju98 wants to merge 1 commit into
aravindraju98 wants to merge 1 commit into
Conversation
…th a space The HIP builds passed --rocm-path and --rocm-device-lib-path unquoted, and both paths are inside the install folder, so a folder named with a space reached clang++ split in two and the HIP compiler check failed (#7138 in Niko1221/Strata). The paths are now quoted in all six places, the Windows build .bat escapes quotes inside an argument (bat_arg), and tools/image/gate/build_variant.py reads a quoted --rocm-path whole.
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 and result
When the PolyStrata folder's path contains a space (for example
D:\contrib\Poly Strata), every AMD (HIP)engine build that setup starts fails at CMake's HIP compiler check.
CMAKE_HIP_FLAGSpasses--rocm-path=<root>and--rocm-device-lib-path=<bitcode>unquoted, and both paths sit under the installfolder (
terminal/.rocm-win/...on Windows), so clang++ gets the path cut at the space:With this change the same command from the same folder compiles
strata-polyand setup ends withAll set.Paths without a space give the same compiler arguments as before.
Related discussion
Likely the cause behind Niko1221/Strata#7138 ("Crash With Spaces In Windows Install Path", reproduced on
Windows 10). I cannot see that report's screenshot in text, so I have not confirmed it is the same error.
Approach
CMAKE_HIP_FLAGSquotes each path in all six places that build it:terminal/setup.py(the Strata engineon Linux and Windows, the picture reader, strata-poly on Linux and Windows) and
terminal/tools/image/qimage.py..bat. Its quoting (theqlambda incmake_build)wrapped an argument with a space in quotes but did not escape quotes inside it. It is now
bat_arg(), whichalso escapes an inner
"as\"; arguments without a quote come out exactly as before.tools/image/gate/build_variant.pyreads the ROCm path back out of these flags; it now reads a quoted path whole.test_gh_0217_hipflags.pyreads the new form, and checks that every path in the flags is quoted and thatbat_argkeeps a quoted path as one argument.Validation
Environment: Windows 11, AMD Radeon RX 9070 (gfx1201, 16 GB), driver 32.0.32029.2010, Ryzen 7 5700X3D,
32 GB RAM. Base revision:
mainat d62dfac. ROCm: the TheRock wheels setup installs interminal/.rocm-win.Command, run from
D:\contrib\Poly Strata(a folder name with a space):Passed:
[ok] strata-poly compiled,[ok] start script,All set., exit code 0.The generated
build-strata-poly-hip.batpasses"-DCMAKE_HIP_FLAGS=--rocm-path=\"D:/contrib/Poly Strata/...\" --rocm-device-lib-path=\"D:/contrib/Poly Strata/.../bitcode\"".-Wpass-failed=transform-warningwarnings and the sameCMAKE_HAVE_LIBC_PTHREAD - Failedline as an unchanged build from a folder without a space on the same machine.python -m unittest tests.terminal.test_gh_0217_hipflags(fromterminal/): 5 tests OK.cmdline built bybat_argreceives the flag as one argument with thequotes intact:
['-DCMAKE_HIP_FLAGS=--rocm-path="D:/Poly Strata/rocm" --rocm-device-lib-path="D:/Poly Strata/bc"'].python tools/test_setup_<name>.py, all 90 files, fromterminal/), on this change and ond62dfac unchanged: 88 pass on both. The results are the same file for file.
Failed:
test_setup_download_length.pyandtest_setup_groot.pyexit 1, on this change and on d62dfac unchanged alike.Not run:
python -m pytest terminal/tests/terminalsuite: in this environment 25 files fail to collect(the same on d62dfac) and the run stalled after about 15 minutes with no CPU use, so I stopped it.
setup.pylines with{root}): same quoting, but not compiled here.build-strata-hip-win.bat), the picture reader andqimage.py's HIP build:changed the same way, not compiled here (this setup run builds strata-poly only).
Limits
Only the HIP flags and the Windows build
.batare changed. Other places that may still assume a path withouta space were not audited.