Skip to content

Commit 45ce78a

Browse files
authored
ci: correct rocm artifact of linux (#1269)
1 parent 28ef93c commit 45ce78a

File tree

1 file changed

+24
-31
lines changed

1 file changed

+24
-31
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -535,31 +535,30 @@ jobs:
535535
# Add ROCm to PATH for current session
536536
echo "/opt/rocm/bin" >> $GITHUB_PATH
537537
538-
# Build case pattern from GPU_TARGETS
539-
PATTERN=$(printf '%s' "$GPU_TARGETS" | sed 's/;/\*|\*/g')
540-
PATTERN="*${PATTERN}*"
538+
# Build regex pattern from ${{ env.GPU_TARGETS }} (match target as substring)
539+
TARGET_REGEX="($(printf '%s' "${{ env.GPU_TARGETS }}" | sed 's/;/|/g'))"
541540
542541
# Remove library files for architectures we're not building for to save disk space
543542
echo "Cleaning up unneeded architecture files..."
544543
cd /opt/rocm/lib/rocblas/library
545544
# Keep only our target architectures
546545
for file in *; do
547-
case "$file" in
548-
$PATTERN)
549-
;;
550-
*)
551-
sudo rm -f "$file" ;;
552-
esac;
546+
if printf '%s' "$file" | grep -q 'gfx'; then
547+
if ! printf '%s' "$file" | grep -Eq "$TARGET_REGEX"; then
548+
echo "Removing $file" &&
549+
sudo rm -f "$file";
550+
fi
551+
fi
553552
done
554553
555554
cd /opt/rocm/lib/hipblaslt/library
556555
for file in *; do
557-
case "$file" in
558-
$PATTERN)
559-
;;
560-
*)
561-
sudo rm -f "$file" ;;
562-
esac;
556+
if printf '%s' "$file" | grep -q 'gfx'; then
557+
if ! printf '%s' "$file" | grep -Eq "$TARGET_REGEX"; then
558+
echo "Removing $file" &&
559+
sudo rm -f "$file";
560+
fi
561+
fi
563562
done
564563
565564
- name: Build
@@ -592,21 +591,15 @@ jobs:
592591
cp ggml/LICENSE ./build/bin/ggml.txt
593592
cp LICENSE ./build/bin/stable-diffusion.cpp.txt
594593
595-
# Create directories for ROCm libraries
596-
mkdir -p ./build/bin/rocblas/library
597-
mkdir -p ./build/bin/hipblaslt/library
598-
599-
# Copy ROCm runtime libraries (use || true to continue if files don't exist)
600-
cp /opt/rocm/lib/librocsparse.so* ./build/bin/ || true
601-
cp /opt/rocm/lib/libhsa-runtime64.so* ./build/bin/ || true
602-
cp /opt/rocm/lib/libamdhip64.so* ./build/bin/ || true
603-
cp /opt/rocm/lib/libhipblas.so* ./build/bin/ || true
604-
cp /opt/rocm/lib/libhipblaslt.so* ./build/bin/ || true
605-
cp /opt/rocm/lib/librocblas.so* ./build/bin/ || true
606-
607-
# Copy library files (already filtered to target architectures)
608-
cp /opt/rocm/lib/rocblas/library/* ./build/bin/rocblas/library/ || true
609-
cp /opt/rocm/lib/hipblaslt/library/* ./build/bin/hipblaslt/library/ || true
594+
# Move ROCm runtime libraries (to avoid double space consumption)
595+
sudo mv /opt/rocm/lib/librocsparse.so* ./build/bin/
596+
sudo mv /opt/rocm/lib/libhsa-runtime64.so* ./build/bin/
597+
sudo mv /opt/rocm/lib/libamdhip64.so* ./build/bin/
598+
sudo mv /opt/rocm/lib/libhipblas.so* ./build/bin/
599+
sudo mv /opt/rocm/lib/libhipblaslt.so* ./build/bin/
600+
sudo mv /opt/rocm/lib/librocblas.so* ./build/bin/
601+
sudo mv /opt/rocm/lib/rocblas/ ./build/bin/
602+
sudo mv /opt/rocm/lib/hipblaslt/ ./build/bin/
610603
611604
- name: Fetch system info
612605
id: system-info
@@ -622,7 +615,7 @@ jobs:
622615
run: |
623616
cp ggml/LICENSE ./build/bin/ggml.txt
624617
cp LICENSE ./build/bin/stable-diffusion.cpp.txt
625-
zip -j sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-Ubuntu-${{ env.UBUNTU_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-rocm.zip ./build/bin/*
618+
zip -y -r sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-Ubuntu-${{ env.UBUNTU_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-rocm.zip ./build/bin
626619
627620
- name: Upload artifacts
628621
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}

0 commit comments

Comments
 (0)