diff --git a/.github/workflows/build-windows-gpu.yml b/.github/workflows/build-windows-gpu.yml index 04f09ba..600bb51 100644 --- a/.github/workflows/build-windows-gpu.yml +++ b/.github/workflows/build-windows-gpu.yml @@ -78,12 +78,14 @@ permissions: # To add a selectable version: # 1. Add it to the corresponding workflow_dispatch choice above. # 2. CUDA: verify vendor/llama.cpp/.github/actions/windows-setup-cuda supports it. -# 3. ROCm: verify the version exists at https://repo.amd.com/rocm/whl-multi-arch/. +# 3. ROCm: verify the version in the legacy 7.14 or stable 10+ package index. # 4. Vulkan: verify the version exists at https://vulkan.lunarg.com/sdk/home#windows. # 5. Run the corresponding backend manually and verify its DLL and ZIP artifact. env: CUDA_VERSION: ${{ inputs.cuda_version }} ROCM_VERSION: ${{ inputs.rocm_version }} + # ROCm 10 stable moved to the new TheRock aggregate index; 7.14 remains legacy. + ROCM_INDEX_URL: ${{ startsWith(inputs.rocm_version, '10.') && 'https://stable.repo.amd.com/rocm/whl-next/' || 'https://repo.amd.com/rocm/whl-multi-arch/' }} VULKAN_VERSION: ${{ inputs.vulkan_version }} concurrency: @@ -233,24 +235,12 @@ jobs: uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: C:\TheRock\build - key: windows-2022-${{ runner.arch }}-${{ steps.rocm-cache-context.outputs.image }}-python-${{ steps.rocm-cache-context.outputs.python }}-rocm-sdk-${{ env.ROCM_VERSION }}-${{ env.GPU_TARGET }}-${{ hashFiles('vendor/llama.cpp/.github/actions/windows-setup-rocm/action.yml') }} - - - name: Set up ROCm - if: steps.rocm-sdk-cache.outputs.cache-hit != 'true' - uses: ./vendor/llama.cpp/.github/actions/windows-setup-rocm - with: - version: ${{ env.ROCM_VERSION }} - - - name: Install ROCm device kernels - if: steps.rocm-sdk-cache.outputs.cache-hit != 'true' - shell: pwsh - run: | - $ErrorActionPreference = 'Stop' - & C:\TheRock\build\.venv\Scripts\Activate.ps1 - python -m pip install --index-url https://repo.amd.com/rocm/whl-multi-arch/ "rocm[device-${env:GPU_TARGET}]==${env:ROCM_VERSION}" - if ($LASTEXITCODE -ne 0) { throw "ROCm device wheel installation failed: $LASTEXITCODE" } - rocm-sdk init - if ($LASTEXITCODE -ne 0) { throw "rocm-sdk init after device installation failed: $LASTEXITCODE" } + key: windows-2022-${{ runner.arch }}-${{ steps.rocm-cache-context.outputs.image }}-python-${{ steps.rocm-cache-context.outputs.python }}-rocm-sdk-${{ env.ROCM_VERSION }}-${{ env.GPU_TARGET }}-${{ hashFiles('scripts/Install-Rocm.ps1') }} + + - name: Set up ROCm SDK and device kernels + if: steps.rocm-sdk-cache.outputs.cache-hit != 'true' + shell: pwsh + run: ./scripts/Install-Rocm.ps1 -Version $env:ROCM_VERSION -IndexUrl $env:ROCM_INDEX_URL -Target $env:GPU_TARGET - name: Export ROCm environment shell: pwsh diff --git a/README.md b/README.md index cee96cc..6d7cd84 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ ROCm版ZIPには、同梱ランタイムを確認してPATHを一時設定する | ROCm | `7.14.0`、`10.0.0` | `7.14.0` | | Vulkan SDK | `1.4.357.0` | `1.4.357.0` | -ROCmは安定して利用してきた7系と、新しい10系を選べます。選択した値はセットアップ、キャッシュキー、ZIP Artifact名、Release情報へ引き継がれるため、異なるバージョンのキャッシュや成果物は混在しません。 +ROCmは安定して利用してきた7系と、新しい10系を選べます。7.14系は従来のmulti-arch wheelインデックス、10系は新しいTheRock stableインデックスから取得します。選択した値はセットアップ、キャッシュキー、ZIP Artifact名、Release情報へ引き継がれるため、異なるバージョンのキャッシュや成果物は混在しません。 `.github/workflows/build-windows-gpu.yml`のトップレベル`env`は、手動実行時の入力を各ジョブへ共有します。 @@ -167,7 +167,7 @@ env: 1. `workflow_dispatch.inputs`にある該当バージョンの`options`へ候補を追加します。既定値も更新する場合は同じ入力の`default`を変更します。 2. CUDAの場合は、`vendor/llama.cpp/.github/actions/windows-setup-cuda/action.yml`に新しいバージョンのインストール処理が存在することを確認します。必要であれば、先に`llama.cpp` submoduleを更新します。 -3. ROCmの場合は、AMDの`rocm/whl-multi-arch`パッケージインデックスで対象バージョンが公開されていることを確認します。 +3. ROCmの場合は、7.14系ならAMDの従来の`rocm/whl-multi-arch`、10系以降ならTheRockの`stable.repo.amd.com/rocm/whl-next`パッケージインデックスで対象バージョンが公開されていることを確認します。 4. Vulkanの場合は、LunarGのWindows SDKダウンロードページで対象バージョンが公開されていることを確認します。 5. GitHub Actionsから変更したバックエンドだけを実行し、バックエンドDLLとバージョン付きZIP Artifactが生成されることを確認します。ROCm版では依存DLL、`rocblas\library`、ライセンスもZIPに含まれることを確認します。 diff --git a/scripts/Install-Rocm.ps1 b/scripts/Install-Rocm.ps1 new file mode 100644 index 0000000..e20a4a5 --- /dev/null +++ b/scripts/Install-Rocm.ps1 @@ -0,0 +1,32 @@ +param( + [Parameter(Mandatory = $true)] + [string]$Version, + + [Parameter(Mandatory = $true)] + [uri]$IndexUrl, + + [Parameter(Mandatory = $true)] + [ValidatePattern('^gfx[0-9a-f]+$')] + [string]$Target +) + +$ErrorActionPreference = 'Stop' +$venvRoot = 'C:\TheRock\build\.venv' + +New-Item -Path (Split-Path $venvRoot) -ItemType Directory -Force | Out-Null +python -m venv $venvRoot +if ($LASTEXITCODE -ne 0) { throw "Python virtual environment creation failed: $LASTEXITCODE" } + +& (Join-Path $venvRoot 'Scripts\Activate.ps1') +python -m pip install --upgrade pip +if ($LASTEXITCODE -ne 0) { throw "pip upgrade failed: $LASTEXITCODE" } + +$package = "rocm[libraries,devel,device-$Target]==$Version" +Write-Host "Installing $package from $IndexUrl" +python -m pip install --index-url $IndexUrl.AbsoluteUri $package +if ($LASTEXITCODE -ne 0) { + throw "ROCm wheel installation failed for version '$Version' and target '$Target' from '$IndexUrl'." +} + +rocm-sdk init +if ($LASTEXITCODE -ne 0) { throw "rocm-sdk init failed: $LASTEXITCODE" }