If the APIC ID is sometimes different, it starts to rule out the issue is a (single) bad CPU core.
You get to those directories through Windows' file explorer.
C > Windows > LiveKernelReports
The WHEA and WATCHDOG directories will be in there. Check both directories for any log files. If they have them, then these will hold clues to the restarts. You can use WinDbg to open and analyze them, or if you can't figure it out or don't want to try, upload two or three of the latest logs from each directory.
I admit I'm making a guess here, but I think your problem is a possible video card issue. If not, PSU is pretty likely too. It's restarting in games but holding stable in most stress tests, and you're also describing symptoms to the letter of what a Ryzen CPU will do when it encounters a machine check exception. And those are almost always a hardware issue and rarely a software issue. Bridging that all together, I'm suspecting video card or maybe PSU behind that.
That's not to say you can't try alternatives. That's not to say it isn't a driver or software issue. Not everyone likes jumping to conclusions, after all. I don't either, and that's why I also made sure to exhaust everything else when I ran into a similar (if not the same) issue you are now, but in the end it was the thing that I suspected all along. And your symptoms are quite telling. Follow the steps (check those logs, namely), but my guess is on video card.
If you want to check further, run a game (or run FurMark), and set it to window mode/Alt+Tab/whatever you need to to have the game open, and then also open a hardware accelerated browser, and browse for... as long as it takes. Does this restart also eventually occur in this game or Furmark plus hardware accelerated browser scenario? This was a way for me to encourage it to occur for me since games were hit or miss and might take longer, and most stress tests passes (OCCT's "GPU variable" was the only one that ever failed for me, and even that passed more often than it didn't). Since games might be fine for upwards of days for you (just like me), that might be a way to try and force it almost on demand. Then, if logs are created, you can check those.
It just crashed again, and there's a log in the WHEA directory. Theres some in the WATCHDOG aswell, but those are older. This is the WHEA log
WHEA_UNCORRECTABLE_ERROR (124)
A fatal hardware error has occurred. Parameter 1 identifies the type of error
source that reported the error. Parameter 2 holds the address of the
nt!_WHEA_ERROR_RECORD structure that describes the error condition. Try !errrec Address of the nt!_WHEA_ERROR_RECORD structure to get more details.
Arguments:
Arg1: 0000000000000000, Machine Check Exception
Arg2: ffffb78e9de6eb90, Address of the nt!_WHEA_ERROR_RECORD structure.
Arg3: 00000000bea00000, High order 32-bits of the MCi_STATUS value.
Arg4: 0000000001000108, Low order 32-bits of the MCi_STATUS value.
KEY_VALUES_STRING: 1
Key : Analysis.CPU.mSec
Value: 3327
Key : Analysis.Elapsed.mSec
Value: 10734
Key : Analysis.IO.Other.Mb
Value: 17
Key : Analysis.IO.Read.Mb
Value: 10
Key : Analysis.IO.Write.Mb
Value: 30
Key : Analysis.Init.CPU.mSec
Value: 562
Key : Analysis.Init.Elapsed.mSec
Value: 28806
Key : Analysis.Memory.CommitPeak.Mb
Value: 86
Key : Bugcheck.Code.LegacyAPI
Value: 0x124
Key : Dump.Attributes.AsUlong
Value: 18
Key : Dump.Attributes.KernelGeneratedTriageDump
Value: 1
Key : Failure.Bucket
Value: LKD_0x124_0_AuthenticAMD_PROCESSOR__UNKNOWN_IMAGE_AuthenticAMD.sys
Key : Failure.Hash
Value: {f59f17e7-f24e-04f5-3f16-e9425b2acba5}
BUGCHECK_CODE: 124
BUGCHECK_P1: 0
BUGCHECK_P2: ffffb78e9de6eb90
BUGCHECK_P3: bea00000
BUGCHECK_P4: 1000108
FILE_IN_CAB: WHEA-20240221-2248.dmp
DUMP_FILE_ATTRIBUTES: 0x18
Kernel Generated Triage Dump
Live Generated Dump
PROCESS_NAME: smss.exe
STACK_TEXT:
ffff8800`8b207150 fffff806`2ff6089f : ffffb78e`9de6eb70 00000000`00000000 ffffb78e`9de6eb90 00000000`00000022 : nt!LkmdTelCreateReport+0x13e
ffff8800`8b207690 fffff806`2ff60796 : ffffb78e`9de6eb70 fffff806`00000000 00000078`00000000 00000078`f2dff690 : nt!WheapReportLiveDump+0x7b
ffff8800`8b2076d0 fffff806`2fdd3d8d : 00000000`00000001 ffff8800`8b207b40 00000078`f2dff690 00000000`00000218 : nt!WheapReportDeferredLiveDumps+0x7a
ffff8800`8b207700 fffff806`2fc88327 : 00000000`00000000 ffffb78e`99da4030 00000000`00000103 00000000`00000000 : nt!WheaCrashDumpInitializationComplete+0x59
ffff8800`8b207730 fffff806`2fa11138 : ffffb78e`9f120000 ffffb78e`9f11fb00 ffff8800`8b207b40 ffffb78e`00000000 : nt!NtSetSystemInformation+0x1f7
ffff8800`8b207ac0 00007ffd`0f410554 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nt!KiSystemServiceCopyEnd+0x28
00000078`f2dff638 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : 0x00007ffd`0f410554
MODULE_NAME: AuthenticAMD
IMAGE_NAME: AuthenticAMD.sys
STACK_COMMAND: .cxr; .ecxr ; kb
FAILURE_BUCKET_ID: LKD_0x124_0_AuthenticAMD_PROCESSOR__UNKNOWN_IMAGE_AuthenticAMD.sys
OSPLATFORM_TYPE: x64
OSNAME: Windows 10
FAILURE_ID_HASH: {f59f17e7-f24e-04f5-3f16-e9425b2acba5}
Followup: MachineOwner
Im still getting the WudfRd driver error though. That has popped up everysingle time the PC restarts, and doesn't change. Could it be that my headset is just fucked? Cause googling the error message from Event Viewer brings me to a reddit thread for basically the same error caused by the exact same headset I'm using. I just switched to the third driver option for the headset in Device Manager, maybe that works.
And the APIC ID was different this time, this time it was 10, and only one APIC this time