Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue]: hipcc errors out when using both -pedantic and -save-temps #240

Closed
maartenarnst opened this issue Jan 6, 2025 · 4 comments
Closed
Labels
generic Build error, or some other issue not caused by an LLVM bug Under Investigation

Comments

@maartenarnst
Copy link

maartenarnst commented Jan 6, 2025

Problem Description

We're seeing hipcc error out when using both -pedantic and -save-temps flags.

It may be related to:

Operating System

Ubuntu 24.04

CPU

AMD Ryzen 5950X

GPU

AMD Radeon Pro VII

ROCm Version

ROCm 6.3.0

ROCm Component

HIPCC

Steps to Reproduce

Dockerfile.hipcc
FROM rocm/dev-ubuntu-24.04:6.3.1

COPY <<EOF test.cpp
#include <iostream>

int main() {
    std::endl << "Hello world! << std::endl;
}
EOF

RUN hipcc -pedantic -save-temps test.cpp

This fails with:

docker buildx build --file Dockerfile.hipcc .

It seems the underlying issue is an issue with clang.

Dockerfile.clang
FROM ubuntu:24.04

ARG COMPILER_VERSION

RUN <<EOF
    apt update

    apt --yes --no-install-recommends install wget lsb-release gpg-agent software-properties-common

    wget --no-check-certificate https://apt.llvm.org/llvm.sh

    chmod +x llvm.sh

    ./llvm.sh ${COMPILER_VERSION}
EOF

COPY <<EOF test.cpp
#include <iostream>

int main() {
    std::endl << "Hello world! << std::endl;
}
EOF

RUN clang++-${COMPILER_VERSION} -pedantic -save-temps test.cpp

This fails with:

docker buildx build --file Dockerfile.clang --build-arg COMPILER_VERSION=18 .
docker buildx build --file Dockerfile.clang --build-arg COMPILER_VERSION=19 .
docker buildx build --file Dockerfile.clang --build-arg COMPILER_VERSION=20 .

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

@ppanchad-amd ppanchad-amd added generic Build error, or some other issue not caused by an LLVM bug Under Investigation labels Jan 6, 2025
@schung-amd
Copy link

Hi @maartenarnst, thanks for pointing this out. Yes, this is essentially the same issue discussed in llvm#63284; clang is passing on the -pedantic flag when processing its own generated intermediate files, which triggers the warnings. Not sure what can/should be done to address the underlying cause (given the discussion in the linked issue did not result in a fix), I'll discuss with the internal team.

Is this blocking anything? On my end this only emits some extra warnings, which is messy but still functional. One possible workaround that comes to mind, although inconvenient, is to check only the preprocessor stage for -pedantic violations (i.e. hipcc -E -pedantic test.cpp in this case) and then compile with -save-temps and without -pedantic as any files past this point should be generated by clang and won't need -pedantic.

@maartenarnst
Copy link
Author

Hi @schung-amd. Thank you for the reply and for discussing about it with the internal team.

On our side, it is not blocking anything. Just for context, we are implementing a portable code with Kokkos. Our current workaround for this issue is to enable the -pedantic flag when compiling for the host backend. And then disable this flag when compiling for the HIP backend. Thank you for your suggestion with the preprocessor stage, which is another useful workaround indeed.

@schung-amd
Copy link

Glad you have a workaround in place. As this appears to be a general clang issue and not AMD-specific, it's not a priority on our end and I suggest raising this issue in upstream LLVM as it's more likely to be addressed there. Thanks again for reporting this though, it's good to know that these flags (and others, judging by the linked upstream issue) are incompatible at the moment.

@maartenarnst
Copy link
Author

OK. Thanks in any case. Following your suggestion, I've just mentioned the issue in the thread that we had referenced from the upstream LLVM. Let's close this issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generic Build error, or some other issue not caused by an LLVM bug Under Investigation
Projects
None yet
Development

No branches or pull requests

3 participants