LLVM and SPIRV-LLVM-Translator pulldown (WW12 2026)#21560
Draft
LLVM and SPIRV-LLVM-Translator pulldown (WW12 2026)#21560
Conversation
Summary: This implementation only worked if the lane mask passed in was uniform, but this is against the expected usage where the user may be wishing to check if a value is uniform *within* a mask subset. Also remove redundant sync_lanes, the ballots and shuffles already have synchronizing behavior.
… HLSL casts in the new constant interpreter for basic matrix constexpr evaluation in HLSL (#184840) Forgot to change the target branch before merging. This PR is a cherry-pick of the squashed-and-merged PR commit b16aa4b7ec665911c74300cd7442659b70973d13 from 183424 This PR fixes #182963 This PR is an extension of #178762 which has already been merged. This PR adds support for `ConstantMatrixType` and the HLSL casts `CK_HLSLArrayRValue`, `CK_HLSLMatrixTruncation`, `CK_HLSLAggregateSplatCast`, and `CK_HLSLElementwiseCast` to the bytecode constexpr evaluator. The implementations of CK_HLSLAggregateSplatCast and CK_HLSLElementwiseCast are incomplete, as they still need to support struct and array types to enable use of the experimental new constant interpreter on other existing HLSL constexpr tests. The completion of the implementations of these casts will be tracked in a separate issue (#183426) and implemented in a separate PR. Assisted-by: claude-opus-4.6
* This will allow us to setup clang-stage1-RA jobs as multi branch pipelines for release branches without setting up all the downstream jobs. I will need to cherry-pick the jenkinsfile to the release/22.x branch which I will do after this lands
Moving getResidentPages out of linux.cpp and adding it to MemMapBase
…_TYPE` (#184793) The `ASSIGN_TYPE` instruction should not be referenced anymore at this point. So we can free its memory. Follow up of llvm/llvm-project#182330
…#184843) Reverts llvm/llvm-project#183794 It broke a couple of tests from Fujitsu testsuite.
returning anything from the callback. Fixing this on the off chance that is what is causing the linux-only failure in this test after PR: llvm/llvm-project#184272
…classes (#182706) Inherited constructors in `dllexport` classes are now exported for ABI-compatible cases, matching MSVC behavior. Constructors with variadic arguments or callee-cleanup parameters are not yet supported and produce a warning. This aims to partially resolve llvm/llvm-project#162640. Assisted by : Cursor // Claude Opus 4.6
Add additional tests with multiple argmin/argmax reductions for llvm/llvm-project#184729.
…ment. (#184839) We don't have instructions for an i8 sshlat.
This just adds this as an NYI, but this will suppress the Wswitch warning.
…#184714) Replace "compile" with "assemble" in formatter_bytecode. This is in preparation for the addition of a Python to formatter bytecode compiler. It will be more clear to have one meaning for "compile".
…yFixIrreducibleControlFlow" (#181755) (#184441) Re-application of #181755. Includes fixes to issues found after the original's merge.
…84853) It is a convention to use uppercase names of directives and clauses in diagnostic messages, but getting such names is somewhat cumbersome: ``` parser::ToUpperCaseLetters(llvm::omp::getOpenMPDirectiveName(dirId)); parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(clauseId)); ``` Implement `GetUpperName` (overloaded for clauses and directives) to shorten it to ``` GetUpperName(dirId, version); GetUpperName(clauseId, version); ``` This patch replaces existing instances of this pattern, adding the use of OpenMP version where it was previously missing.
This is a speculative fix for the openmp-offload-sles-build-only build
bot that fails after #184376 with:
```
clang/lib/Tooling/DependencyScanningTool.cpp:336:12: error: could not convert ‘CIWithContext’ from ‘clang::tooling::CompilerInstanceWithContext’ to ‘std::optional<clang::tooling::CompilerInstanceWithContext>’
return CIWithContext;
^~~~~~~~~~~~~
```
…#179568) Fixes #168944 Depends on #178762 being merged first. The commit adds implicit conversion warnings for HLSL matrix types in Clang's semantic checker by extending SemaChecking.cpp to detect precision loss when converting between matrix types (specifically, ConstantMatrixType). A new test validates float precision warnings, and an existing test was updated to expect the new diagnostics. Assisted-by: claude-opus-4.5
to see the private state to do so until we are done hijacking.
Avoid error like: ``` error: runtime derived type info descriptor was not generated ```
Some compilers (e.g. on AIX) do not pack by default. Use LLVM_PACKED to ensure the VPIRFlags struct is packed as expected on all platforms. This matches what we already do in other places for AIX, e.g. in llvm/include/llvm/CodeGen/SelectionDAGNodes.h (added in 844a02e), although it uses the more general LLVM_PACKED unconditionally PR: llvm/llvm-project#184687
Implicitly discovered module maps that reference files outside their module directory cause order dependent behavior when using implicitly discovered module maps. This adds an off by default diagnostic about these cases with the long term goal of removing import order dependent behavior. Module maps found via `-fmodule-map-file=` are not a problem because they are all loaded at the start of translation. Assisted-by: claude-opus-4.6
CONFLICT (content): Merge conflict in clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
…tate" mode. (#184272)" This reverts commit 97572c1. This patch seems to cause TestWatchpointCommandPython.py to time out on the ubuntu buildbots (but nowhere else that I can find so far.) The timeout is weird too, the TEST FILE is timing out but the individual tests aren't being shown and there's no other output. Grrr... Anyway I'll revert this and then see if I can do some guessing about how this change might cause the test to fail.
…ent (#184868) Assume a sufficently new code object version if the environment is set to something indicating we should have a real library.
…184836) We only support splat shift amounts. Previously we checked if the shift amount was a splat_vector and considered it legal. I don't think there is a guarantee that the splat_vector will stick around as a splat_vector. It's safer if we capture the splat and create a dedicated node with a scalar shift amount.
…ies (#134805)" (#174483) This reverts commit ccfb97b. This was reverted due to the unfortunate reliance on external device library installations, which ship the last rocm released bitcode. The last attempt was 8 months ago, so hopefully the buildbots are now caught up to a more recent build that no longer needs the old control library.
9bec7a5 revert the changes and removed the tests. We did not remove the tests so it is failing.
Fix annotations-field.c tests that broke after commit b3d99ac which changed Clang's CGBuilder to use DataLayout-aware TargetFolder instead of ConstantFolder. The commit causes GEP constant expressions to be emitted in canonical getelementptr i8 form instead of typed form, and affects when the nuw qualifier is emitted. Updated CHECK lines to reflect the new IR: - Changed from typed GEPs like `getelementptr (%struct.foo, ...)` to canonical i8 form `getelementptr (i8, ptr, i64 offset)` Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix extra warnings/errors like:
```
nblog2.log: 13595: In file included from /netbatch/build_comp63266_00/ics_top/llvm/llvm/include/llvm/IR/Metadata.h:35:
nblog2.log: 13596: /netbatch/build_comp63266_00/ics_top/llvm/llvm/include/llvm/ADT/ArrayRef.h:79:35: error: implicit conversion changes signedness: 'long' to 'size_type' (aka 'unsigned long') [-Werror,-Wsign-conversion]
nblog2.log: 13597: 79 | : Data(begin), Length(end - begin) {
nblog2.log: 13598: | ~~~~~^~~~~~~
nblog2.log: ...
nblog2.log: 13843: make[2]: *** [tools/sycl-jit/passes/CMakeFiles/SYCLJITPasses.dir/build.make:78: tools/sycl-jit/passes/CMakeFiles/SYCLJITPasses.dir/SYCLJITPasses.cpp.o] Error 1
```
043272e to
20925eb
Compare
…171b8d) After the NVPTX refactoring in a171b8d and 21d93c2, createNVVMInternalAddrspaceWrap unconditionally adds ReadOnly attribute to byval parameters. This causes a verifier error for kernel parameters with local_accessor (writable shared memory), which are already marked writeonly by the frontend. The fix checks for existing WriteOnly attribute before adding ReadOnly, preventing the attribute conflict while preserving the readonly optimization for truly read-only parameters. Fixes compilation of structs_with_special_types_as_kernel_paramters.cpp test which failed with: Attributes 'readonly and writeonly' are incompatible! Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
After the NVPTX refactoring in a171b8d, NVPTXLowerArgs unconditionally adds grid_constant attribute to all byval parameters via createNVVMInternalAddrspaceWrap. This causes issues with writeonly parameters (marked by SPIRV backend with initializes attribute) that need to be written to for initialization. The grid_constant attribute requires parameters to be read-only inputs in PTX .param space, but writeonly parameters are outputs that must be written to. This causes ptxas errors: "Illegal to write to function input parameter". The fix ensures writeonly byval parameters: 1. Are forced to use copyByValParam (local memory copy) early in lowerKernelByValParam 2. Skip getting grid_constant/ReadOnly attributes in createNVVMInternalAddrspaceWrap This allows writeonly parameters to be properly handled as outputs in local memory where they can be written to, fixing compilation with -fsycl-use-spirv-backend-for-spirv-gen. Fixes: structs_with_special_types_as_kernel_paramters.cpp test Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…sions Fixes regression introduced by commit e56b580 "Reapply '[SPIRV] Emit intrinsics for globals only in function that references them'". Root cause: - When globals are used in constant expressions (e.g., ptrtoint in another global's initializer), those expressions become OpSpecConstantOp during SPIRV lowering - OpSpecConstantOp instructions need the global definitions to be available - The original optimization only emitted globals in functions that directly reference them, missing the OpSpecConstantOp case Minimal fix: 1. Fixed iterator initialization bug in collectGlobalUsers (line 76) - Changed: SmallVector<const Value *> Stack = {begin, end}; (WRONG) - To: SmallVector<const Value *> Stack(begin, end); (CORRECT) 2. Track which globals are used by other globals (constant expressions) - Added isUsedByGlobalsWithNoFunctionUsers() method - Emit such globals in the first function (where module-level OpSpecConstantOp is processed) - Regular globals used by function-referenced globals: emit in those functions This preserves the optimization for regular globals (only emit where used) while fixing the regression for: - Metadata globals (e.g., @__TsanDeviceGlobalMetadata with ptrtoint) - Globals in function-referenced constant expressions (e.g., @p_var with GEP) Test cases: - sycl/test-e2e/ThreadSanitizer/check_device_global.cpp - test/CodeGen/SPIRV/const-nested-vecs.ll Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
76a4166 to
7f4b166
Compare
Contributor
|
[SPIRV] Fix regression from e56b580 - minimal fix for constant expres… [SPIRV] Fix regression from e4c30c1 - skip expanding __spirv_ocl_printf @sarnex Please help to review and follow up with better fix. Thanks! |
Commit e4c30c1 added ExpandVariadics pass which packs variadic function arguments into struct buffers. This broke __spirv_ocl_printf in SPIRV backend because the backend was passing struct pointers to OpExtInst printf, but printf expects individual scalar value operands. Fix by skipping __spirv_ocl_printf functions in ExpandVariadics pass, allowing them to remain truly variadic and work with the SPIRV backend's native printf handling. This is a targeted revert that only affects SPIRV printf functions while keeping ExpandVariadics enabled for other variadic functions. Also add defensive bounds checking in SPIRVModuleAnalysis to prevent crashes when OpExtInst instructions have fewer operands than expected. Fixes: - Printf/char.cpp - Printf/float.cpp - Printf/double.cpp - DeviceLib/built-ins/printf.cpp - ThreadSanitizer/check_access16.cpp (no longer crashes) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
d8201f6 to
9165e9c
Compare
Contributor
|
Will take look soon but not totally trivial changes |
Contributor
Thanks! I will XFAIL the new SPIRV/printf test first too to unblock pulldown, you can take your time to address them later. |
Contributor
|
Thanks |
a74645e to
8f94af9
Compare
8f94af9 to
14c1992
Compare
14c1992 to
0b9b76e
Compare
Contributor
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.
LLVM: llvm/llvm-project@337fed3
SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@13f1c79e6272d49