[libc++] Rewrite the std::filesystem benchmarks (#240899)
This makes the benchmarks easier to understand and more representative
by making the size of the individual directory names and the number of
directories two separate arguments to the benchmarks.
[CIR] Lower constant vectors with undef, poison and zero elements
The `cir::ConstVectorAttr` verifier only checks the element types, so
`#cir.undef`, `#cir.poison` and `#cir.zero` are valid elements, and
`VecShuffleOp::fold` created an undef element for a -1 index. The
lowering to the LLVM dialect handled int, float and bool elements and
hit an `llvm_unreachable` on anything else, so a
`__builtin_shufflevector` of two constant vectors with a -1 index
crashed `-fclangir -emit-llvm`.
A zero element is now a zero in the dense constant. An undef or poison
element also takes a zero there and is then replaced by an
`llvm.insertelement` of `llvm.mlir.undef` or `llvm.mlir.poison`.
`llvm.mlir.constant` cannot hold such an element itself: a dense
elements attribute holds only literals, and the translation to LLVM IR
accepts a per-element `LLVM::UndefAttr` or `LLVM::ZeroAttr` only in
struct and array constants and no `LLVM::PoisonAttr` at all. The
IRBuilder folds the insertions when the module is translated, in
function bodies and in global initializers, so the LLVM IR holds one
[10 lines not shown]
[LinkerWrapper] Resolve -l the way ld64 does on a MachO host (#216940)
On a MachO host the linker wrapper looked for `-lfoo` only as
`libfoo.so` or `libfoo.a` in the `-L` paths, so a library that exists as
a `.tbd` stub or a `.dylib`, or that lives in the SDK passed with
`-syslibroot` (such as `-lSystem`), failed with `unable to find
library`. This searches for the names ld64 searches for, in its order,
and also searches `/usr/lib` and `/usr/local/lib` under each
`-syslibroot`.
This PR was generated using AI
---------
Co-authored-by: Joseph Huber <huberjn at outlook.com>
[AMDGPU] Do not overlap dst with srcs for more v_cvt_scale* instructions (#246327)
The hardware requires that the destination VGPRs of the V_CVT_SCALE_*
family of instructions do not overlap any of their source VGPRs. Add the
missing "@earlyclobber $vdst" constraint to:
v_cvt_scale_pk8_{bf16,f16,f32}_fp4
v_cvt_scalef32_pk32_{bf6,fp6}_f32
With this, all v_cvt_scale* instructions for GFX12.5 and GFX13 have the
constraint.
Co-Authored-By: Claude Fable 5.2 <noreply at anthropic.com>
[LoongArch] Use INSERT_SUBREG for PseudoXVINSGR2VR into an undefined vector. NFC (#242332)
When inserting an element into the low half of an undefined LASX vector,
the insert is done on the low 128 bits and the result was widened with
SUBREG_TO_REG. That means that the instruction defining the low 128 bits
also defined the upper 128 bits, which is not the case. Insert the
result
into the undefined source vector with INSERT_SUBREG instead, which keeps
its upper 128 bits undefined.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[LoongArch] Use INSERT_SUBREG of IMPLICIT_DEF to widen LSX vectors to LASX. NFC (#242331)
Several patterns widen a 128-bit LSX vector to a 256-bit LASX vector
with SUBREG_TO_REG, for instructions that only use the low 128 bits:
vext2xv.*, and xvpermi.d followed by an instruction that only uses the
low half of each 128-bit lane. SUBREG_TO_REG means that the instruction
defining the LSX vector also defined the upper 128 bits, which is not
the case and is not needed. Add an lsx_to_lasx helper that uses
INSERT_SUBREG into an IMPLICIT_DEF instead, as other patterns already do
for this kind of widening.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[2 lines not shown]
[LoongArch] Use INSERT_SUBREG of IMPLICIT_DEF to put an FP scalar in a LASX vector (#242330)
The patterns for vector_insert, scalar_to_vector and splat of an FP
scalar into a LASX vector used SUBREG_TO_REG to view the FPR as a vector
register. SUBREG_TO_REG means that the instruction defining the FPR also
defined the rest of the vector register, which is not the case. Only
element 0 is used, and scalar_to_vector leaves the other elements
undefined, which is what INSERT_SUBREG into an IMPLICIT_DEF expresses.
This changes the scheduling and register allocation in one test, but not
the number of instructions.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[3 lines not shown]
[LoongArch] Use INSERT_SUBREG of IMPLICIT_DEF for scalar FP rounding via LSX. NFC (#242329)
fceil, ffloor, ftrunc and froundeven of an FP scalar are selected to a
splat of element 0 of the FPR viewed as an LSX vector, a vector rounding
instruction, and an extract of element 0. Only element 0 is used, so use
INSERT_SUBREG into an IMPLICIT_DEF instead of SUBREG_TO_REG, which means
that the instruction defining the FPR also defined the rest of the
vector register.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
---------
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[LoongArch] Use INSERT_SUBREG of IMPLICIT_DEF to put an FP scalar in an LSX vector (#242328)
The patterns for vector_insert, scalar_to_vector and splat of an FP
scalar into an LSX vector used SUBREG_TO_REG to view the FPR as a vector
register. SUBREG_TO_REG means that the instruction defining the FPR also
defined the rest of the vector register, which is not the case. Only
element 0 is used, and scalar_to_vector leaves the other elements
undefined, which is what INSERT_SUBREG into an IMPLICIT_DEF expresses.
This changes the scheduling and register allocation in some tests, but
not the number of instructions.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[3 lines not shown]
hwpmc_amd: Allow only system counting on L3, DF and UMC counters
These counters are shared by several CPUs, a CCX in the case of L3. A
process-mode PMC is loaded on every CPU that runs a target thread, so
two CPUs can program the same counter. Without PerfMonV2, an INVARIANTS
kernel then panics with "Starting active PMC"; otherwise the counts are
wrong. No privilege is needed: on Zen 1-3, "pmcstat -P LLC_MISSES" is
enough. System sampling is accepted too, but no interrupt handler
checks these counters.
Refuse every mode but PMC_MODE_SC, as the RAPL, PERF and TSC classes do.
Two system-mode PMCs on CPUs that share a counter can still conflict;
that is left to userland, as before.
PR: 296001
Reported by: asomers
Reviewed by: mhorne
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision: https://reviews.freebsd.org/D61949
[llvm-ar] fix contradictory comment in tests (#199113)
Original comment was probably copied from
[windows-name-case.test](llvm/test/tools/llvm-ar/windows-name-case.test)
clnt_rdma.c: Fix client recovery from connect loss
After a local send or receive error, clnt_rdma_call() marks the
connection disconnected, but other RPCs can remain asleep on it.
The attached patch wakes those callers so they can reconnect.
I tested this by forcing a send failure while other RPCs were pending.
Without this patch the client simple stalls.
Reviewed by: rmacklem
Sponsored by: VersatusHPC
MFC after: 1 month
llama.cpp: update to 1.1.0.
llama.cpp v1.1.0 adds the Inkling 2 family (base, Mini and DSpark),
Domyn Edge 4B, Zaya1 8B, RAON-1-mini and Hy4 flash, splits DFlash
speculative decoding into separate draft methods, and deprecates
the old llama_batch API in favour of llama_batch_ext. It brings a
large set of TTS and audio models (Kokoro, Zonos3-Mini, tiny-voca,
VoxCPM2, MiniMax-Music3, YuE2, Fish S2, Higgs v3/VibeVoice-ASR and
Kyutai Hibiki), token-aware chat parsing, named tool choice,
automatic per-tensor quantization targeting a bpw or size budget,
a slot-scheduling refactor in llama-server, a redesigned Llama Chat
web UI with voice messages and agent traces, and updates ggml to
v1.1.1.
dma: Reorganize (ordering only change)
This package has had a lot of work and there are things in
non-canonical order (even though we don't really have rules). This
commit reorders lines (and adjusts indentation on one) so that it's
TOOLS
directory, username defs, and OWN_DIRS stuff
build defines (env, make flags, cflags, libs)
setup/subst of content from files/
installation
cryptodev: zero key material before freeing it
The /dev/crypto cipher and MAC keys are copied from userland and
released with free(), leaving the key bytes in freed kernel memory.
Use zfree() so the key material is cleared on session teardown and on
the setup error path.
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61324
(cherry picked from commit edaa6ba7be8666d4f543317845899e1a1b684bbf)
gptzfsboot: Use snprintf() to format file names
The stack buffer in fs_list() can be overflowed if a file name is too
long.
Reported by: Yudi Yang <yudi.yang at rice.edu>
MFC after: 1 week
(cherry picked from commit 956a05c3cbf5f5cb9d1c4d58e3a5fc22db1446b8)
gve: Fix AdminQ buffer DMA sync directions
In gve_verify_driver_compatibility(), the driver populates the
gve_driver_info buffer for the device to read. Sync this buffer with
BUS_DMASYNC_PREWRITE instead of BUS_DMASYNC_PREREAD before issuing
the command.
In gve_adminq_describe_device(), the device populates the
gve_device_descriptor buffer for the driver to read. Sync this buffer
with BUS_DMASYNC_PREREAD instead of BUS_DMASYNC_PREWRITE before
issuing the command.
In gve_adminq_get_ptype_map_dqo(), the device populates the
gve_ptype_map buffer for the driver to read. Add the missing
BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTREAD syncs around the
command.
In normal GCP environments this did not cause a functional failure
because the underlying platforms are DMA cache-coherent and
[14 lines not shown]
pmap: Fix some bugs around accounting of wired mappings
The amd64 and arm64 pmaps failed to decrement the count when tearing
down a 1GB largepage mapping. The riscv pmap failed to decrement the
count when unwiring a superpage mapping.
Reported by: alc
Reviewed by: bnovkov, alc, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61414
(cherry picked from commit da507ac5503d9af35f5aff4a7a773f6a92746e4a)
procctl: Zero the output structure for the compat32 syscall
Otherwise the freebsd32 implementation of PROC_REAP_STATUS leaks
uninitialized kernel stack memory.
Reviewed by: kib
Reported by: Dennys Kaluzny Pereira <dennyskaluzny at gmail.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61510
(cherry picked from commit 5a834ad15f1f09d43a6840c74da194db6f890aa2)
vmm: Emulate the byte forms of OR and AND with an immediate
Opcode 0x80 (group 1: r/m8, imm8) is in the decode table and
emulate_cmp() handles 80 /7, but emulate_or() and emulate_and() only
accept 0x81 and 0x83. An "or byte ptr [mem], imm8" or "and byte ptr
[mem], imm8" on emulated memory therefore fails with EINVAL and bhyve
stops the guest with "Failed to emulate instruction sequence
[ 80 ... ]". Seen with macOS: VoodooHDA starts the HDA controller's
CORB with "or byte [rax+0x4c], 2" (CORBCTL |= CORBRUN), and the guest
died at the first sound.
Accept 0x80 in both, with a one byte operand as emulate_cmp() does.
The file is shared with bhyve(8), so the fix covers the in-kernel
devices (HPET, local APIC without APICv, I/O APIC) and the user space
device models alike.
Signed-off-by: Wanpeng Qian <wanpengqian at gmail.com>
Reviewed by: markj
[5 lines not shown]
imgact_elf: Pass program headers to the sv_protect hook
We handle program headers beyond the first page of the file, but
arm64_exec_protect() wasn't updated to handle this. Pass the program
header array directly to the sv_protect hook.
Also fix a pre-existing bug: imgp->et_dyn_addr isn't the right base
address to use for the SV_INTERP case.
Reported by: alc
Reviewed by: alc, kib
Fixes: 804daf166406 ("imgact_elf: read program headers if not contained in the first page")
Fixes: 670af174e27b ("arm64: Enable BTI in the kernel ELF loader")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61999
(cherry picked from commit 884e1a00151d181e5dd1ba9d83c1adcffd25e5e8)
gve: Page-align DQO descriptor and completion rings
Currently, gve_rx_alloc_ring_dqo() and gve_tx_alloc_ring_dqo() request
CACHE_LINE_SIZE alignment when allocating DMA memory for the DQO TX/RX
descriptor and completion rings. The device requires stronger alignment
than cache line alignment, which was incidentally being met due to how
the kernel allocates memory. Explicitly meet this requirement by
requesting page aligned memory.
Signed-off-by: Tim Hostetler <thostet at google.com>
Reviewed by: markj, Jasper Tran O'Leary <jtranoleary at google.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D61211
(cherry picked from commit 9d48e88e023634e12530bf9db4a2e85d022b93db)
BSD.tests.dist: Add the new sys/libkern directory
Without that, 'make distributeworld' fails ('make buildworld' and 'make
installworld' do not need it).
Reported by: llm-postcr
Fixes: 1a80570a3940 ("tests/sys: Move libkern's tests in a separate directory")
Sponsored by: The FreeBSD Foundation
tests/sys/pmc/amd: Call pmc_cpuinfo() in amd_test_find_classinfo()
Every caller of amd_test_find_classinfo() calls pmc_cpuinfo() right
before it. Do that in the helper and drop the ibs_classinfo() and
rapl_classinfo() wrappers.
rapl_domains_test now fails instead of skipping when pmc_cpuinfo()
fails after pmc_init() succeeded, like the other tests.
Suggested by: mhorne
Reviewed by: mhorne
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision: https://reviews.freebsd.org/D62106
tests/sys/pmc/amd: Skip in guests without a PMU
In a guest that shows an AMD Zen CPU but has no PMU, hwpmc(4) registers
neither the AMD core class nor IBS. pmc_rowalloc_test, pmu_mux_test and
pmu_detect_test check only the CPU and pmc_init(), and
pmc_ibs_fetch_op_test checks only CPUID leaf 0x8000001B, which bhyve
passes through. All four fail there instead of skipping.
Add amd_test_skip_unless_class() and use it in pmc_rowalloc_test,
pmu_mux_test and pmc_ibs_fetch_op_test. hwpmc_amd registers a class
only after amd_hwcheck() passes, so a missing class means there are no
usable counters; rapl_domains_test already skips that way.
pmu_detect_test asserts that the class is registered, so gate it on
PerfCtrExtCore instead, which bhyve clears and KVM sets only with a
vPMU.
PR: 300856
Reviewed by: mhorne
Fixes: 546a76463123 ("tests/sys/pmc: add pidtrack, callchain, pmc(8), RAPL and AMD tests")
[4 lines not shown]
dma: Partially untangle DMA_ROOT_USER (upstream) confusion
Add a URL to upstream report "DMA_ROOT_USER considered confusing".
Rename the package variable to the normal DMA_USER. Move the setting
into the "!unpriv" conditional arm, and guess at appropriate values
within the unpriv arm, with a TODO marker.