Runtime: FaultAddress formats its kind by its Vulkan name
What: FaultAddress drops its derived Debug for its own, which prints the address type by its Vulkan name (the seven VK_DEVICE_FAULT_ADDRESS_TYPE_* names, else "kind N"), then the address and the precision in hex. The replay player's `loss` line prints each access and instruction pointer through it. Why: ash is built without its `debug` feature here, so vk::DeviceFaultAddressTypeEXT has no Debug, and the derive failed to compile (E0277 at fault.rs:36; gate job m3-max-62271 failed in every step on it). Verified: cargo fmt --all. Compile, clippy, Rustdoc and the tests run in the re-run gate named in the lane's report.
This commit is contained in:
1 parent
0156925ec6
commit
6b1367b6c5
2 files changed
+26
-11
No files matched your search
@@ -5,6 +5,7 @@
|
||||
use crate::command::DeviceLoss;
|
||||
use crate::device::Core;
|
||||
use ash::vk;
|
||||
use std::fmt;
|
||||
|
||||
/// What the driver reported of a lost device's fault ([`DeviceLoss::fault`]), as it gave it:
|
||||
/// `vkGetDeviceFaultInfoEXT`'s description, addresses and vendor records. The runtime places no
|
||||
@@ -30,7 +31,7 @@ pub struct DeviceFault {
|
||||
/// One address the driver reported (`VkDeviceFaultAddressInfoEXT`).
|
||||
///
|
||||
/// No Metal counterpart: Metal reports no fault address.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub struct FaultAddress {
|
||||
/// `addressType`.
|
||||
pub kind: vk::DeviceFaultAddressTypeEXT,
|
||||
@@ -41,6 +42,28 @@ pub struct FaultAddress {
|
||||
pub precision: u64,
|
||||
}
|
||||
|
||||
/// The kind by its Vulkan name, then the address and the precision in hex: ash's
|
||||
/// `DeviceFaultAddressTypeEXT` has no `Debug` of its own without ash's `debug` feature.
|
||||
impl fmt::Debug for FaultAddress {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
const KINDS: [&str; 7] = [
|
||||
"NONE",
|
||||
"READ_INVALID",
|
||||
"WRITE_INVALID",
|
||||
"EXECUTE_INVALID",
|
||||
"INSTRUCTION_POINTER_UNKNOWN",
|
||||
"INSTRUCTION_POINTER_INVALID",
|
||||
"INSTRUCTION_POINTER_FAULT",
|
||||
];
|
||||
let raw = self.kind.as_raw();
|
||||
match usize::try_from(raw).ok().and_then(|at| KINDS.get(at)) {
|
||||
Some(name) => f.write_str(name)?,
|
||||
None => write!(f, "kind {raw}")?,
|
||||
}
|
||||
write!(f, " {:#x} precision {:#x}", self.address, self.precision)
|
||||
}
|
||||
}
|
||||
|
||||
/// `loss`, a loss the runtime met itself, with its [`fault`](DeviceLoss::fault) set: the
|
||||
/// device's report where `loss` is the device's first and its result is `ERROR_DEVICE_LOST`, None
|
||||
/// otherwise. Only then is the device lost, as `vkGetDeviceFaultInfoEXT` requires
|
||||
|
||||
@@ -436,18 +436,10 @@ fn stages_line(at: &str, stages: &Stages) -> String {
|
||||
/// instruction pointer and vendor record.
|
||||
fn loss_line(loss: &rt::DeviceLoss) -> String {
|
||||
let mut line = format!("loss {} {:?}", loss.call, loss.result);
|
||||
let at = |a: &rt::FaultAddress| {
|
||||
format!("{:?} {:#x} precision {:#x}", a.kind, a.address, a.precision)
|
||||
};
|
||||
if let Some(fault) = &loss.fault {
|
||||
line.push_str(&format!("; fault {:?}", fault.description));
|
||||
line.extend(fault.accesses.iter().map(|a| format!("; access {}", at(a))));
|
||||
line.extend(
|
||||
fault
|
||||
.instructions
|
||||
.iter()
|
||||
.map(|a| format!("; instruction {}", at(a))),
|
||||
);
|
||||
line.extend(fault.accesses.iter().map(|a| format!("; access {a:?}")));
|
||||
line.extend((fault.instructions.iter()).map(|a| format!("; instruction {a:?}")));
|
||||
line.extend((fault.vendor.iter()).map(|(description, code, data)| {
|
||||
format!("; vendor {description:?} code {code:#x} data {data:#x}")
|
||||
}));
|
||||
|
||||
Reference in new issue
Block a user