|  | 
|  | 1 | +# UMF compatibility with intel/llvm workflow. | 
|  | 2 | +# The latest llvm daily release and the last working release are tested. | 
|  | 3 | +# Triggered in the Nightly workflow. | 
|  | 4 | +name: SYCL | 
|  | 5 | + | 
|  | 6 | +on: workflow_call | 
|  | 7 | + | 
|  | 8 | +permissions: | 
|  | 9 | +  contents: read | 
|  | 10 | + | 
|  | 11 | +jobs: | 
|  | 12 | +  sycl-compatibility: | 
|  | 13 | +    # run only on upstream; forks will not have the HW | 
|  | 14 | +    if: github.repository == 'oneapi-src/unified-memory-framework' | 
|  | 15 | +    name: ${{matrix.llvm_tag}} llvm build | 
|  | 16 | +    runs-on: ["DSS-LEVEL_ZERO", "DSS-UBUNTU"] | 
|  | 17 | + | 
|  | 18 | +    strategy: | 
|  | 19 | +      matrix: | 
|  | 20 | +        llvm_tag: ["latest", "nightly-2025-02-08"] # "latest" or llvm with UMF v0.11.0-dev2 | 
|  | 21 | + | 
|  | 22 | +    steps: | 
|  | 23 | +    # Install sycl | 
|  | 24 | +    - name: Clean up | 
|  | 25 | +      if: always() | 
|  | 26 | +      run: rm -rf llvm sycl_linux.tar.gz | 
|  | 27 | + | 
|  | 28 | +    - name: Download llvm daily release | 
|  | 29 | +      run: | | 
|  | 30 | +        if [ "${{ matrix.llvm_tag }}" == "latest" ]; then | 
|  | 31 | +          llvm_tag=$(curl -s https://api.github.com/repos/intel/llvm/releases | awk -F'"' '/"tag_name":/ {print $4; exit}') | 
|  | 32 | +        else | 
|  | 33 | +          llvm_tag="${{ matrix.llvm_tag }}" | 
|  | 34 | +        fi | 
|  | 35 | +        download_url="https://github.com/intel/llvm/releases/download/${llvm_tag}/sycl_linux.tar.gz" | 
|  | 36 | +        wget --no-verbose $download_url -O sycl_linux.tar.gz | 
|  | 37 | +
 | 
|  | 38 | +    - name: Extract llvm | 
|  | 39 | +      run: | | 
|  | 40 | +        mkdir llvm | 
|  | 41 | +        tar -xzf sycl_linux.tar.gz -C llvm --strip-components=1 | 
|  | 42 | +
 | 
|  | 43 | +    - name: Remove UMF installed with llvm | 
|  | 44 | +      run: rm -f llvm/lib/libumf* | 
|  | 45 | + | 
|  | 46 | +    - name: Add sycl to PATH | 
|  | 47 | +      run: | | 
|  | 48 | +        echo "${{ github.workspace }}/llvm/bin" >> $GITHUB_PATH | 
|  | 49 | +        echo "LD_LIBRARY_PATH=${{ github.workspace }}/llvm/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | 
|  | 50 | +
 | 
|  | 51 | +    # Install UMF | 
|  | 52 | +    - name: Checkout UMF | 
|  | 53 | +      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | 
|  | 54 | +      with: | 
|  | 55 | +        path: umf_repo | 
|  | 56 | +        fetch-depth: 0 | 
|  | 57 | + | 
|  | 58 | +    - name: Configure UMF | 
|  | 59 | +      working-directory: umf_repo | 
|  | 60 | +      run: > | 
|  | 61 | +        cmake | 
|  | 62 | +        -B build | 
|  | 63 | +        -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/llvm | 
|  | 64 | +        -DCMAKE_BUILD_TYPE=Release | 
|  | 65 | +        -DCMAKE_C_COMPILER=gcc | 
|  | 66 | +        -DCMAKE_CXX_COMPILER=g++ | 
|  | 67 | +        -DUMF_BUILD_SHARED_LIBRARY=ON | 
|  | 68 | +        -DUMF_BUILD_TESTS=OFF | 
|  | 69 | +        -DUMF_BUILD_EXAMPLES=OFF | 
|  | 70 | +
 | 
|  | 71 | +    - name: Build and install UMF | 
|  | 72 | +      working-directory: umf_repo | 
|  | 73 | +      run: cmake --build build --target install -j$(nproc) | 
|  | 74 | + | 
|  | 75 | +    - name: Print installed lib files | 
|  | 76 | +      run: ls -l llvm/lib | 
|  | 77 | + | 
|  | 78 | +    # Test sycl-ls | 
|  | 79 | +    - name: Run sycl-ls | 
|  | 80 | +      run: | | 
|  | 81 | +        ./llvm/bin/sycl-ls | tee sycl-ls-output.log | 
|  | 82 | +        grep -q "level_zero:gpu" sycl-ls-output.log | 
|  | 83 | +
 | 
|  | 84 | +    # Test several sycl e2e test | 
|  | 85 | +    # These are arbitrarily picked tests to check the compatibility | 
|  | 86 | +    # Note that some intel/llvm tests may be flaky, although I haven't noticed such a behavior in the following tests | 
|  | 87 | +    - name: Checkout sycl | 
|  | 88 | +      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | 
|  | 89 | +      with: | 
|  | 90 | +        repository: intel/llvm | 
|  | 91 | +        path: sycl_repo | 
|  | 92 | +        fetch-depth: 1 | 
|  | 93 | +        ref: sycl | 
|  | 94 | + | 
|  | 95 | +    - name: Create sycl tests build directory | 
|  | 96 | +      run: | | 
|  | 97 | +        TESTS_BUILD_DIR=${{ github.workspace }}/sycl_repo/sycl/test-e2e/build | 
|  | 98 | +        mkdir $TESTS_BUILD_DIR | 
|  | 99 | +        echo "TESTS_BUILD_DIR=$TESTS_BUILD_DIR" >> $GITHUB_ENV | 
|  | 100 | +
 | 
|  | 101 | +    - name: Build sycl e2e tests | 
|  | 102 | +      working-directory: sycl_repo | 
|  | 103 | +      run: | | 
|  | 104 | +        ${{github.workspace}}/llvm/bin/clang++ -fsycl sycl/test-e2e/AbiNeutral/submit-kernel.cpp -o ${{env.TESTS_BUILD_DIR}}/submit-kernel -Iinclude | 
|  | 105 | +        ${{github.workspace}}/llvm/bin/clang++ -fsycl sycl/test-e2e/Adapters/interop-l0-direct.cpp -o ${{env.TESTS_BUILD_DIR}}/interop-l0-direct -lze_loader -Iinclude | 
|  | 106 | +        ${{github.workspace}}/llvm/bin/clang++ -fsycl sycl/test-e2e/Adapters/level_zero_interop_memcpy.cpp -o ${{env.TESTS_BUILD_DIR}}/level_zero_interop_memcpy -Iinclude | 
|  | 107 | +        ${{github.workspace}}/llvm/bin/clang++ -fsycl sycl/test-e2e/Basic/build_log.cpp -o ${{env.TESTS_BUILD_DIR}}/build_log -Iinclude | 
|  | 108 | +        ${{github.workspace}}/llvm/bin/clang++ -fsycl sycl/test-e2e/PerformanceTests/ParallelFor/parallel_for_range_roundup.cpp -fsycl-range-rounding=force -o ${{env.TESTS_BUILD_DIR}}/parallel_for_range_roundup -Iinclude | 
|  | 109 | +        ${{github.workspace}}/llvm/bin/clang++ -fsycl sycl/test-e2e/USM/fill_any_size.cpp -o ${{env.TESTS_BUILD_DIR}}/fill_any_size -Iinclude | 
|  | 110 | +
 | 
|  | 111 | +    - name: Run sycl e2e tests | 
|  | 112 | +      env: | 
|  | 113 | +        ONEAPI_DEVICE_SELECTOR: level_zero:gpu | 
|  | 114 | +        UMF_LOG: "level:debug;flush:debug;output:stdout;pid:yes" | 
|  | 115 | +      working-directory: ${{env.TESTS_BUILD_DIR}} | 
|  | 116 | +      run: | | 
|  | 117 | +        echo "---Run submit-kernel test" && ./submit-kernel | 
|  | 118 | +        echo "---Run interop-l0-direct test" && ./interop-l0-direct | 
|  | 119 | +        echo "---Run level_zero_interop_memcpy test" && ./level_zero_interop_memcpy | 
|  | 120 | +        echo "---Run build_log test" && ./build_log | 
|  | 121 | +        echo "---Run parallel_for_range_roundup test" && ./parallel_for_range_roundup | 
|  | 122 | +        echo "---Run fill_any_size test" && ./fill_any_size | 
0 commit comments