Skip to content

[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
simplexai-labs:mainfrom
aravindraju98:fix-hip-flags-spaces
Open

aravindraju98 wants to merge 1 commit into
simplexai-labs:mainfrom
aravindraju98:fix-hip-flags-spaces

Conversation

@aravindraju98

Copy link
Copy Markdown

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_FLAGS passes
--rocm-path=<root> and --rocm-device-lib-path=<bitcode> unquoted, and both paths sit under the install
folder (terminal/.rocm-win/... on Windows), so clang++ gets the path cut at the space:

clang++: error: no such file or directory: 'Strata/terminal/.rocm-win/Lib/site-packages/_rocm_sdk_devel'
clang++: error: cannot find ROCm device library; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library
-- Configuring incomplete, errors occurred!
[X]  command failed (exit 1): cmd

With this change the same command from the same folder compiles strata-poly and setup ends with All 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_FLAGS quotes each path in all six places that build it: terminal/setup.py (the Strata engine
    on Linux and Windows, the picture reader, strata-poly on Linux and Windows) and terminal/tools/image/qimage.py.
  • On Windows the configure line goes through a generated .bat. Its quoting (the q lambda in cmake_build)
    wrapped an argument with a space in quotes but did not escape quotes inside it. It is now bat_arg(), which
    also escapes an inner " as \"; arguments without a quote come out exactly as before.
  • tools/image/gate/build_variant.py reads the ROCm path back out of these flags; it now reads a quoted path whole.
  • test_gh_0217_hipflags.py reads the new form, and checks that every path in the flags is quoted and that
    bat_arg keeps 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: main at d62dfac. ROCm: the TheRock wheels setup installs in terminal/.rocm-win.
Command, run from D:\contrib\Poly Strata (a folder name with a space):

START-HERE.bat --yes --no-start --output jsonl --custom-gguf <Qwen3.6-35B-A3B-UD-Q4_K_M.gguf>

Passed:

  • Before (d62dfac, unchanged): fails at the HIP compiler check with the clang++ errors above.
  • After (d62dfac + this change): [ok] strata-poly compiled, [ok] start script, All set., exit code 0.
    The generated build-strata-poly-hip.bat passes
    "-DCMAKE_HIP_FLAGS=--rocm-path=\"D:/contrib/Poly Strata/...\" --rocm-device-lib-path=\"D:/contrib/Poly Strata/.../bitcode\"".
  • The build prints the same 35 -Wpass-failed=transform-warning warnings and the same
    CMAKE_HAVE_LIBC_PTHREAD - Failed line as an unchanged build from a folder without a space on the same machine.
  • python -m unittest tests.terminal.test_gh_0217_hipflags (from terminal/): 5 tests OK.
  • A Windows program started from a cmd line built by bat_arg receives the flag as one argument with the
    quotes intact: ['-DCMAKE_HIP_FLAGS=--rocm-path="D:/Poly Strata/rocm" --rocm-device-lib-path="D:/Poly Strata/bc"'].
  • Setup's own tests (python tools/test_setup_<name>.py, all 90 files, from terminal/), on this change and on
    d62dfac unchanged: 88 pass on both. The results are the same file for file.

Failed:

  • test_setup_download_length.py and test_setup_groot.py exit 1, on this change and on d62dfac unchanged alike.

Not run:

  • The full python -m pytest terminal/tests/terminal suite: 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.
  • Linux HIP builds (setup.py lines with {root}): same quoting, but not compiled here.
  • The Windows Strata engine build (build-strata-hip-win.bat), the picture reader and qimage.py's HIP build:
    changed the same way, not compiled here (this setup run builds strata-poly only).
  • Running a model on the engine built from the spaced folder: this run checked the build only.
  • CUDA and SYCL builds: not touched by this change.

Limits

Only the HIP flags and the Windows build .bat are changed. Other places that may still assume a path without
a space were not audited.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant