Fix Babylon build: consolidate workflow and use correct paths #24
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Babylon Demo | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - 'demos/babylon/**' | |
| - '.github/workflows/babylon.yml' | |
| pull_request: | |
| paths: | |
| - 'demos/babylon/**' | |
| - '.github/workflows/babylon.yml' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: babylon-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-babylon: | |
| name: Build Babylon JDK + HAT | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Babylon | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: openjdk/babylon | |
| path: babylon | |
| - name: Cache Babylon JDK and HAT | |
| id: cache-babylon | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| babylon/build/linux-x86_64-server-release/images/jdk | |
| babylon/hat/build | |
| key: ${{ runner.os }}-babylon-hat-${{ hashFiles('babylon/.git/refs/heads/code-reflection') }} | |
| restore-keys: | | |
| ${{ runner.os }}-babylon-hat- | |
| - name: Install Build Dependencies | |
| if: steps.cache-babylon.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| autoconf \ | |
| cmake \ | |
| libx11-dev \ | |
| libxext-dev \ | |
| libxrender-dev \ | |
| libxrandr-dev \ | |
| libxtst-dev \ | |
| libxt-dev \ | |
| libcups2-dev \ | |
| libfontconfig1-dev \ | |
| libasound2-dev \ | |
| libfreetype6-dev \ | |
| ocl-icd-opencl-dev \ | |
| pocl-opencl-icd \ | |
| zip \ | |
| unzip | |
| - name: Setup Boot JDK | |
| if: steps.cache-babylon.outputs.cache-hit != 'true' | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Configure and Build Babylon JDK | |
| if: steps.cache-babylon.outputs.cache-hit != 'true' | |
| run: | | |
| cd babylon | |
| bash configure --disable-warnings-as-errors | |
| make images JOBS=$(nproc) | |
| - name: Build HAT | |
| if: steps.cache-babylon.outputs.cache-hit != 'true' | |
| run: | | |
| cd babylon/hat | |
| export JAVA_HOME=$(pwd)/../build/linux-x86_64-server-release/images/jdk | |
| export PATH=$JAVA_HOME/bin:$PATH | |
| echo "Building HAT with JAVA_HOME=$JAVA_HOME" | |
| java --version | |
| # Build HAT Java components | |
| java @hat/bld | |
| # Build HAT native OpenCL backend | |
| echo "Building HAT native OpenCL backend..." | |
| mkdir -p build/cmake-opencl | |
| cd build/cmake-opencl | |
| cmake ../../hat/backends/ffi/opencl -DJAVA_HOME=$JAVA_HOME | |
| make -j$(nproc) | |
| cp *.so ../ | |
| cd ../.. | |
| echo "HAT build contents:" | |
| ls -la build/ | |
| - name: Upload Babylon JDK + HAT Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: babylon-jdk-hat | |
| path: | | |
| babylon/build/linux-x86_64-server-release/images/jdk | |
| babylon/hat/build | |
| include-hidden-files: true | |
| retention-days: 7 | |
| babylon-runtime-check: | |
| name: Babylon Runtime Check | |
| needs: build-babylon | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Babylon JDK + HAT Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: babylon-jdk-hat | |
| path: babylon | |
| - name: Setup Environment | |
| run: | | |
| echo "=== Making JDK binaries executable ===" | |
| chmod -R +x babylon/build/linux-x86_64-server-release/images/jdk/bin/ | |
| find babylon/build/linux-x86_64-server-release/images/jdk/lib -type f -name "jspawnhelper" -exec chmod +x {} \; | |
| find babylon/build/linux-x86_64-server-release/images/jdk/lib -type f -name "*.so" -exec chmod +x {} \; | |
| echo "BABYLON_JDK_HOME=$(pwd)/babylon/build/linux-x86_64-server-release/images/jdk" >> $GITHUB_ENV | |
| echo "HAT_BUILD=$(pwd)/babylon/hat/build" >> $GITHUB_ENV | |
| - name: Verify Babylon JDK | |
| run: | | |
| echo "=== Babylon JDK Version ===" | |
| $BABYLON_JDK_HOME/bin/java --version | |
| echo "" | |
| echo "=== Checking for Code Reflection module ===" | |
| $BABYLON_JDK_HOME/bin/java --list-modules | grep -E "jdk.incubator.code" || echo "Module not in default list (expected - it's incubating)" | |
| echo "" | |
| echo "=== HAT Build Contents ===" | |
| ls -la $HAT_BUILD/ || echo "HAT build directory not found" | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Run Babylon RuntimeCheck | |
| env: | |
| JAVA_HOME: ${{ env.BABYLON_JDK_HOME }} | |
| run: | | |
| echo "========================================" | |
| echo "Running Babylon RuntimeCheck" | |
| echo "========================================" | |
| echo "JAVA_HOME: $JAVA_HOME" | |
| echo "" | |
| ./gradlew :demos:babylon:run \ | |
| -Porg.gradle.java.installations.paths=$JAVA_HOME \ | |
| -Porg.gradle.java.installations.auto-detect=false \ | |
| -Porg.gradle.java.installations.auto-download=false \ | |
| --no-daemon | |
| - name: Summary | |
| run: | | |
| echo "## Babylon Runtime Check Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### JDK Version" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| $BABYLON_JDK_HOME/bin/java --version >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Result" >> $GITHUB_STEP_SUMMARY | |
| echo "The RuntimeCheck demo ran successfully with Babylon JDK." >> $GITHUB_STEP_SUMMARY | |
| hat-matmul: | |
| name: HAT MatMul Test | |
| needs: build-babylon | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Babylon (for HAT run scripts) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: openjdk/babylon | |
| path: babylon | |
| - name: Download Babylon JDK + HAT Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: babylon-jdk-hat | |
| path: babylon-artifact | |
| - name: Install OpenCL Runtime | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ocl-icd-opencl-dev pocl-opencl-icd clinfo | |
| echo "=== OpenCL Devices ===" | |
| clinfo -l || echo "No OpenCL devices found (expected on CI)" | |
| - name: Setup Environment | |
| run: | | |
| echo "=== Setting up Babylon JDK ===" | |
| chmod -R +x babylon-artifact/build/linux-x86_64-server-release/images/jdk/bin/ | |
| find babylon-artifact/build/linux-x86_64-server-release/images/jdk/lib -type f -name "jspawnhelper" -exec chmod +x {} \; | |
| find babylon-artifact/build/linux-x86_64-server-release/images/jdk/lib -type f -name "*.so" -exec chmod +x {} \; | |
| echo "JAVA_HOME=$(pwd)/babylon-artifact/build/linux-x86_64-server-release/images/jdk" >> $GITHUB_ENV | |
| echo "HAT_BUILD=$(pwd)/babylon-artifact/hat/build" >> $GITHUB_ENV | |
| - name: Copy HAT build to Babylon source | |
| run: | | |
| # HAT run scripts expect build dir in babylon/hat/build | |
| cp -r babylon-artifact/hat/build babylon/hat/ | |
| ls -la babylon/hat/build/ | |
| - name: Run HAT MatMul | |
| run: | | |
| export PATH=$JAVA_HOME/bin:$PATH | |
| echo "========================================" | |
| echo "Running HAT MatMul with OpenCL" | |
| echo "========================================" | |
| echo "JAVA_HOME: $JAVA_HOME" | |
| java --version | |
| echo "" | |
| cd babylon/hat | |
| # Run MatMul with OpenCL backend | |
| # Using smaller matrix for CI (256x256 instead of 1024x1024) | |
| java @hat/run ffi-opencl matmul 2DTILING 256 | |
| - name: Summary | |
| if: always() | |
| run: | | |
| echo "## HAT MatMul Test Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Configuration" >> $GITHUB_STEP_SUMMARY | |
| echo "- Backend: OpenCL (POCL CPU)" >> $GITHUB_STEP_SUMMARY | |
| echo "- Algorithm: 2DTILING" >> $GITHUB_STEP_SUMMARY | |
| echo "- Matrix Size: 256x256" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Result" >> $GITHUB_STEP_SUMMARY | |
| echo "HAT MatMul completed successfully using Code Reflection for GPU kernel generation." >> $GITHUB_STEP_SUMMARY |