Skip to content

LLVM and SPIRV-LLVM-Translator pulldown (WW12 2026)#21560

Draft
iclsrc wants to merge 3135 commits intosyclfrom
llvmspirv_pulldown
Draft

LLVM and SPIRV-LLVM-Translator pulldown (WW12 2026)#21560
iclsrc wants to merge 3135 commits intosyclfrom
llvmspirv_pulldown

Conversation

@iclsrc
Copy link
Collaborator

@iclsrc iclsrc commented Mar 19, 2026

AmrDeveloper and others added 30 commits March 5, 2026 19:12
Implement the OpenMPRequiredSimdAlign kind of UnaryExprOrTypeTraitExpr
The by-module-name scanning APIs are fairly spread out. There's the main
`CompilerInstanceWithContext` class that provides a constructor,
`initialize()` and `computeDependencies()`. Then there's the
`DependencyScanningWorker` that optionally owns
`CompilerInstanceWithContext` and re-exposes two `initialize()` and one
`computeDependencies()` functions. Lastly, there's
`DependencyScanningTool` that again re-exposes two variants of
`initialize()` and one `computeDependencies()`.

The current setup makes it unnecessarily difficult to make changes to
these APIs (as observed in
swiftlang/llvm-project#12453).

This PR makes `CompilerInstanceWithContext` standalone, and hides the
construct + initialize pattern behind a static factory function. This
makes it harder to misuse the API (forgetting to call `initialize()`,
calling it twice, etc.) and means changes now need to only touch single
class instead of three classes spread over multiple files.
Summary:
This was previously a Trieber stack, which is a perfectly fine generic
and lock-free data structure. However, this used some expensive CAS
operations and had issues with ABA. Because the only user of this was
the slab cache mechanism, we can pretty safely specialize it. Instead,
we simply search a fixed size buffer for some sentinal values and CAS
into it.

For allocations that only ever hit the cache, this improves performance
from ~9000 cycles to ~6000 cycles and similar improvements for workloads
that feel the pain of small thread counts hitting the cache.
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
…owed"

This reverts commit a8af467.

This was a follow-on to 97572c1 which was me
trying to guess why the ubuntu bots were failing with an entirely unhelpful
failure mode.  I'll have to figure out how I can reproduce this somewhere so
I can look at it for real.
This reverts commit 894408d.

These tests were added by 97572c1
and I am reverting that as well.
…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.
vmaksimo and others added 7 commits March 18, 2026 20:23
Update tests for llvm-project commit llvm/llvm-project@63074da25d16:
`("[DebugInfo][DwarfDebug] Move emission of globals from beginModule()
to endModule() (5/7) (#184219)", 2026-03-04)`.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@9981b92e6cc099b
To avoid name clash between builtins with `half` and `bfloat` return types, introduce return type postfix for
`bfloat nan` builtin in reverse translation to SPIR-V Friendly IR.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@3ce38f4ecb3da94
…3656)

The llc command already works with the `SPV_INTEL_variable_length_array`
extension enabled

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@f66eceee367a2a2
Newer SPIRV-Tools spirv-dis versions print the textual instruction name
instead of the instruction number. Make the FileCheck check lines accept
both for compatibility.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@12645e343582ce6
A recent version of spirv-val is now reporting "OpConstantComposite must
not have spec constant operands" for some tests.

Fix by letting `addCompositeConstant` defer to
`addSpecConstantComposite` when attempting to add a constant that has
one or more specialization constant operands.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@13f1c79e6272d49
@iclsrc iclsrc added the disable-lint Skip linter check step and proceed with build jobs label Mar 19, 2026
jsji and others added 17 commits March 20, 2026 19:41
2330267 enabled UseNewOffloadingDriver for HIP.
We need to update the customization to switch HIP to NewOffloadingDriver
as well.
We can NOT enable all targets using `C.getActiveOffloadKinds() !=
Action::OFK_None` yet.

Fixes:

  Clang :: Driver/hip-code-object-version.hip
  Clang :: Driver/hip-options.hip
  Clang :: Driver/hip-sanitize-options.hip
  Clang :: Driver/hip-save-temps.hip
  Clang :: Driver/hip-thinlto.hip
  Clang :: Driver/hip-toolchain-opt.hip
Community has removed the option (-bugpoint-enable-legacy-pm) to run
legacy pm with opt recently.
llvm/llvm-project#182320

This is causing 1000+ intel specific test failures because we still have
RUN lines that test legacy pm with opt.

In most cases, we have two RUN lines, one for legacy PM the other for
new PM.
Since we already switched to new PM for quite a while,
I think it is time for us to remove the legacy PM RUN lines now
This change aligns with the upstream removal of
-bugpoint-enable-legacy-pm
(llvm/llvm-project#182320) .
Commit e2f7f83 added logic to detect address space mismatches
and insert additional addrspacecast instructions to avoid invalid
pointer casts. This updates the SYCL test expectations to match
the new IR patterns with the extra addrspacecast operations.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix CodeGenCUDA/flush-denormals.cu and CodeGenSYCL/flush-denormals.cpp
tests that broke after commit 5a88dff which removed the wchar_size
module flag for standard targets.

The commit changed module.flags to no longer include wchar_size for
standard targets, reducing the number of module flags. Updated the
test CHECK lines to match the new module.flags pattern with fewer
elements.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

CMPLRLLVM-73948

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
…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

```
@jsji jsji force-pushed the llvmspirv_pulldown branch from 043272e to 20925eb Compare March 21, 2026 02:44
sys-ce-bb and others added 3 commits March 20, 2026 20:48
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disable-lint Skip linter check step and proceed with build jobs

Projects

None yet

Development

Successfully merging this pull request may close these issues.