diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-09-09 19:34:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-10 02:34:44 +0000 |
| commit | 7026dec790ab0c239c58ebf72b17633e9e8765c3 (patch) | |
| tree | e555fdcea3bc23062884eb642e895d4688cdf780 /docs | |
| parent | e554e1b726814535565f0619a868b96b6f2fb525 (diff) | |
Update SPIRV-{Tools,Headers} (#8415)
This updates SPIRV submodules.
Unfortunately we cannot use the latest because one of PRs in SPIRV-Tools
causes VVL errors on our slang-tests. The issue is tracked in
- https://github.com/KhronosGroup/SPIRV-Tools/issues/6316
- https://github.com/shader-slang/slang/issues/8414
This PR also updates/simplifies the document of updating SPIRV process.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/update_spirv.md | 176 |
1 files changed, 46 insertions, 130 deletions
diff --git a/docs/update_spirv.md b/docs/update_spirv.md index 19dd47416..af7bae33d 100644 --- a/docs/update_spirv.md +++ b/docs/update_spirv.md @@ -8,75 +8,36 @@ There are three directories under `external` that are related to SPIR-V: In order to use the latest or custom SPIR-V, they need to be updated. -## Fork `shader-slang/SPIRV-Tools` repo and update it +## Update SPIRV-Headers and SPIRV-Tools -Currently Slang uses [shader-slang/SPIRV-Tools](https://github.com/shader-slang/SPIRV-Tools) forked from [KhronosGroup/SPIRV-Tools](https://github.com/KhronosGroup/SPIRV-Tools). -In order for Slang to use the latest changes from `KhronosGroup/SPIRV-Tools`, `shader-slang/SPIRV-Tools` needs to be updated. +On the Slang repo, you need to update to use the latest commit of SPIRV-Tools and SPIRV-Headers. -1. Fork `shader-slang/SPIRV-Tools` to your personal github organization like `your-name/SPIRV-Tools`. -1. Clone it on your local machine. +1. Create a branch for the update. ``` - git clone https://github.com/your-name/SPIRV-Tools.git # replace `your-name` to the actual URL + # This doc will use "update_spirv" as a branch name, + # but you can use a different name. + git checkout -b update_spirv ``` -1. Fetch from `KhronosGroup/SPIRV-Tools`. - ``` - git remote add khronos https://github.com/KhronosGroup/SPIRV-Tools.git - git fetch khronos - ``` -1. Create a branch for a Pull Request. + +1. Synchronize and update submodules. ``` - git checkout -b merge/update + git submodule sync + git submodule update --init --recursive ``` -1. Rebase to khronos/main + +1. Update the SPIRV-Tools submodule to the latest version. ``` - git rebase khronos/main # use ToT + git -C external/spirv-tools fetch + git -C external/spirv-tools checkout origin/main ``` -1. Push to Github. + +1. Update the SPIRV-Headers submodule to what SPIRV-Tools uses ``` - git push origin merge/update + git -C external/spirv-headers fetch + git -C external/spirv-tools/external/spirv-headers log -1 --oneline + git -C external/spirv-headers checkout [commit hash from the previous command] ``` -The steps above will create a branch called `merge/update`. You can use a different name but this document will use the name. - - -## Modify `.gitmodules` and use the `merge/update` branch - -Before creating a Pull Request for `merge/update`, you should test and make sure everything works. - -On a Slang repo side, you need to create a branch for the following changes. -``` -git clone https://github.com/your-name/slang.git # replace `your-name` to the actual URL -cd slang -git checkout -b update_spirv -``` - -Open `.gitmodules` and modify the setting to the following, -``` -[submodule "external/spirv-tools"] - path = external/spirv-tools - url = https://github.com/your-name/SPIRV-Tools.git -[submodule "external/spirv-headers"] - path = external/spirv-headers - url = https://github.com/KhronosGroup/SPIRV-Headers.git -``` -Note that you need to replace `your-name` with the actual URL from the previous step. - -Apply the URL changes with the following commands, -``` -git submodule sync -git submodule update --init --recursive - -cd spirv-headers -git fetch -git checkout origin/main # use ToT -cd .. - -cd external -cd spirv-tools -git fetch -git checkout merge/update # use merger/update branch -``` - ## Build spirv-tools @@ -89,43 +50,35 @@ cd spirv-tools python3.exe utils\git-sync-deps # this step may require you to register your ssh public key to gitlab.khronos.org cmake.exe . -B build cmake.exe --build build --config Release + +# Go back to repository root +cd ../.. ``` -## Copy the generated files from `spirv-tools` to `spirv-tools-generated` +## Copy the generated files from `spirv-tools/build/` to `spirv-tools-generated/` -Copy some of generated files from `external/spirv-tools/build/` to `external/spirv-tools-generated/`. -The following files are ones you need to copy at the moment, but the list may change in the future. +Copy the generated header files from `external/spirv-tools/build/` to `external/spirv-tools-generated/`. ``` -DebugInfo.h -NonSemanticShaderDebugInfo100.h -OpenCLDebugInfo100.h -build-version.inc -core.insts-unified1.inc -debuginfo.insts.inc -enum_string_mapping.inc -extension_enum.inc -generators.inc -glsl.std.450.insts.inc -nonsemantic.clspvreflection.insts.inc -nonsemantic.shader.debuginfo.100.insts.inc -nonsemantic.vkspreflection.insts.inc -opencl.debuginfo.100.insts.inc -opencl.std.insts.inc -operand.kinds-unified1.inc -spv-amd-gcn-shader.insts.inc -spv-amd-shader-ballot.insts.inc -spv-amd-shader-explicit-vertex-parameter.insts.inc -spv-amd-shader-trinary-minmax.insts.inc +rm external/spirv-tools-generated/*.h +rm external/spirv-tools-generated/*.inc +cp external/spirv-tools/build/*.h external/spirv-tools-generated/ +cp external/spirv-tools/build/*.inc external/spirv-tools-generated/ ``` ## Build Slang and run slang-test +After SPIRV submodules are updated, you need to build and test. +``` +# Make sure to clean up data generated from the previous SPIRV +rm -fr build +``` + There are many ways to build Slang executables. Refer to the [document](https://github.com/shader-slang/slang/blob/master/docs/building.md) for more detail. For a quick reference, you can build with the following commands, ``` -cmake.exe --preset vs2019 +cmake.exe --preset vs2022 cmake.exe --build --preset release ``` @@ -139,57 +92,20 @@ It is often the case that some of tests fail, because of the changes on SPIRV-He You need to properly resolve them before proceed. -## Create A Pull Request on `shader-slang/SPIRV-Tools` - -After testing is done, you should create a Pull Request on `shader-slang/SPIRV-Tools` repo. - -1. The git-push command will show you a URL for creating a Pull Request like following, - > https://github.com/your-name/SPIRV-Tools/pull/new/merge/update # replace `your-name` to the actual URL - - Create a Pull Request. -1. Wait for all workflows to pass. -1. Merge the PR and take a note of the commit ID for the next step. - -Note that this process will update `shader-slang/SPIRV-Tools` repo, but your merge is not used by `slang` repo yet. - +## Commit and create a Pull Request -## Create a Pull Request on `shader-slang/slang` +After testing is done, you need to stage and commit the updated submodule references and any generated files. +Note that when you want to use new commit IDs of the submodules, you have to stage with git-add command for the directory of the submodule itself. -After the PR is merged to `shader-slang/SPIRV-Tools`, `slang` needs to start using it. - -On the clone of Slang repo, revert the changes in `.gitmodules` if modified. -``` -# revert the change in .gitmodules -git checkout .gitmodules -git submodule sync -git submodule update --init --recursive ``` +git add external/spirv-headers +git add external/spirv-tools +git add external/spirv-tools-generated -You need to stage and commit the latest commit IDs of spirv-tools and spirv-headers. -Note that when you want to use a new commit IDs of the submodules, you have to stage with git-add command for the directly of the submodule itself. -``` -cd external - -# Add changes in spirv-tools-generated -git add spirv-tools-generated +# Add any other changes needed to resolve test failures -# Add commit ID of spirv-headers -cd spirv-headers -git fetch -git checkout origin/main # Use ToT -cd .. -git add spirv-headers - -# Add commit ID of spirv-tools -cd spirv-tools -git fetch -git checkout merge/update # Use merge/update branch -cd .. -git add spirv-tools - -# Add more if there are other changes to resolve the test failures. - -git commit -git push origin update_spirv +git commit -m "Update SPIRV-Tools and SPIRV-Headers to latest versions" +git push origin update_spirv # Use your own branch name as needed ``` -Once all changes are pushed to GitHub, you can create a Pull Request on `shader-slang/slang`. + +Once all changes are pushed to GitHub, you can create a Pull Request on the main Slang repository. |
