AMDGPU: Check address alignment when merging TBUFFER accesses (#239852)
SILoadStoreOptimizer only checked the alignment of the immediate
offset when merging TBUFFER accesses, ignoring the rest of the
address. This could undo splitting done for alignment and cause
hangs. This is a theoretically stronger fix to piglit failures with
mesa which were previously hidden by conditioning this transform on
relaxed OOB mode.
Check the alignment of the whole address from the memory operand, and
assume each access is already aligned to its component size. Since the
buffer intrinsics don't provide any alignment information, accesses
with 8-bit or 16-bit components can no longer be merged from IR.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[flang][OpenACC] Emit NYI for unsupported scalar CHARACTER mappings. (#240551)
Automatic and assumed-length scalar CHARACTER variables, as well as
fixed-length host-associated scalars, can reach data-clause lowering as
fir.boxchar. This type is not currently mappable, causing an assertion
failure.
Emit an NYI diagnostic instead until the support for mapping `boxchar`
is implemented.
Assisted-by: Codex
RuntimeLibcalls: Add helper methods to insert declarations
Add methods to get or insert the declaration of a libcall
implementation in a module with the appropriate type and
annotations. A (potentially incorrectly declared) global that already
has the name is returned unmodified
Use them in DeclareRuntimeLibcalls, which no longer merges attributes
into or replaces the calling convention of existing functions, and no
longer crashes on a global variable with the name of a libcall
function.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
SafeStack: Take libcall declarations from RuntimeLibcallsInfo
Stop declaring __stack_chk_fail and __safestack_pointer_address
manually and construct them with the correct type automatically.
A function with the variable's name is now reported as not being a
global variable, rather than a renamed copy of the variable being
inserted. -safestack-use-pointer-address now requires
__safestack_pointer_address to be available for the target, instead of
unconditionally emitting a call to it. The tests using it on
non-Android triples move to Android.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Reland "[lldb] Honor the arm64 subtype when launching on Darwin" (#240579)
LaunchProcessPosixSpawn treated a CPU subtype of 0 as unset and fell
back to posix_spawnattr_setbinpref_np, which only takes a CPU type.
CPU_SUBTYPE_ARM64_ALL is 0, so launching the arm64 slice of a universal
arm64/arm64e binary ran the arm64e slice while LLDB reported arm64.
debugserver had the same check.
The original change (3e7841ef1d6f) was reverted in b5e55c9ca78f because
posix_spawnattr_setarchpref_np requires an exact subtype match.
Host::RunShellCommand launches helper tools with the host architecture,
which LLDB reports as arm64 on arm64e hardware. System binaries like
xcrun only ship arm64e and x86_64 slices, so launching them failed with
"Bad CPU type in executable".
The reland adds CPU_SUBTYPE_ANY as a second preference. The kernel still
picks the exact slice when present and otherwise falls back to any slice
of the CPU type. debugserver maps arm64_32 to CPU_SUBTYPE_ARM64_32_V8 so
the exact match succeeds.
[2 lines not shown]
[Bazel] Add BuiltinsHexagonDepTdFiles to basic_builtins_hexagon_gen (#240644)
Commit 848e36a316e8 refactored BuiltinsHexagon.td to include
BuiltinsHexagonDep.td. Add BuiltinsHexagonDepTdFiles td_library and
include it in basic_builtins_hexagon_gen deps.
[libc][math] Optimize pow 128-bit and 256-bit accurate passes and share exp2_df128. (#237026)
- Refactor 128-bit and 256-bit accurate passes to use multi-tier
fixed-point arithmetic (Frac64, Frac128, Frac256) and share
double_eval::exp2_df128 with exp/exp2/exp10.
- Simplify is_exact_rounding_boundary to operate on normalized (x_e,
x_mant), unify power loops, and replace 64-bit hardware divisions with a
leading-zero bit-width bound.
- Avoid general multi-limb normalization and conversion overhead in
pow_accurate and pow_accurate_256.
Assisted by: Gemini for analysis and refactoring
[AMDGPU] Price misaligned flat and LDS accesses with the LDS misaligned bug
In WGP mode on subtargets with the LDS misaligned bug, a flat access is
split into pieces no wider than its alignment and no narrower than 4
bytes, and an LDS access aligned below 4 bytes uses 8-byte pieces as one
aligned to 4 does.
[AMDGPU] Price buffer fat pointer memory operations
Price buffer fat pointer accesses as global accesses, except that an
aligned load is not widened and a vector of odd width elements is not
split element by element. Without relaxed buffer bounds checking, a
vector of elements that are a multiple of 32 bits wide is accessed in
pieces no wider than its alignment and no narrower than 4 bytes, and a
vector of other byte-sized or power of 2 wide elements in pieces of the
largest power of 2 bytes that divides the element size. The width comes
from buffer fat pointer lowering, which now exposes it. When the pointer
is a buffer resource plus a constant offset, the offset and a constant
number of records give the same bounds facts lowering uses to access it
in wider pieces.
[NFC][AMDGPU] Add tests for int to fp casts of a narrow i64 source (#240137)
Scalar and vector i64 sources with at most 32 significant bits from a
shift or a mask, converted to f16, bf16, f32 and f64.
Assisted-by: Claude Code Opus 5
Merge tag 'linux_kselftest-fixes-7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest fixes from Shuah Khan:
"Fixes run_fat_tests hang, false bashism in kprobe_non_uniq_symbol.tc,
and ftrace invalid test skip"
* tag 'linux_kselftest-fixes-7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
selftests/ftrace: Add missing spaces after ! in probe syntax tests
tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc
selftests/filesystems: Fix run_fat_tests hang
[DWARFLinker] Share hashFullyQualifiedName between the linkers (#240621)
The classic linker hangs computing the Apple accelerator table hash of
a type whose DW_AT_specification or DW_AT_abstract_origin chain forms a
cycle or holds a reference it cannot resolve. Its loop has no bound,
and on an unresolved reference it retries the same DIE forever.
The parallel linker's copy bounds the walk with finiteLoop. Move it to
Utils and use it from both linkers, each with its own reference
resolver. The test links a type whose DW_AT_specification refers to
itself, which hangs the classic linker without this change.
The parallel linker now also ends the name at any unit DIE, not only a
DW_TAG_compile_unit, as the classic linker already did. The classic
linker still ends it at a DW_TAG_module scope. Hashes are otherwise
unchanged.
Assisted-by: Claude
pthread_cond_timedwait.3: list pthread_cond_clockwait as .Nm
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D61253