[Offload][Omp] Move Kernel RecordReplay calls from PluginInterface (#232349)
Move the Record Replay calls to record a kernel launch to libomptarget.
The routines themselves remain inside the PluginInterface.
This allow to remove fields from KernelLaunchArgs that were specific to
RR so we can further align to liboffload kerenl launch (still not
there).
[InlineCost] Ask TTI whether unsimplified binops and compares are free (#232397)
visitBinaryOperator and visitCmpInst charged every unsimplified
instruction without consulting TTI, unlike casts, GEPs and other instructions.
Return TCC_Free from TTI::getInstructionCost as visitCastInst does.
[libclang][test] Fix narrowing when initializing CXUnsavedFile::Length (#228405)
`CXUnsavedFile::Length` is `unsigned long`, which is 32 bits on 64-bit
Windows. The libclang unit test fixture list-initializes it from
`std::string::size()`, a narrowing conversion there and so ill-formed.
MSVC rejects it with error C2397 and clang-cl with `-Wc++11-narrowing`,
a default error.
No CMake bot sees this because clang/unittests/CMakeLists.txt skips the
libclang unit tests on Windows. The Bazel libclang_tests target builds
them there and fails to compile under `--config=msvc`. Cast explicitly,
as libclang itself already does where it narrows to `unsigned long`.
Related: https://github.com/llvm/llvm-project/issues/160729
[clang] Add regression test for GH205000 (#232754)
Fixes #205000.
The crash described in the issue was fixed by #223311. This adds the
reduced reproducer as a regression test in cxx2c-fold-exprs.cpp, which
is where similar fold-expression constraint tests live.
[CIR][OpenMP] Add initial support for distribute
This patch adds initial support for the OpenMP 'distribute' directive. Basic
code generation for the standalone and combined cases is introduced. Support
for clauses will be added in the future. The composite 'teams distribute
parallel for' form will be added in a subsequent patch.
Assisted-by: Cursor / Claude Sonnet 5 High
[CIR][OpenMP] Add support for omp teams
This patch adds support for the OpenMP 'teams' directive, both standalone
and as the combined `target teams` construct. isCombinableLeaf now also
recognizes teams, so an explicitly-nested `target` + `teams` pair gets
the same omp.combined marking as the combined case.
Assisted-by: Cursor / Claude Sonnet 5 High
[CIR][OpenMP] Add support for host_eval so that SPMD kernels can be used
This patch adds support for host_eval so that SPMD kernels and in the future
num_threads and other clauses can be implemented correctly.
Assisted-by: Cursor / Claude Sonnet 5 High
[mlir][ROCDL] Deprecate rocdl.ignore_denormal_mode (#231424)
The `rocdl.ignore_denormal_mode` discardable attribute is deprecated in
favor of the `ignore_denormal_mode` unit attribute on `llvm.atomicrmw`
(#217588), which translates to the same `!atomic.ignore.denormal.mode`
metadata. Translation of `rocdl.ignore_denormal_mode` now emits a
deprecation warning.
[flang-rt][device] Avoid pulling device malloc/free into every kernel (#232457)
The allocator registry stored pointers to MallocWrapper and FreeWrapper,
so
the device linker kept both and with them the device malloc and free.
The
first kernel launch then reserved the device malloc heap even though
nothing used it.
Do not store those pointers for the default allocator. Call malloc and
free
directly for it instead, so the linker can drop them when unused. Other
allocators still go through the registry.
Co-authored-by: Simone Atzeni <satzeni at nvidia.com>
[SPIRV] Emit DebugLexicalBlockDiscriminator for a DILexicalBlockFile.
A location scoped at a DILexicalBlockFile was emitted as a DebugScope of the compilation unit, so the discriminator did not round-trip.
Use the discriminator as the DebugScope operand, matching SPIRV-LLVM-Translator.
[SLP][NFC]Reduce compile time of seeding and reductions, NFC
Compute the poison check in isFixedVectorShuffle only for undef vectors.
Do not treat calls without vector variants as poor-throughput ops.
Skip the split store seeding if no stored scalar is a candidate.
Mark the root of a failed ordered reduction as analyzed to avoid
rebuilding the same trees.
Fixes the compile-time regression from #231130.
Assisted-by: Cursor
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/232782
[IR] Rename BasicBlock::getFirstNonPHIOrDbg* (NFC) (#232604)
This patch renames the functions in BasicBlock as follows because they
no longer check for debug intrinsics:
- getFirstNonPHIOrDbg -> getFirstNonPHIOrPseudoProbe
- getFirstNonPHIOrDbgOrLifetime -> getFirstNonPHIOrLifetime
- getFirstNonPHIOrDbgOrAlloca -> getFirstNonPHIOrAlloca
This patch also drops the SkipPseudoOp parameter from
getFirstNonPHIOrPseudoProbe and getFirstNonPHIOrLifetime because every
caller uses the default value of true.
Note that all three functions still return iterators with the head bit
unset so that insertions at the returned position are placed after any
DbgRecords attached to that instruction.
Assisted-by: Antigravity
[clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) (#232603)
PointerUnion::dyn_cast has been soft-deprecated in favor of
llvm::dyn_cast and llvm::dyn_cast_if_present. This patch replaces the
former with llvm::dyn_cast where the operand is guaranteed to be
nonnull.
Note that Origin::Ptr is always initialized to a nonnull pointer in
OriginManager::createNode and never modified afterward.
Assisted-by: Antigravity
[Hexagon] Optimize vcvt(v0.uh) and vcvt(v0.ub) to hf (#232460)
This patch shortens the sequences for V6_vcvt_hf_uh and V6_vcvt_hf_ub.
V6_vcvt_hf_uh now zero-extends to word, converts each half to sf, and
adds a bias constant to produce hf directly, instead of widening through
a zero vector and packing back down through h. V6_vcvt_hf_ub converts
its unpacked halfwords to hf directly, dropping the same
zero-extend/pack/shuffle round trip, since the unpacked halfwords are
already suitable h input.
Co-authored-by: Sumanth Gundapaneni <sgundapa at quicinc.com>
RuntimeLibcalls: Add the remaining vector libraries
Add definitions for Accelerate, Darwin_libsystem_m, LIBMVEC, MASSV and
SVML, and fill out SLEEFGNUABI, ArmPL and AMDLIBM to match VecFuncs.def.
The struct-returning ArmPL modf and sincos variants need new _STRET
libcalls.
With the new implementations available, type-split vector math calls
can now be expanded, and the vectorizer keeps pow as an intrinsic for
codegen to lower to the library call.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][NVVM][NFC] Predeclare `ModuleTranslation` to improve build times (#232727)
The NVVMDialect's LLVM IR export is currently layered such that it is
interwoven with the dialect implementation. For many ops, a
`getIntrinsicIDAndArgs` method implements the translation to LLVM IR and
requires the declaration of `mlir::LLVM::ModuleTranslation`. The header
for the latter is a rather heavy header that includes all of OpenMP
Dialect and more.
This PR makes NVVMDialect.h faster to parse by predeclaring
`mlir::LLVM::ModuleTranslation` rather than including its definition. In
a local build tested on a AMD Ryzen Threadripper PRO 5975WX this saved
aorund 2.4s of compile time per-file that includes NVVMDialect.h for a
total of 65.4s of CPU time saved.
I believe that ideally the LLVM IR translation should be moved to and
contained in NVVMToLLVMIRTranslation but is left as a future change
after these "easy" compile time changes have been applied.
RuntimeLibcalls: Generate vector library libcall sets
Replace the hand-written VectorLibrary switch with LibcallLibrary
definitions, enabled by the generated setAvailableLibraryLibcalls
function. This only covers the functions that were already handled;
future changes will fill in the cases still missing relative to
TargetLibraryInfo.
Libraries used by a SystemRuntimeLibrary are already enabled by
setTargetRuntimeLibcallSets, so only the remaining libraries can be
enabled by name. In the future I want to retire the
SystemRuntimeLibrary concept and reduce it to a list of libraries.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[CIR][OpenMP] Add initial support for distribute
This patch adds initial support for the OpenMP 'distribute' directive. Basic
code generation for the standalone and combined cases is introduced. Support
for clauses will be added in the future. The composite 'teams distribute
parallel for' form will be added in a subsequent patch.
Assisted-by: Cursor / Claude Sonnet 5 High
[libc++] Provision a suitable CMake for CI builds
The previous commit raised cmake_minimum_required to 3.31. The GitHub
jobs already satisfy it (the Linux image pins 3.31.0, macOS uses brew,
Windows uses the hosted image), but some self-hosted Buildkite agents
ship an older CMake and their images cannot be updated by us.
Teach run-buildbot to check the CMake version up front. When the cmake
on PATH is new enough, this costs a single `cmake --version` and nothing
else changes. Otherwise, download a pinned, SHA-256 verified CMake
3.31.12 release binary into ${XDG_CACHE_HOME:-~/.cache}/libcxx (outside
the build directory that run-buildbot wipes) and, when no binary exists
for the host or it cannot run there, bootstrap it from source with the
host compilers rather than the runtime's CC/CXX. The install is
published with an atomic rename so concurrent builders on one agent
never see a partial cache entry.
An explicit CMAKE override is still honored but now validated; in the
provisioned or overridden cases its directory is prepended to PATH so
[5 lines not shown]
[mlir][x86] Support rank-reducing RHS reads in AMX online packing (#232279)
Allows AMX online packing to handle rank-reducing RHS reads.
For a rank-reducing read, the sizes miss the dropped leading unit dims,
which hit an assertion when creating the subview. The packing loads also
indexed the subview with the read's leading offsets twice.
Assisted-by: Claude