ORT 1.23.0 cherry-pick PRs 25629, 25583 (#25709)
### Description
Cherry-pick the following PRs into `rel-1.23.0`:
- https://github.com/microsoft/onnxruntime/pull/25629
- https://github.com/microsoft/onnxruntime/pull/25583
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
---------
Co-authored-by: Chunye Wang@AMD <Chunye.wang@amd.com>
Co-authored-by: mingyue <mingyue@amd.com>
Co-authored-by: Artur Wojcik <artur.wojcik@amd.com>
Co-authored-by: urpetkov-amd <127323899+urpetkov-amd@users.noreply.github.com>
Co-authored-by: Ted Themistokleous <107195283+TedThemistokleous@users.noreply.github.com>
Co-authored-by: Ted Themistokleous <tedthemistokleous@amd.com>
Co-authored-by: Scott McKay <Scott.McKay@microsoft.com>