diff options
| author | Gangzheng Tong <tonggangzheng@gmail.com> | 2025-08-29 14:15:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-29 21:15:52 +0000 |
| commit | 450ef7934c1adfdf4a3a3c72967de3c5798a020d (patch) | |
| tree | 3f46aaaf3aa10f0b0ee22e50951fc12571823d18 /.github/workflows/ci.yml | |
| parent | 74c39eaa3dbd6ca55a383afca51ec18962838f08 (diff) | |
Enable slangpy and slang-rhi tests for Mac (#8297)
This PR enables slang-rhi and slangpy tests in the slang CI for MacOS.
* exclude the slang-rhi `sampler-array` test for mac; issue tracked in
https://github.com/shader-slang/slang/issues/8246
* update slang-rhi for fix of `nested-parameter-block-2`
* for slangpy test, install the required python package in the github
mac runner only each CI run.
Closes: https://github.com/shader-slang/slang/issues/7330
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to '.github/workflows/ci.yml')
| -rw-r--r-- | .github/workflows/ci.yml | 107 |
1 files changed, 65 insertions, 42 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8272691c..6468a15af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,6 +84,12 @@ jobs: runs-on: ["Windows", "self-hosted", "GCP-T4"] has-gpu: true server-count: 8 + # Enable GPU tests for macOS release + - os: macos + config: release + full-gpu-tests: true + has-gpu: true + server-count: 3 # Enable debug layers for all by default - enable-debug-layers: true fail-fast: false @@ -166,7 +172,7 @@ jobs: run: ./extras/check-inst-version-changes.sh - name: Upload IR version check results - if: ${{ steps.check-versions.outputs.artifact_created == 'true' }} + if: ${{ steps.check-ir-versions.outputs.artifact_created == 'true' }} uses: actions/upload-artifact@v4 with: name: ir-version-check-results @@ -236,34 +242,34 @@ jobs: # LLVM is required to run the filecheck echo "Checking llvm ..." && echo "$supportedBackends" | grep -q llvm - if [[ "${{matrix.full-gpu-tests}}" == "true" ]] + if [[ "${{matrix.os}}" == "macos" ]] then - for backend in fxc dxc glslang visualstudio genericcpp nvrtc metal tint # clang gcc + for backend in metal do echo "Checking $backend ..." && echo "$supportedBackends" | grep -q "$backend" done - for api in 'vk,vulkan' 'dx12,d3d12' 'dx11,d3d11' 'cuda' 'wgpu,webgpu' + for api in 'mtl,metal' do echo "Checking $api ..." && echo "$smokeResult" | grep -q "Check $api: Supported" done - - echo "Printing CUDA compiler version: ..." && nvcc --version - echo "Printing GPU driver version: ..." && nvidia-smi -q | grep Version - echo "Printing Vulkan SDK version: ..." && vulkaninfo | grep -i version - fi - - if [[ "${{matrix.os}}" == "macos" ]] + else + if [[ "${{matrix.full-gpu-tests}}" == "true" ]] then - for backend in metal + for backend in fxc dxc glslang visualstudio genericcpp nvrtc metal tint # clang gcc do echo "Checking $backend ..." && echo "$supportedBackends" | grep -q "$backend" done - for api in 'mtl,metal' + for api in 'vk,vulkan' 'dx12,d3d12' 'dx11,d3d11' 'cuda' 'wgpu,webgpu' do echo "Checking $api ..." && echo "$smokeResult" | grep -q "Check $api: Supported" done + + echo "Printing CUDA compiler version: ..." && nvcc --version + echo "Printing GPU driver version: ..." && nvidia-smi -q | grep Version + echo "Printing Vulkan SDK version: ..." && vulkaninfo | grep -i version + fi fi - name: Test Slang @@ -309,7 +315,7 @@ jobs: PATH=$bin_dir:$PATH tools/slangc-test/test.sh - name: Test Slang via glsl # Run GLSL backend tests on release for pull requests, and not on merge_group, to reduce CI load. - if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && matrix.full-gpu-tests && matrix.config == 'release' + if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && matrix.os != 'macos' && matrix.full-gpu-tests && matrix.config == 'release' run: | export SLANG_RUN_SPIRV_VALIDATION=1 export SLANG_USE_SPV_SOURCE_LANGUAGE_UNKNOWN=1 @@ -327,40 +333,57 @@ jobs: # Some of the expensive tests that are not relevant for Slang (because they just test graphics API related things) are excluded using -tce. if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && matrix.full-gpu-tests && (github.event_name == 'pull_request' || matrix.config == 'release') run: | - "$bin_dir/slang-rhi-tests" -check-devices -tce=cmd-clear*,cmd-copy*,cmd-upload*,fence*,staging-heap*,texture-create* + export SLANG_RHI_EXCLUDE_TESTS="md-clear*,cmd-copy*,cmd-upload*,fence*,staging-heap*,texture-create*" + if [[ "${{matrix.os}}" == "macos" ]]; then + export SLANG_RHI_EXCLUDE_TESTS="sampler-array" + fi + "$bin_dir/slang-rhi-tests" -check-devices -tce="$SLANG_RHI_EXCLUDE_TESTS" - name: Run slangpy tests # Run slangpy tests on debug+release for pull requests, and only on release for merge_group, to reduce CI load. if: steps.filter.outputs.should-run == 'true' && matrix.platform != 'wasm' && matrix.full-gpu-tests && (github.event_name == 'pull_request' || matrix.config == 'release') - shell: pwsh run: | python --version - Write-Host "Cleaning up existing installations and installing slangpy..." - try { - $SLANGPY_LOCATION = python -c "import slangpy; print(slangpy.__file__.rsplit('\\', 2)[0])" - Start-Process -FilePath "python" -ArgumentList "-m pip uninstall -y slangpy" -Verb RunAs -Wait - if (Test-Path $SLANGPY_LOCATION) { - Write-Host "Removing existing slangpy directory at: $SLANGPY_LOCATION" - Remove-Item -Path $SLANGPY_LOCATION -Recurse -Force - } - } catch { - Write-Host "slangpy not found or already removed" - } + echo "Cleaning up existing installations and installing slangpy..." + + # Try to uninstall existing slangpy + python -m pip uninstall -y slangpy || echo "slangpy not found or already removed" + + # Install slangpy python -m pip install --verbose slangpy --user - $SITE_PACKAGES = python -c "import slangpy; print(slangpy.__file__.rsplit('\\', 2)[0])" - $bin_dir = $env:bin_dir -replace '^/c/', 'C:\' -replace '/', '\' - Write-Host "Site packages directory: $SITE_PACKAGES" - Write-Host "bin_dir location: $bin_dir" - try { - Copy-Item -Path "$bin_dir\slang*.dll" -Destination "$SITE_PACKAGES\slangpy\" -Force -ErrorAction Stop - } catch { - Write-Error "Failed to copy library files: $_" - exit 1 - } - Write-Host "Listing files in slangpy directory..." - Get-ChildItem -Path "$SITE_PACKAGES\slangpy" | ForEach-Object { Write-Host "$($_.Name) - Last Modified: $($_.LastWriteTime)" } - Write-Host "Running pytest on slangpy tests..." - $env:PYTHONPATH = "$SITE_PACKAGES" - python -m pytest "$SITE_PACKAGES\slangpy\tests" -v + + # Get site packages directory + SITE_PACKAGES=$(python -c "import slangpy; import os; print(os.path.dirname(os.path.dirname(slangpy.__file__)))") + echo "Site packages directory: $SITE_PACKAGES" + echo "bin_dir location: $bin_dir" + echo "lib_dir location: $lib_dir" + # Copy library files + if [[ "${{matrix.os}}" == "windows" ]]; then + cp "$bin_dir"/slang*.dll "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; } + else + cp "$lib_dir"/libslang*.* "$SITE_PACKAGES/slangpy/" || { echo "Failed to copy library files"; exit 1; } + fi + + echo "Listing files in slangpy directory..." + ls -la "$SITE_PACKAGES/slangpy/" + + echo "Installing python packages..." + + # Only install additional packages on GitHub-hosted runners, not self-hosted + if [[ "${{ runner.environment }}" != "self-hosted" ]]; then + # Download and install requirements from slangpy repository + echo "Fetching requirements-dev.txt from slangpy repository..." + curl -fsSL https://raw.githubusercontent.com/shader-slang/slangpy/main/requirements-dev.txt -o requirements-dev.txt + + echo "Installing development requirements..." + python -m pip install -r requirements-dev.txt + python -m pip install pytest-github-actions-annotate-failures + else + echo "Skipping additional package installation on self-hosted runner" + fi + + echo "Running pytest on slangpy tests..." + export PYTHONPATH="$SITE_PACKAGES" + python -m pytest "$SITE_PACKAGES/slangpy/tests" -ra - uses: actions/upload-artifact@v4 if: steps.filter.outputs.should-run == 'true' && ! matrix.full-gpu-tests with: |
