diff --git a/.github/workflows/sycl-linux-run-tests.yml b/.github/workflows/sycl-linux-run-tests.yml index ac6195e7b8776..4961065799453 100644 --- a/.github/workflows/sycl-linux-run-tests.yml +++ b/.github/workflows/sycl-linux-run-tests.yml @@ -140,6 +140,18 @@ on: type: string default: 'false' required: False + ur_artifact: + type: string + default: '' + required: False + ur_artifact_filename: + type: string + default: '' + required: False + ur_decompress_command: + type: string + default: '' + required: False workflow_dispatch: inputs: @@ -359,6 +371,9 @@ jobs: preset: ${{ inputs.benchmark_preset }} dry_run: ${{ inputs.benchmark_dry_run }} build_ref: ${{ inputs.repo_ref }} + ur_artifact: ${{ inputs.ur_artifact }} + ur_artifact_filename: ${{ inputs.ur_artifact_filename }} + ur_decompress_command: ${{ inputs.ur_decompress_command }} env: RUNNER_TAG: ${{ inputs.runner }} GITHUB_TOKEN: ${{ secrets.LLVM_SYCL_BENCHMARK_TOKEN }} diff --git a/.github/workflows/sycl-nightly-benchmarking.yml b/.github/workflows/sycl-nightly-benchmarking.yml index 9d1098ee68b33..0079a302499e0 100644 --- a/.github/workflows/sycl-nightly-benchmarking.yml +++ b/.github/workflows/sycl-nightly-benchmarking.yml @@ -21,8 +21,22 @@ jobs: toolchain_artifact: sycl_linux_default toolchain_artifact_filename: sycl_linux.tar.gz + build_ur: + name: Build UR + uses: ./.github/workflows/ur-build-hw.yml + with: + adapter_name: 'L0' + other_adapter_name: 'L0_V2' + runner: '["Linux", "build"]' + static_loader: 'OFF' + static_adapter: 'OFF' + docker_image: 'ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps' + image_options: "-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN" + run_tests: 'OFF' + produce_artifact: 'ON' + run-sycl-benchmarks: - needs: [ubuntu2204_build] + needs: [ubuntu2204_build, build_ur] if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }} strategy: fail-fast: false @@ -49,4 +63,7 @@ jobs: toolchain_artifact: ${{ needs.ubuntu2204_build.outputs.toolchain_artifact }} toolchain_artifact_filename: ${{ needs.ubuntu2204_build.outputs.toolchain_artifact_filename }} toolchain_decompress_command: ${{ needs.ubuntu2204_build.outputs.toolchain_decompress_command }} + ur_artifact: ${{ needs.build_ur.outputs.artifact }} + ur_artifact_filename: ${{ needs.build_ur.outputs.artifact_filename }} + ur_decompress_command: ${{ needs.build_ur.outputs.decompress_command }} diff --git a/.github/workflows/sycl-ur-perf-benchmarking.yml b/.github/workflows/sycl-ur-perf-benchmarking.yml index b5b14cf34ade1..76ba5e19eef33 100644 --- a/.github/workflows/sycl-ur-perf-benchmarking.yml +++ b/.github/workflows/sycl-ur-perf-benchmarking.yml @@ -168,12 +168,25 @@ jobs: cc: clang cxx: clang++ changes: '[]' - toolchain_artifact: sycl_linux_prod_noassert + build_ur: + name: Build UR + uses: ./.github/workflows/ur-build-hw.yml + with: + # Only 2 adapters supported currently, level_zero and level_zero_v2: + adapter_name: ${{ inputs.backend == 'level_zero_v2:gpu' && 'L0_V2' || 'L0' }} + runner: '["Linux", "build"]' + static_loader: 'OFF' + static_adapter: 'OFF' + docker_image: 'ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps' + image_options: "-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN" + run_tests: 'OFF' + produce_artifact: 'ON' + run_benchmarks_build: name: Run Benchmarks on Build - needs: [ build_sycl, sanitize_inputs ] + needs: [ build_sycl, build_ur, sanitize_inputs ] strategy: matrix: include: @@ -196,3 +209,6 @@ jobs: toolchain_artifact: ${{ needs.build_sycl.outputs.toolchain_artifact }} toolchain_artifact_filename: ${{ needs.build_sycl.outputs.toolchain_artifact_filename }} toolchain_decompress_command: ${{ needs.build_sycl.outputs.toolchain_decompress_command }} + ur_artifact: ${{ needs.build_ur.outputs.artifact }} + ur_artifact_filename: ${{ needs.build_ur.outputs.artifact_filename }} + ur_decompress_command: ${{ needs.build_ur.outputs.decompress_command }} diff --git a/.github/workflows/ur-build-hw.yml b/.github/workflows/ur-build-hw.yml index 21597795d9e89..7625778c36e92 100644 --- a/.github/workflows/ur-build-hw.yml +++ b/.github/workflows/ur-build-hw.yml @@ -10,7 +10,7 @@ on: required: false type: string default: "" - runner_name: + runner: required: true type: string static_loader: @@ -29,6 +29,22 @@ on: required: true type: string default: "" + run_tests: + required: false + type: string + default: "ON" + produce_artifact: + required: false + type: string + default: "OFF" + outputs: + artifact: + value: ${{ jobs.adapter_build_hw.outputs.artifact }} + artifact_filename: + value: ${{ jobs.adapter_build_hw.outputs.artifact_filename }} + decompress_command: + value: ${{ jobs.adapter_build_hw.outputs.decompress_command }} + workflow_dispatch: inputs: adapter_name: @@ -38,7 +54,7 @@ on: required: false type: string default: "" - runner_name: + runner: required: true type: string static_loader: @@ -57,6 +73,14 @@ on: required: true type: string default: "" + run_tests: + required: false + type: string + default: "ON" + produce_artifact: + required: false + type: string + default: "OFF" permissions: read-all @@ -85,11 +109,25 @@ jobs: ] build_type: [Release] compiler: [{c: gcc, cxx: g++}] + # sanitize input: enforce run_tests to be either "ON" or "OFF" + run_tests: ["${{ inputs.run_tests == 'ON' && 'ON' || 'OFF' }}"] + artifact: [ + { + name: "ur_adapter_${{inputs.adapter_name}}_${{inputs.other_adapter_name}}", + archive_name: "ur_adapter_${{inputs.adapter_name}}_${{inputs.other_adapter_name}}.tar.zst", + compress_command: "zstd -9", + decompress_command: "zstd", + } + ] - runs-on: ${{inputs.runner_name}} + runs-on: ${{ fromJSON(inputs.runner) }} container: image: ${{ inputs.docker_image }} options: ${{ inputs.image_options }} + outputs: + artifact: ${{ steps.pack_artifact.outputs.artifact }} + artifact_filename: ${{ steps.pack_artifact.outputs.artifact_filename }} + decompress_command: ${{ steps.pack_artifact.outputs.decompress_command }} steps: # TODO: @@ -140,9 +178,9 @@ jobs: -DCMAKE_C_COMPILER=${{matrix.compiler.c}} -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - -DUR_ENABLE_TRACING=ON - -DUR_DEVELOPER_MODE=ON - -DUR_BUILD_TESTS=ON + -DUR_ENABLE_TRACING=${{matrix.run_tests}} + -DUR_DEVELOPER_MODE=${{matrix.run_tests}} + -DUR_BUILD_TESTS=${{matrix.run_tests}} -DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON ${{ matrix.adapter.other_name != '' && format('-DUR_BUILD_ADAPTER_{0}=ON', matrix.adapter.other_name) || '' }} -DUR_STATIC_LOADER=${{matrix.adapter.static_Loader}} @@ -154,10 +192,12 @@ jobs: ${{ matrix.adapter.name == 'HIP' && '-DUR_HIP_PLATFORM=AMD' || '' }} - name: Build + id: build_ur # This is so that device binaries can find the sycl runtime library run: cmake --build build -j $(nproc) - name: Install + id: install_ur # This is to check that install command does not fail run: cmake --install build @@ -169,14 +209,32 @@ jobs: LIT_FILTER_OUT: "(adapters/level_zero/memcheck.test|adapters/level_zero/v2/deferred_kernel_memcheck.test)" run: cmake --build build -j $(nproc) -- check-unified-runtime-adapter # Don't run adapter specific tests when building multiple adapters - if: ${{ matrix.adapter.other_name == '' }} + if: ${{ matrix.adapter.other_name == '' && matrix.run_tests == 'ON' }} - name: Test adapters + if: matrix.run_tests == 'ON' env: ZE_ENABLE_LOADER_DEBUG_TRACE: 1 LIT_OPTS: "--timeout 120" run: cmake --build build -j $(nproc) -- check-unified-runtime-conformance + - name: Pack UR build + id: pack_artifact + if: ${{ inputs.produce_artifact == 'ON' && steps.build_ur.conclusion == 'success' && steps.install_ur.conclusion == 'success' }} + run: | + tar -I '${{ matrix.artifact.compress_command }}' \ + -cf '${{ matrix.artifact.archive_name }}' -C ./install . + echo "artifact=${{ matrix.artifact.name }}" >> $GITHUB_OUTPUT + echo "artifact_filename=${{ matrix.artifact.archive_name }}" >> $GITHUB_OUTPUT + echo "decompress_command=${{ matrix.artifact.decompress_command }}" >> $GITHUB_OUTPUT + - name: Upload UR build + if: ${{ inputs.produce_artifact == 'ON' && steps.build_ur.conclusion == 'success' && steps.install_ur.conclusion == 'success' }} + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact.name }} + path: ${{ matrix.artifact.archive_name }} + retention-days: 3 + - name: Get information about platform if: ${{ always() }} run: ./unified-runtime/.github/scripts/get_system_info.sh diff --git a/.github/workflows/ur-precommit.yml b/.github/workflows/ur-precommit.yml index 39764d5d38632..62c7e143e6bdc 100644 --- a/.github/workflows/ur-precommit.yml +++ b/.github/workflows/ur-precommit.yml @@ -57,42 +57,42 @@ jobs: # UR will not use the loader if there is only one target. include: - name: L0 - runner: UR_L0 + runner: '["UR_L0"]' image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN - name: L0_V2 - runner: UR_L0 + runner: '["UR_L0"]' image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN - name: L0 - runner: UR_L0 + runner: '["UR_L0"]' static: ON image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN - name: L0 - runner: UR_L0 + runner: '["UR_L0"]' other_adapter: NATIVE_CPU image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN - name: HIP - runner: UR_HIP + runner: '["UR_HIP"]' image_options: -u 1001 --device=/dev/dri --device=/dev/kfd --cap-add=SYS_ADMIN - name: CUDA - runner: UR_CUDA + runner: '["UR_CUDA"]' image_options: -u 1001 --privileged --cap-add SYS_ADMIN --gpus all - name: OPENCL - runner: UR_OPENCL + runner: '["UR_OPENCL"]' docker_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest" image_options: -u 1001 --device=/dev/dri --device=/dev/kfd --privileged --cap-add SYS_ADMIN - name: OPENCL - runner: UR_OPENCL + runner: '["UR_OPENCL"]' other_adapter: NATIVE_CPU docker_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest" image_options: -u 1001 --device=/dev/dri --device=/dev/kfd --privileged --cap-add SYS_ADMIN - name: NATIVE_CPU - runner: UR_NATIVE_CPU + runner: '["UR_NATIVE_CPU"]' docker_image: "ghcr.io/intel/llvm/ubuntu2204_build:latest" image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN uses: ./.github/workflows/ur-build-hw.yml with: adapter_name: ${{ matrix.name }} - runner_name: ${{ matrix.runner }} + runner: ${{ matrix.runner }} static_loader: ${{ matrix.static || 'OFF' }} static_adapter: ${{ matrix.static || 'OFF' }} other_adapter_name: ${{ matrix.other_adapter || '' }} diff --git a/devops/actions/run-tests/benchmark/action.yml b/devops/actions/run-tests/benchmark/action.yml index e09582be0fde6..05ed388601ec3 100644 --- a/devops/actions/run-tests/benchmark/action.yml +++ b/devops/actions/run-tests/benchmark/action.yml @@ -32,6 +32,15 @@ inputs: dry_run: type: string required: False + ur_artifact: + type: string + required: False + ur_artifact_filename: + type: string + required: False + ur_decompress_command: + type: string + required: False runs: using: "composite" @@ -95,19 +104,21 @@ runs: ZE_AFFINITY_MASK=0 echo "ZE_AFFINITY_MASK=$ZE_AFFINITY_MASK" >> $GITHUB_ENV - # Compute-benchmarks relies on UR static libraries, cmake config files, etc. - # DPC++ doesn't ship with these files. The easiest way of obtaining these - # files is to build from scratch. - # - # TODO This is not the best place for this. We should come up with - # alternatives. A suggestion: Output UR builds as artifacts in ur_build_hw.yml - # and unpack it here instead. - # - # If we insist on not building the UR again, sycl_linux_build.yml can be - # modified output the entire sycl build dir as an artifact, in which the - # intermediate files required can be stitched together from the build files. - # However, this is not exactly "clean" or "fun to maintain"... + - name: Download UR build archive + if: inputs.ur_artifact != '' + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.ur_artifact }} + - name: Extract/Setup UR build archive + if: inputs.ur_artifact != '' + shell: bash + run: | + mkdir -p ur/install + tar -I '${{ inputs.ur_decompress_command }}' -xf ${{ inputs.ur_artifact_filename }} -C ur/install + rm -f ${{ inputs.ur_artifact_filename }} + # echo LD_LIBRARY_PATH=$PWD/ur/install/lib/:$LD_LIBRARY_PATH >> $GITHUB_ENV - name: Build Unified Runtime + if: inputs.ur_artifact == '' shell: bash run: | # Sparse-checkout UR at build ref: