Skip to content

Hip wrapper - #20

Merged
haampie merged 31 commits into
spack:mainfrom
scheibelp:hip-wrapper
Sep 14, 2026
Merged

haampie merged 31 commits into
spack:mainfrom
scheibelp:hip-wrapper

Conversation

@scheibelp

@scheibelp scheibelp commented Jul 9, 2026

Copy link
Copy Markdown
Member

Used by spack/spack-packages#4411

Pipelines there fully passed with latest commit 3e2f803 d6cc6b2 2b8ef4e

@scheibelp
scheibelp marked this pull request as draft July 9, 2026 23:57
@scheibelp

Copy link
Copy Markdown
Member Author

Question: should cxxflags attribute from compiler definitions (in packages.yaml) be added when detected language is HIP? or should there be a separate hipflags entry that adds flags to hip invocations. See https://github.com/spack/compiler-wrapper/blob/main/cc.sh#L789

Also, note that if it were processed like cxxflags: it would not work to add -x hip (because that gets placed after the source file, which is apparently important to amdclang++).

@haampie

haampie commented Jul 21, 2026

Copy link
Copy Markdown
Member

Did you check what CMake does? They implemented it twice, so presumably the second time they learned from mistakes from the past. See https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html#variable:CMAKE_%3CLANG%3E_FLAGS and various other pages, or sources.

Edit: I did that:

  • CMake passes -x hip, it's not extension based; we should do the same, otherwise the compiler wrapper may at some point need compiler+version specific parsing in case the real compiler changes behavior.
  • CMAKE_HIP_FLAGS_INIT is dervied from HIPFLAGS
  • CXXFLAGS is unrelated to HIPFLAGS.

That makes sense cause it's a different language.

This is the case for ~5 years, so I would say let's do -x hip only and fix upstream packages if needed, or deprecate them if too difficult.

@scheibelp

Copy link
Copy Markdown
Member Author

Commit ed41d0c depends on spack/spack#52826. This PR can be merged first (hipflags isn't useful until this, spack/spack-packages#4411, and spack/spack#52826 merge)

@haampie

haampie commented Aug 12, 2026

Copy link
Copy Markdown
Member

You should add tests.

Comment thread cc.sh Outdated
Comment thread cc.sh
@scheibelp
scheibelp marked this pull request as ready for review August 18, 2026 00:08
@scheibelp

Copy link
Copy Markdown
Member Author

@haampie thanks for the review. I think this is ready again

@haampie haampie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments, you could adapt

haampie-llms@f79171b
haampie-llms@192a24a

Comment thread cc.sh Outdated
Comment thread cc.sh Outdated
Comment thread cc.sh
Comment thread cc.sh Outdated
Comment thread cc.sh
Comment thread test/run.sh Outdated
scheibelp and others added 2 commits September 1, 2026 13:44
… generate compiler error vs. dash error for malformed commands that leave language off of -x)

Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
@scheibelp

Copy link
Copy Markdown
Member Author

Thanks for the review @haampie, I think this is ready again (all comments addressed) - I used the suggested commits nearly as is, except I renamed a couple functions.

I also updated spack/spack-packages#4411 to point to this and it rebuilt everything successfully (currently one pipeline appears to have a non-build-related error)

@scheibelp
scheibelp requested a review from haampie September 3, 2026 06:20
Comment thread test/run.sh Outdated
Comment thread test/run.sh Outdated
Comment thread test/run.sh Outdated
Comment thread test/run.sh
Comment thread test/run.sh Outdated
Comment thread test/run.sh Outdated
Comment thread test/run.sh
Comment thread test/run.sh
Comment thread cc.sh Outdated
@haampie

haampie commented Sep 9, 2026

Copy link
Copy Markdown
Member

I think I missed the notifications for this. Generally lgtm, the machine suggests some simplifications, but more importantly the test not running is worth fixing ;p

@scheibelp

scheibelp commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

@haampie bad test reference is addressed (and I also followed the suggestion to look for and fail on non-existent test names).

Many of the nits I resolved as suggested (those are collapsed); for 3 of them I preferred what was already there.

This changed cc.sh so I updated the pin in spack/spack-packages#4411 and it ran all pipelines relevant to this change successfully.

@haampie
haampie merged commit 470906e into spack:main Sep 14, 2026
1 check passed
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.

3 participants