docs: Add some best practices documentation for codegen tests (#244482)
Document common review feedback.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[dsymutil] Don't write past a DIE for a relocation that does not fit (#247778)
applyValidRelocs() asserts that a relocation fits in the DIE it
patches, then writes it regardless. A relocation map which does not
describe the DWARF of its dSYM holds relocations running past their
DIE, and one larger than 8 bytes also overflows the buffer its value
is built in.
Reject a relocation running past the range it is looked up in, with a
warning. getRelocations() does so for every lookup: such a relocation
is not applied, does not keep its DIE, and is not saved to the output
relocation map. The asserts in applyValidRelocs() now hold.
The check needs exact ranges. In both linkers,
getVariableRelocAdjustment() passed a range starting at the length of
the block, which precedes the expression. Two tests had their
relocations on that length, where only such a range found them. Move
them to the operand.
[4 lines not shown]
RuntimeLibcalls: Add attributes to ObjC runtime calls
Mark the ObjC runtime functions nounwind, and mark the argument of
the functions whose intrinsics mark their argument returned.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes to operator new and delete
Annotate operator new and delete implementation variants. The nothrow
variants are nounwind. No library registers these yet so they don't
appear in the DeclareRuntimeLibcalls tests.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
linux: reuse stored names for normalized lookups
Resolve normalization-equivalent names to the stored dentry so that
removing or renaming one spelling cannot leave another cached spelling
accessible. Keep case sensitivity unchanged and discard negative
dentries that could hide a newly created equivalent name.
Warm both spellings in the native mixed-case deletion test.
Remove the Linux expected-failure entries for the four normalization
tests which now pass.
Assisted-by: OpenAI Codex
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: ooonea <35407790+ooonea at users.noreply.github.com>
Closes #13980
Closes #19726
Revert "[Clang][Sema] Accept weak reference after declaration" (#247827)
Reverts llvm/llvm-project#228809 . There was reported breakage building
OpenZFS.
I'd prefer to take our time to get this right.
[X86] canonicalizeShuffleWithOp - generalize VZEXT_MOVL folding to any op with known zero in the upper bits (#247832)
Generalised from the VTRUNC handling that was added to #245048 - we can
use value tracking to confirm that the upper bits are already zero,
which means the VZEXT_MOVL will be free if moved through the logic op.
libzfs: FreeBSD: retry an unmount a mount update holds busy
FreeBSD's dounmount() returns EBUSY while the mount has MNT_UPDATE
set, that is while any nmount(MNT_UPDATE) on it is in progress.
mountd(8) applies export changes that way, and libzfs signals mountd
in zfs_unmount() (zfs_commit_shares() after zfs_unshare()) right
before calling unmount(2). So 'zfs unmount', 'zfs set canmount=off',
'zfs destroy' or 'zpool export' of a dataset with sharenfs=on could
fail with "pool or dataset is busy" when mountd's update of that file
system (from this or an earlier share change) overlapped the unmount.
This is the inheritance/inherit_001_pos failure on the FreeBSD CI
runners. FreeBSD 14 calls VFS_MOUNT() (a ZFS remount) for each export
update as well, which makes the window wider there.
Retry unmount(2) on EBUSY with a short backoff (10 ms doubling, about
1.3 s in all). A file system that is really busy still fails with
EBUSY, only later.
This makes zfs_unmount_remount_busy pass.
[5 lines not shown]
ZTS: zfs unmount of a file system busy for a moment
On FreeBSD, unmount(2) returns EBUSY while another thread is inside
nmount(MNT_UPDATE) on the same mount. mountd(8) does exactly that
whenever libzfs commits an NFS share change: it pushes the new export
list into the kernel with nmount(MNT_UPDATE). 'zfs unmount' of a
dataset with sharenfs=on signals mountd right before its own
unmount(2), so it races mountd's update of that very file system.
This is the "cannot unmount ...: pool or dataset is busy" failure of
'zfs set canmount=off' in inheritance/inherit_001_pos on the FreeBSD
CI runners.
zfs_unmount_remount_busy (FreeBSD only, about 3 s):
- a file system held busy by a process, released only once
'zfs unmount' has had EBUSY and waits to try again, must unmount;
without a retry this fails every time, independent of timing;
- 50 unmount/mount cycles while a background loop updates the mount
(mount -u), as mountd does, must all succeed;
- a file system that stays in use must still refuse with "busy",
[6 lines not shown]
[Tests][NFC] Use modern floating-point literals for f32 edge-case constants, and matching f64 bit patterns (#247819)
Uses the modern float32 literal versions of min-subnormal,
max-subnormal, min-normal, and max-normal. These particular values are
commonly used in edge-case testing, and it is not obvious that
`0x36A0000000000000` is `FLT_TRUE_MIN`.
To make things easier to review, commits 1/2/3/5 are the result from
running the `rg` commands below. Commit 4/6 have non-trivial fix-ups
that may need closer review.
I avoided touching any files with a date, pr-number, or issue-number.
1. Fix subnormal min
```sh
rg -il -0 'float 0x36A0000000000000\b' llvm \
| xargs -0 perl -pi -e 's/float 0x36A0000000000000\b/float f0x00000001/gi'
rg -il -0 'float 0xB6A0000000000000\b' llvm \
[60 lines not shown]
[LV] Add tests for packing predicated values (NFC). (#247829)
Add VPlan printing and replicate-region dissolving tests for predicated
values with vector, scalar and live-out users, a test with predicated
values used as vector and scalars next to ones only used as scalars, a
register usage test for predicated loads packed for a user outside the
loop, and a cost test for a predicated value only used by a blend
feeding a single-scalar cast.
[AMDGPU] Add an intrinsic and builtin to access the dispatch index
This PR adds an intrinsic (and corresponding builtin and MLIR
operation) for accessing the dispatch index on gfx12+, since it can be
needed in some low-level contexts.
AI disclosure: None, I did this by hand
[AMDGPU] Refactor wave ID intrinsic handling and expose a Clang builtin
This PR refactors how the architecture-provided wave ID on gfx12 is
exposed, including by generalizing its lowering in preparation for
adding a dispatch.index intrinsic.
This PR also annotates the wave-id intrinsic with `TargetFeatures`,
meaning that it no longer is a selection failure to use it on a target
without the architected SGPRs feature, but a failure earlier in the
pipeline.
In addition, this PR exposes this id as __builtin_amdgcn_wave_id() in
Clang, matching MLIR, and adds documentation that clarifies the
properties of the ID.
AI disclosure: None, I did this by hand
Don't lose available space while block clones sync
A cloned block is charged in full to its dataset when it is born in
syncing context, and the BRT gives the same amount back as saved
space. brt_pending_apply() adds the saved space at the start of
spa_sync(), but spa_dspace, which the open context space checks use,
is only recomputed at the end of spa_sync(). So from the first birth
to the end of the sync the pool is short by the whole size of the
data cloned in that txg: "available" can drop to 0, and creating,
writing or cloning a file fails with ENOSPC on a pool that has plenty
of space. zpool_prefetch_002_pos hits this in CI when its clones of
a 100 MiB file on a 3 GiB pool split across txgs in the wrong place.
Count the saved space of the txg's new BRT references in
spa_brt_unborn, leave it out of brt_get_dspace(), and move each
block's share of it into spa_dspace as dbuf_write_done() sees the
block born, at the same time dsl_dataset_block_born() charges it.
What is left at the end of the sync belongs to clones that were freed
before they were born, so it is dropped before spa_update_dspace().
[10 lines not shown]
ZTS: available space while block clones sync
Cloned blocks are charged to their dataset when they are born in
syncing context, but the saved space the BRT gives back only reaches
the pool's dspace at the end of spa_sync(). Until then the pool looks
short by the whole size of the cloned data. zpool_prefetch_002_pos
hit this in CI: its 50 clones of a 100 MiB file on a 3 GiB pool failed
with "open: .../clone.48: No space left on device".
block_cloning_avail_during_sync clones a 128 MiB file 16 times on a
1 GiB pool, holds the sync of the clones open with a zinject write
delay, and checks that the available space doesn't drop and a file
can be created while it runs. Then it checks the space, the saved
space and the clones once the sync is done.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Will Rouesnel <wrouesnel at wrouesnel.com>
Closes #19812
[mlir][ROCDL] Partition the ROCDL dialect ops (#247754)
Now that we have the ability to partition large dialects into smaller
pieces (as of #239254), partition the ROCDL dialect into thirteen
logical partitions. In addition, make declaring the dialect's attributes
a separate header, so that the AMDGPU dialect (which only depends on
those attributes) can only include the attributes.
These partitions mainly follow the sections of the LLVM intrinsic
declarations and AMDGPU ISA manuals.
Migrating passes to use only the partitions they need will be a followup
PR.
AI disclosure: Claude was used to do the partitioning, I reviewed and
chose the partitions, wrote this commit message, and adjusted the
wording.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>