Adjustments for Clang's new offload driver#1114
Closed
linehill wants to merge 1 commit intoCHIP-SPV:mainfrom
Closed
Adjustments for Clang's new offload driver#1114linehill wants to merge 1 commit intoCHIP-SPV:mainfrom
linehill wants to merge 1 commit intoCHIP-SPV:mainfrom
Conversation
Collaborator
|
fyi, we no longer use branches for LLVM instead we have a series of patches that we apply to mainline LLVM. @linehill |
Collaborator
Author
Right, but those patches are used to build chipStar's variant of LLVM - IOW, a fork of LLVM? Anyway, the upstream LLVM patch should make them obsolete too (unless one really need the device side debug info). |
This patch updates chipStar to use Clang's new offload driver for the next LLVM release version 22. The old/current driver one may be removed in Clang in the future, rendering HIPSPV toolchain inoperable. This patch depends on the following things: * An upstream LLVM patch whose review is ongoing llvm/llvm-project#168043. In the meanwhile this patch can be tried out using [my branch]( https://github.com/linehill/llvm-project/tree/hipspv-new-offload-driver). This patch also upstream changes from chipStar's LLVM fork - more details in the below. * The following [ROCm-DeviceLib](https://github.com/linehill/ROCm-Device-Libs/tree/clang-new-offload-driver) and [HIPCC](https://github.com/linehill/HIPCC/tree/clang-new-offload-driver) submodules updates. The submodules are temporarily tracking the revisions from my repositories - I'll update them once the changes have landed on the respective CHIP-SPV repositories. Upstreaming patches of chipStar's LLVM fork After the LLVM patch is merged, chipStar should no longer need to depend on chipStar's LLVM fork for the future LLVM releases. Couple commits are omitted in the upstream LLVM patch: * SPIR-V datalayout change: an alternate fix is proposed for CHIP-SPV/ROCm-Device-Lib. * Enabling debug info for the device code: SPIR-V LLVM Translator doesn't yet robustly handle debug info (KhronosGroup/SPIRV-LLVM-Translator#3247).
87e96f3 to
d283a8a
Compare
pvelesko
added a commit
that referenced
this pull request
Feb 1, 2026
LLVM 22 compatibility changes: - Replace getNextNonDebugInstruction() with getNextNode() in HipAbort.cpp (debug info moved from intrinsics to records in LLVM 22) - Update PassPlugin.h include path for LLVM 22 (llvm/Plugins/ vs llvm/Passes/) - Update SPIR-V data layout in irif .ll files to match LLVM 22 spirv64 target - Add LLVM 22 version to configure_llvm.sh New offload driver integration (from PR #1114): - Add HAVE_CLANG_NEW_OFFLOAD_DRIVER and USE_NEW_OFFLOAD_DRIVER CMake options - Add OFFLOAD_TRIPLE for spirv64v1.2-unknown-chipstar target - Update bitcode CMakeLists.txt for new triple handling - Add stub functions for __hipRegisterTexture, __hipRegisterManagedVar, __hipRegisterSurface in CHIPBindings.cc Note: Old offload driver works with LLVM 22. New offload driver has spirv-link compatibility issues (Schema is non-zero error) that need further investigation.
pvelesko
added a commit
that referenced
this pull request
Feb 2, 2026
LLVM 22 compatibility changes: - Replace getNextNonDebugInstruction() with getNextNode() in HipAbort.cpp (debug info moved from intrinsics to records in LLVM 22) - Update PassPlugin.h include path for LLVM 22 (llvm/Plugins/ vs llvm/Passes/) - Update SPIR-V data layout in irif .ll files to match LLVM 22 spirv64 target - Add LLVM 22 version to configure_llvm.sh New offload driver integration (from PR #1114): - Add HAVE_CLANG_NEW_OFFLOAD_DRIVER and USE_NEW_OFFLOAD_DRIVER CMake options - Add OFFLOAD_TRIPLE for spirv64v1.2-unknown-chipstar target - Update bitcode CMakeLists.txt for new triple handling - Add stub functions for __hipRegisterTexture, __hipRegisterManagedVar, __hipRegisterSurface in CHIPBindings.cc Note: Old offload driver works with LLVM 22. New offload driver has spirv-link compatibility issues (Schema is non-zero error) that need further investigation.
Collaborator
Collaborator
Author
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch updates chipStar to use Clang's new offload driver for the next LLVM release version 22. The old/current driver one may be removed in Clang in the future, rendering HIPSPV toolchain inoperable.
This patch depends on the following things:
An upstream LLVM patch whose review is ongoing [Clang] Lift HIPSPV onto the new offload driver llvm/llvm-project#168043. In the meanwhile this patch can be tried out using my branch. This patch also upstream changes from chipStar's LLVM fork - more details in the below.
The following ROCm-DeviceLib and HIPCC submodules updates. The submodules are temporarily tracking the revisions from my repositories - I'll update them once the changes have landed on the respective CHIP-SPV repositories.
Upstreaming patches of chipStar's LLVM fork
After the LLVM patch is merged, chipStar should no longer need to depend on chipStar's LLVM fork for the future LLVM releases. Couple commits are omitted in the upstream LLVM patch:
SPIR-V datalayout change: an alternate fix is proposed for CHIP-SPV/ROCm-Device-Lib.
Enabling debug info for the device code: SPIR-V LLVM Translator doesn't yet robustly handle debug info (SPIR-V validation failed: OpenCL.DebugInfo.100 DebugFunction: expected operand Declaration must be a result id of DebugFunctionDeclaration KhronosGroup/SPIRV-LLVM-Translator#3247).