name: hipfile-system-tests run-name: Run hipFile system tests env: AIS_GHA_CMD_FILES_DOCKER_DIR: /root/github AIS_INPUT_HIPFILE_PKG_DEV_FILENAME: ${{ inputs.ais_hipfile_pkg_dev_filename }} AIS_INPUT_HIPFILE_PKG_FILENAME: ${{ inputs.ais_hipfile_pkg_filename }} AIS_INPUT_CI_IMAGE: ${{ inputs.ci_image }} AIS_INPUT_CXX_COMPILER: ${{ inputs.cxx_compiler }} AIS_INPUT_CXX_STANDARD: ${{ inputs.cxx_standard }} AIS_INPUT_PLATFORM: ${{ inputs.platform }} AIS_INPUT_ROCM_VERSION: ${{ inputs.rocm_version }} AIS_MOUNT_PATH: /mnt/ais/ext4 AIS_PKG_INSTALL_CMD: >- ${{ case( startsWith(inputs.platform, 'rocky'), 'dnf install -y', inputs.platform == 'suse', 'zypper install -y --allow-unsigned-rpm', inputs.platform == 'ubuntu', 'apt update; apt install -y', '' ) }} AIS_PKG_MGR: >- ${{ startsWith(inputs.platform, 'rocky') && 'dnf' || inputs.platform == 'suse' && 'zypper' || inputs.platform == 'ubuntu' && 'apt' }} on: workflow_call: inputs: ais_hipfile_pkg_dev_filename: required: true type: string ais_hipfile_pkg_filename: required: true type: string ci_image: required: true type: string cxx_compiler: description: "C++ compiler the build artifacts were built with" required: true type: string cxx_standard: description: "C++ standard the build artifacts were built with" required: true type: number platform: required: true type: string rocm_version: description: "Target ROCm MAJOR.MINOR.PATCH Version" required: true type: string permissions: contents: read packages: read jobs: run_system_tests: runs-on: [AIS] steps: - name: Set early AIS CI environment variables run: | echo "AIS_PR_NUMBER=$(echo "${GITHUB_REF}" | sed 's|[^0-9]||g')" >> "${GITHUB_ENV}" echo "AIS_SAFE_COMPILER_NAME=$(echo "${AIS_INPUT_CXX_COMPILER}" | sed 's|[\+]|plus|g')" >> "${GITHUB_ENV}" - name: Set AIS CI container name run: | echo "AIS_CONTAINER_NAME=${AIS_PR_NUMBER}_${GITHUB_JOB}_${AIS_INPUT_PLATFORM}_${AIS_INPUT_ROCM_VERSION}_${AIS_SAFE_COMPILER_NAME}_${AIS_INPUT_CXX_STANDARD}" >> "${GITHUB_ENV}" - name: Fetching hipFile repository... uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: path: rocm-systems sparse-checkout: | projects/hipfile .github/workflows - name: Download hipFile runtime package uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: ${{ inputs.ais_hipfile_pkg_filename }} - name: Download hipFile development package uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: ${{ inputs.ais_hipfile_pkg_dev_filename }} - name: Download hipFile build directory uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: hipfile-build-dir-${{ inputs.platform }}-${{ inputs.rocm_version }}-${{ inputs.cxx_compiler }}-cxx${{ inputs.cxx_standard }} path: ${{ github.workspace }}/hipfile-build-dir - name: Authenticating to GitHub Container Registry uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # Detach the container and run separate commands to it. # Thus we can make separate explicit steps in the Github CI # as if we were able to parameterize the container image in the first place. - name: Starting Docker Container run: | docker run \ -dt \ --rm \ --device=/dev/kfd \ --device=/dev/dri \ --security-opt seccomp=unconfined \ --pull always \ -v ${GITHUB_WORKSPACE}:/mnt/ais:ro \ -v "${AIS_MOUNT_PATH}:/mnt/ais-fs" \ --name "${AIS_CONTAINER_NAME}" \ "${AIS_INPUT_CI_IMAGE}" - name: Create hipfile IO test directory run: | docker exec -t "${AIS_CONTAINER_NAME}" /bin/bash -c "mkdir -p /mnt/ais-fs/${AIS_CONTAINER_NAME}" - name: Make copy of the code repository and create build directories run: | docker exec \ -t \ "${AIS_CONTAINER_NAME}" \ /bin/bash -c ' cp -R /mnt/ais /ais mkdir -p /ais/build/hipfile ' - name: Copy the hipFile packages into the container run: | docker cp \ "${GITHUB_WORKSPACE}/${AIS_INPUT_HIPFILE_PKG_FILENAME}" \ "${AIS_CONTAINER_NAME}:/root" docker cp \ "${GITHUB_WORKSPACE}/${AIS_INPUT_HIPFILE_PKG_DEV_FILENAME}" \ "${AIS_CONTAINER_NAME}:/root" - name: Install the hipFile packages run: | docker exec \ -t \ -w /root \ "${AIS_CONTAINER_NAME}" \ /bin/bash -c ' ${{ format( env.AIS_PKG_MGR == 'apt' && 'apt install -y "./{0}" "./{1}"' || env.AIS_PKG_MGR == 'dnf' && 'dnf install -y --cacheonly "./{0}" "./{1}"' || env.AIS_PKG_MGR == 'zypper' && 'zypper --no-refresh install -y --allow-unsigned-rpm "./{0}" "./{1}"' || 'echo "Unknown platform."; exit 1', inputs.ais_hipfile_pkg_filename, inputs.ais_hipfile_pkg_dev_filename ) }} ' # GitHub Build Artifacts do not preserve file permissions, namely the executable bit. - name: Fix file permissions on GTest executables run: | chmod a+x \ ${GITHUB_WORKSPACE}/hipfile-build-dir/test/hipfile_system_tests \ ${GITHUB_WORKSPACE}/hipfile-build-dir/test/amd_detail/batch_mt \ ${GITHUB_WORKSPACE}/hipfile-build-dir/test/amd_detail/state_mt \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/aiscp/aiscp \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/basics/bufregister-write \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/basics/no-bufregister-write \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/basics/no-odirect-write \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/basics/iterative-read \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/basics/iterative-devmem-offset-read \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/basics/various-mem-rw \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/basics/subregion-write \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/basics/roundtrip-verify \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/async/roundtrip-async \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/async/roundtrip-async-nonblocking-stream \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/async/roundtrip-async-multi-stream \ ${GITHUB_WORKSPACE}/hipfile-build-dir/examples/async/roundtrip-async-multi-stream-registered - name: Copy the hipFile build directory into the container run: | docker cp \ ${GITHUB_WORKSPACE}/hipfile-build-dir/. \ "${AIS_CONTAINER_NAME}:/ais/build/hipfile" - name: Run hipFile system tests for the AMD platform run: | docker exec \ -t \ -w /ais/build/hipfile \ "${AIS_CONTAINER_NAME}" \ /bin/bash -c ' ctest -V -L "system" --parallel ' - name: Stress tests for hipFile targeting the AMD platform run: | docker exec \ -t \ -w /ais/build/hipfile \ "${AIS_CONTAINER_NAME}" \ /bin/bash -c ' ctest -V -L "stress" --parallel ' - name: hipFile fallback/POSIX IO test using aiscp run: | docker exec \ -t \ -w "/mnt/ais-fs/${AIS_CONTAINER_NAME}" \ "${AIS_CONTAINER_NAME}" \ /bin/bash -c ' HIPFILE_FORCE_COMPAT_MODE=true /ais/rocm-systems/projects/hipfile/util/ci-aiscp-test.sh \ /ais/build/hipfile/examples/aiscp/aiscp ' - name: hipFile fastpath/AIS IO test using aiscp run: | docker exec \ -t \ -w "/mnt/ais-fs/${AIS_CONTAINER_NAME}" \ "${AIS_CONTAINER_NAME}" \ /bin/bash -c ' HIPFILE_ALLOW_COMPAT_MODE=false /ais/rocm-systems/projects/hipfile/util/ci-aiscp-test.sh \ /ais/build/hipfile/examples/aiscp/aiscp ' - name: Destroy hipfile IO test directory if: ${{ always() }} run: | docker exec -t "${AIS_CONTAINER_NAME}" /bin/bash -c "rm -fr /mnt/ais-fs/${AIS_CONTAINER_NAME}" - name: Cleanup & Stop the Docker container if: ${{ always() }} run: | if docker inspect "${AIS_CONTAINER_NAME}" >/dev/null 2>&1; then docker stop "${AIS_CONTAINER_NAME}" else echo "Container ${AIS_CONTAINER_NAME} does not exist; skipping stop" fi - name: Cleanup self-hosted runner workspace if: ${{ always() }} shell: bash # ${VAR:?} aborts if GITHUB_WORKSPACE is unset/empty, so a missing value # can never let the glob expand to `/*` and wipe the persistent runner. run: | shopt -s dotglob rm -rf "${GITHUB_WORKSPACE:?}"/*