1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#![cfg_attr(coverage_nightly, coverage(off))]
//! CUDA-SIMD Defect Taxonomy
//!
//! Extracted from cuda_simd.rs for file health compliance (CB-040).
//! Contains DefectSeverity, DefectClass, and DefectTaxonomy definitions.
//!
//! Split into submodules via include!() for file health compliance (PMAT-503):
//! - cuda_simd_defects_patterns.rs: Tauranta defect pattern definitions
//! - cuda_simd_defects_tests.rs: Unit tests
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
/// Defect severity levels following PAIML Tauranta taxonomy
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DefectSeverity {
/// P0: Critical - causes crashes, data corruption, or incorrect results
P0Critical,
/// P1: Performance - significant performance degradation
P1Performance,
/// P2: Efficiency - memory or compute inefficiency
P2Efficiency,
/// P3: Minor - style or minor optimization opportunities
P3Minor,
}
impl std::fmt::Display for DefectSeverity {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::P0Critical => write!(f, "P0-Critical"),
Self::P1Performance => write!(f, "P1-Performance"),
Self::P2Efficiency => write!(f, "P2-Efficiency"),
Self::P3Minor => write!(f, "P3-Minor"),
}
}
}
/// Defect class from Tauranta fault history
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DefectClass {
/// Ticket ID (e.g., "PARITY-114", "PAR-041")
pub ticket_id: String,
/// Human-readable description
pub description: String,
/// Severity level
pub severity: DefectSeverity,
/// Detection method
pub detection_method: String,
/// Resolution status
pub resolved: bool,
/// Root cause (5-Why analysis)
pub root_cause: Option<String>,
}
/// Known defect patterns from Tauranta fault history
#[derive(Debug, Clone, Default)]
pub struct DefectTaxonomy {
patterns: HashMap<String, DefectClass>,
}
impl DefectTaxonomy {
/// Get defect pattern by ticket ID
#[must_use]
pub fn get(&self, ticket_id: &str) -> Option<&DefectClass> {
self.patterns.get(ticket_id)
}
/// Get all patterns
pub fn all(&self) -> impl Iterator<Item = &DefectClass> {
self.patterns.values()
}
/// Get total number of patterns
#[must_use]
pub fn len(&self) -> usize {
self.patterns.len()
}
/// Check if taxonomy is empty
#[must_use]
pub fn is_empty(&self) -> bool {
self.patterns.is_empty()
}
}
// Tauranta defect pattern definitions (with_tauranta_patterns impl)
include!("cuda_simd_defects_patterns.rs");
// Unit tests
include!("cuda_simd_defects_tests.rs");