diff --git a/.github/workflows/rocm-ci.yml b/.github/workflows/rocm-ci.yml index 9999d6739..1764a95af 100644 --- a/.github/workflows/rocm-ci.yml +++ b/.github/workflows/rocm-ci.yml @@ -148,11 +148,20 @@ jobs: DEVICE_FLAG="$(cat /etc/podinfo/gha-render-devices 2>/dev/null || echo --device=/dev/dri)" test -n "$DEVICE_FLAG" echo "Using device flag: $DEVICE_FLAG" + mapfile -t RENDER_DEVICES < <(grep -oE '/dev/dri/renderD[0-9]+' <<< "$DEVICE_FLAG" || true) + GPU_COUNT="${#RENDER_DEVICES[@]}" + GPU_ENV=() + if [ "$GPU_COUNT" -gt 0 ]; then + GPU_IDS="$(seq -s, 0 $((GPU_COUNT - 1)))" + GPU_ENV=(-e "ROCR_VISIBLE_DEVICES=$GPU_IDS" -e "HIP_VISIBLE_DEVICES=$GPU_IDS") + fi + docker run -dt \ --rm \ --name te-runner \ --network=host \ --device=/dev/kfd $DEVICE_FLAG \ + "${GPU_ENV[@]}" \ --shm-size=16G \ --pid=host \ --group-add $(getent group render | cut -d: -f3) \