Skip to content

adds docker for therock with asan enabled#144

Open
amd-vivekag wants to merge 13 commits into
mainfrom
users/vivekag/therock_asan_docker
Open

adds docker for therock with asan enabled#144
amd-vivekag wants to merge 13 commits into
mainfrom
users/vivekag/therock_asan_docker

Conversation

@amd-vivekag

Copy link
Copy Markdown
Collaborator

adds docker for therock with asan enabled

Copilot AI review requested due to automatic review settings March 20, 2026 15:21
@amd-vivekag amd-vivekag force-pushed the users/vivekag/therock_asan_docker branch from a47d7c0 to 35b0771 Compare March 20, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Docker image variant intended for debugging host-side HIP/ROCm issues with AddressSanitizer enabled via TheRock, and exposes it through the existing Docker env selection flow.

Changes:

  • Adds Dockerfile.therock-host-asan-pytorch to build TheRock with HOST_ASAN and then build PyTorch against that stack.
  • Extends docker/setup-env.sh to allow selecting the new Dockerfile (choice 5).
  • Documents the new Dockerfile option in docker/.env.example.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
docker/setup-env.sh Adds interactive selection entry for the new TheRock HOST_ASAN + PyTorch Dockerfile.
docker/Dockerfile.therock-host-asan-pytorch New Dockerfile that builds TheRock with HOST_ASAN and builds PyTorch from source against it.
docker/.env.example Adds the new Dockerfile option and brief description to the env template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +115 to +116
RUN git clone --branch ${THEROCK_GIT_REF} --single-branch \
https://github.com/ROCm/TheRock.git

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

git clone --branch ${THEROCK_GIT_REF} only supports branches/tags. If you want to support commit SHAs for reproducible builds, clone without --branch (or fetch) and git checkout the SHA explicitly.

Suggested change
RUN git clone --branch ${THEROCK_GIT_REF} --single-branch \
https://github.com/ROCm/TheRock.git
RUN git clone https://github.com/ROCm/TheRock.git && \
cd TheRock && \
git checkout ${THEROCK_GIT_REF}

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for flagging this. I am keeping git clone --branch ${THEROCK_GIT_REF} --single-branch --depth 1 as-is: THEROCK_GIT_REF is documented (and enforced in THEROCK_ASAN_BUILD_ISSUES.md) to be a release tag that must match THEROCK_TARBALL_VERSION for ABI compatibility, so an arbitrary commit SHA is intentionally out of scope, and the shallow single-branch clone is a deliberate build-time optimization a SHA checkout would lose. Happy to revisit if we ever need SHA-pinned ASAN builds.

Comment thread docker/Dockerfile.therock-host-asan-pytorch Outdated
Comment thread docker/.env.example
Comment thread docker/Dockerfile.therock-host-asan-pytorch Outdated
Copilot AI review requested due to automatic review settings March 24, 2026 17:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker/Dockerfile.therock-host-asan-pytorch Outdated
Comment thread docker/Dockerfile.therock-host-asan-pytorch Outdated
Comment thread docker/Dockerfile.therock-host-asan-pytorch Outdated
Copilot AI review requested due to automatic review settings March 25, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 12 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/asan_tests/verify_asan_therock.sh Outdated
Comment thread tests/asan_tests/verify_asan_pytorch.sh Outdated
Comment thread tests/asan_tests/verify_asan_pytorch.sh Outdated
Comment thread tests/asan_tests/run_therock_sanity.sh Outdated
Comment thread tests/asan_tests/test_therock_asan.py
Comment thread tests/asan_tests/verify_asan_therock.sh Outdated
Comment thread tests/asan_tests/verify_asan_therock.sh Outdated
Comment thread tests/asan_tests/verify_asan_pytorch.sh Outdated
Comment thread docker/Dockerfile.therock-host-asan-pytorch Outdated
Comment thread tests/asan_tests/verify_asan_therock.sh
Copilot AI review requested due to automatic review settings March 31, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/asan_tests/verify_asan_pytorch.sh Outdated
Comment thread tests/asan_tests/verify_asan_therock.sh Outdated
Comment thread tests/asan_tests/verify_asan_therock.sh Outdated
Comment thread tests/asan_tests/test_therock_asan.py Outdated
Comment thread tests/asan_tests/run_therock_sanity.sh Outdated
Comment thread docker/Dockerfile.therock-host-asan-pytorch
amd-vivekag and others added 2 commits April 1, 2026 15:17
Copilot AI review requested due to automatic review settings June 19, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Comment thread tests/asan_tests/verify_asan_pytorch.sh
Comment thread tests/asan_tests/verify_asan_active.sh
Comment thread tests/asan_tests/verify_asan_active.sh
Comment thread docker/docker-compose.build.yaml
Comment thread tests/asan_tests/test_therock_asan.py
…RARY_PATH under set -u, use overlay-dir var in messages, readelf over ldd, non-empty BASE_IMAGE default (#144)

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Comment thread tests/asan_tests/verify_asan_pytorch.sh Outdated
Comment thread docker/docker-compose.build.yaml Outdated
Comment on lines +113 to +117
RUN apt-get update && apt-get install -y \
build-essential \
gfortran \
git \
ninja-build \

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for flagging this. I am keeping it as-is: the cmake --preset invocation runs inside . .venv/bin/activate (line 219), and cmake is provided by TheRock requirements.txt installed into that venv at line 197 (pip install -r requirements.txt), so a system cmake is not needed for the TheRock ASAN build. The Kitware system cmake added later (line 314) is only for the separate PyTorch build stage, which is why the initial apt layer intentionally omits cmake. Happy to add a one-line comment there if it helps future readers.

Comment thread tests/asan_tests/test_hip_asan.cpp Outdated
Comment thread tests/asan_tests/verify_asan_pytorch.sh Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Comment thread tests/asan_tests/verify_asan_active.sh Outdated
Comment thread tests/asan_tests/verify_asan_therock.sh
amd-vivekag and others added 2 commits June 19, 2026 16:54
…ays PASSED (#144)

Co-authored-by: Cursor <cursoragent@cursor.com>
…_DIR in verify_asan_therock (#144)

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings June 19, 2026 16:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Comment on lines +243 to +248
RUN cmake --install build-asan --prefix /tmp/rocm-asan-full && \
mkdir -p /opt/rocm-asan/lib && \
for lib in libamdhip64 libhsa-runtime64 libhsakmt libamd_comgr; do \
find /tmp/rocm-asan-full/lib -name "${lib}.so*" -exec cp -a {} /opt/rocm-asan/lib/ \; ; \
done && \
rm -rf /tmp/rocm-asan-full
Comment on lines +99 to +106
NORMAL_HIP="$ROCM/lib/libamdhip64.so"
if [ -f "$NORMAL_HIP" ]; then
if nm -D "$NORMAL_HIP" 2>/dev/null | grep -q '__asan_'; then
check "Normal libamdhip64.so is NOT ASAN-instrumented" "fail"
else
check "Normal libamdhip64.so is NOT ASAN-instrumented" "pass"
fi
fi
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.

2 participants