[bazel] Add -lrt to openmp (#247866)
When using the hermetic toolchain, which targets glibc 2.28 by default,
this is required. It doesn't hurt newer glibc versions
[AMDGPU] Respect retained occupancy when comparing schedules
The scheduler can discard a schedule that spills fewer registers
because it compares occupancy beyond what the function can retain.
Cap both pressure comparisons at the function's retained occupancy.
A synthetic gfx1200 kernel spills 16 SGPRs instead of 32 at the same
two-wave limit.
AI assisted.
[libFuzzer] Use TerminateProcess for immediate exits on Windows (#247877)
On Windows, `_Exit()` calls `ExitProcess()`, which kills all other threads
and then runs `DllMain(DLL_PROCESS_DETACH)` for every loaded DLL while
holding the loader lock. libFuzzer often exits from a non-main thread
(timeout, RSS limit, or crash handler). If a DLL's detach handler waits on a
lock or a thread that was already killed, the process hangs instead of
exiting. We saw this on ClusterFuzz after `SUMMARY: libFuzzer: timeout`.
Add `ExitImmediately()`, which uses `TerminateProcess()` on Windows to skip
DLL detach, the same way as `internal__exit()` in sanitizer_common. Other
platforms still use `_Exit()`. Use it for all existing `_Exit()` calls in
libFuzzer.
Assisted-by: Gemini
[AMDGPU][NFC] Precommit test for SIFixSGPRCopies PHI-to-AGPR rewrite (#247814)
`processPHINode` moves a VGPR PHI to an AGPR class when all of its uses
are copies to AGPRs. A `DBG_VALUE` use of the PHI blocks the move, so
the class depends on `-g`.
The checks show the current behavior: the PHIs in `phi_agpr_use` and
`phi_agpr_use_64` become `agpr_32` and `areg_64_align2`, while the one
in `phi_agpr_use_dbg_value` stays `vgpr_32`.
This came up in the review of #245761.
Assisted-by: Claude Opus 5.5
---------
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Co-authored-by: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
[flang][OpenMP] Compare complex parts and literal substrings by value
Expr equality had two gaps:
- ComplexComponent inherited Operation::operator==, which ignores
isImaginaryPart, so `real(z)` and `aimag(z)` compared equal.
- Substring compared literal parents by StaticDataObject::Pointer, so
substrings of identical literals, such as `'ab'(i:i)`, never compared
equal.
METADIRECTIVE lowering turns `user={condition(...)}` selectors into an
IF/ELSE chain. Since a condition is false on its ELSE path, Flang drops
the other candidates with the same condition there, using Expr equality
to compare them.
The first gap drops a different condition:
```
!$omp metadirective &
!$omp& when(user={condition(real(z) > 0.0)}: taskyield) &
[26 lines not shown]
[DAG] combineShiftToAVG - match sub(A, not(B)) as avgceil
A - ~B == A + B + 1. DAGCombiner turns add(add(A, B), 1) into
sub(A, not(B)) if preferIncOfAddToSubOfNot is false, as on X86 for
multi-element vectors and on AArch64 for all vectors. D148809 delays
this until after legalization if the add of 1 has nuw or nsw.
combineShiftToAVG does not recognize the sub form, so the ceil average
is lost if the fold runs first. Match the sub form as well. If the not
has other users, only do it when the AVG node is legal or custom.
This shows up when the IR is written as a sub of a not, or when a
freeze is pushed through the adds and drops their flags. With #152107
the latter loses vpavgb/vpavgw in five AVX512F maskz tests of
avg-mask.ll, which match main again with this change.
Where the target expands the AVG node, the sub form now gets the code
of the add form, e.g. on RISC-V P, which has AVGSUBFLOOR but no
AVGCEIL, and for some Hexagon and ARM NEON types.
Assisted-by: Claude Code (Claude Opus 5.5)
[X86][ACEV1] Keep a tile config from resetting a written BSR
ldtilecfg runs bsr_init(), so a config the compiler places between a
BSR write and a read of that value throws the scales away. The config
cannot move above the write, because a call makes it volatile and -O0
puts one at the head of every block that uses tiles.
Mark the configs as writing bsr0, give BSR0 a register class so a
spill has a size, and preserve the value across the configs that
reach a read. Memory forms exist both ways, so this costs four
instructions.
Co-authored-by: Claude Opus 5 <noreply at anthropic.com>
netipsec: Relabel only an outer IPv6 header that a tunnel built
When transport mode requests follow a tunnel mode request in a bundle,
ipsec_process_done() sets the flow label of the outer IPv6 header from
the outermost SA. It checks only that the policy has such a tunnel
request, not that it was applied. A tunnel request at level use
without an SA is skipped, and a transport request after it, unless it
names a destination other than the packet's, is then applied to the
packet's own header. With a policy such as
"esp/tunnel/A-B/use ah/transport//require", an AH SA between the hosts
and no ESP SA, every IPv6 packet leaves with the label of the AH SA. A
forwarded packet loses the label its source chose, which RFC 6437 asks
forwarding nodes to leave alone, and every flow through that SA gets
the same one.
Record in the packet's output history the mode of the request each SA
was applied for, rather than the SA's own, which may be "any", and
relabel only when the history holds a record of one of the policy's
earlier tunnel mode requests. Nothing else reads the mode in the
[11 lines not shown]
Fix a crash in handling this-pointer captured in nested lambdas in field initializer. (#245491)
Environment.initialize() currently crashes when handling a this-pointer
captured by a nested lambda expression appearing in a field initializer
of a struct. Consider the following example:
```cpp
struct {
int f = int f{[this]() { return [this]() { return 1; }(); }()};
}
```
When handling the this-pointer captured in the inner lambda,
Environment.initialize() tries to get the enclosing record by calling
getLambdaContext() on the lambda's Closure. However, getLambdaContext()
only works for the outermost lambda. For inner lambdas, it just returns
nullptr, which causes a null-dereference.
This PR fixes that issue by introducing a helper function that finds the
outermost lambda and get getLambdaContextDecl() from it.
[flang][OpenMP] Compare complex parts and literal substrings by value
Expr equality had two gaps:
- ComplexComponent inherited Operation::operator==, which ignores
isImaginaryPart, so `real(z)` and `aimag(z)` compared equal.
- Substring compared a literal parent's StaticDataObject::Pointer, so
substrings of two identical literals, such as `'ab'(i:i)`, never
compared equal.
METADIRECTIVE lowering uses Expr equality to drop candidates whose
runtime condition already failed. With
```
!$omp metadirective &
!$omp& when(user={condition(real(z) > 0.0)}: taskyield) &
!$omp& when(user={condition(aimag(z) > 0.0)}: taskwait)
```
the ELSE path of `real(z) > 0.0` dropped the TASKWAIT candidate, so
[9 lines not shown]
[GVN] Treat Deadblock as Available
PRE insert load instruction if there is only one predecessor cannot be
eliminated. A deadblock can actually be treat as Available so that it
doesn't count into the BB that needs to insert load.
ZTS: auto_offline_001_pos: rescan only the scsi_debug host
insert_disk without a host makes scan_scsi_hosts write "- - -" to the
scan file of every SCSI host. On a VM with eight virtio_scsi
controllers, each of those scans takes about 9 seconds: for every LUN
it probes and does not find, the scan allocates a temporary device and
frees it again, and each time the host's shared tag set is updated,
which freezes the queue of the disk behind it. A reattach then takes
about 67 seconds, and the test, which reattaches its disk eight
times, is killed at its 10 minute timeout.
Every other caller of insert_disk passes the host of its device. Do the
same here: record the scsi_debug host before the first removal, while
the device still exists, and rescan only that host.
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Closes #20060
[AMDGPU] Precommit test for SIFixSGPRCopies PHI-to-AGPR rewrite
processPHINode moves a VGPR PHI to an AGPR class when all of its uses
are copies to AGPRs. A DBG_VALUE use currently blocks the move, so the
chosen class depends on -g.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
bigger wine update, some key changes of the port summarized here:
- update to version 11.23, the latest release
- switch to new sndio backend (by me and armani@ in collaboration)
- remove USE_WXNEEDED and the corresponding patch in configure.ac;
wine now works with W^X.
- wine gs patching can now to inspected with WINEDEBUG=+gsstats
- futex based sync instead of kqueue
- arc4random instead of /dev/urandom in a few places
- README additions about MIDI use, how to use egdb(1) with wine
(by Andrii)
- and more...
This is the result of effectively several weeks of collaboration and
has undergone a fair amount of testing.
Besides above mentioned, other notable contributions are by Andrii,
fabien@, brynet@.
Caveat: The sndio backend currently only implements the play, but not
[2 lines not shown]