1111
1212
1313class ComplianceCheck (BaseCheck ):
14+ """Validate compliance test artifacts for a submission.
15+
16+ The `ComplianceCheck` class runs a set of validations against the
17+ compliance directory produced with a submission. It verifies the
18+ presence of required test subdirectories and files, runs delegated
19+ performance and accuracy checks for compliance tests, and inspects
20+ compliance-specific performance outputs.
21+
22+ The class delegates some checks to `PerformanceCheck` and
23+ `AccuracyCheck` helpers when relevant. Results and file lists are
24+ logged via the provided logger.
25+ """
26+
1427 def __init__ (self , log , path , config : Config ,
1528 submission_logs : SubmissionLogs ):
29+ """Initialize the compliance checker.
30+
31+ Args:
32+ log: Logger used to emit informational, warning, and error
33+ messages about the compliance checks.
34+ path: Filesystem path to the submission root being checked.
35+ config (Config): Configuration provider for models and
36+ compliance expectations.
37+ submission_logs (SubmissionLogs): Parsed submission log
38+ artifacts and loader metadata.
39+ """
1640 super ().__init__ (log , path )
1741 self .submission_logs = submission_logs
1842 self .config = config
@@ -28,12 +52,30 @@ def __init__(self, log, path, config: Config,
2852 self .setup_checks ()
2953
3054 def setup_checks (self ):
55+ """Register the sequence of compliance checks to run.
56+
57+ Appends the per-submission validation callables to `self.checks` in
58+ the order they should be executed by the checking framework.
59+ """
3160 self .checks .append (self .dir_exists_check )
3261 self .checks .append (self .performance_check )
3362 self .checks .append (self .accuracy_check )
3463 self .checks .append (self .compliance_performance_check )
3564
3665 def get_test_list (self , model ):
66+ """Return the list of compliance tests applicable to `model`.
67+
68+ The mapping of models to tests is read from the configuration
69+ (`self.config.base`) using the pre-defined keys
70+ `models_TEST01`, `models_TEST04`, and `models_TEST06`.
71+
72+ Args:
73+ model (str): MLPerf benchmark/model identifier.
74+
75+ Returns:
76+ list[str]: Ordered list of compliance test names to execute.
77+ """
78+
3779 test_list = []
3880 if model in self .config .base ["models_TEST01" ]:
3981 test_list .append ("TEST01" )
@@ -44,6 +86,18 @@ def get_test_list(self, model):
4486 return test_list
4587
4688 def dir_exists_check (self ):
89+ """Verify required compliance directories and files exist.
90+
91+ Skips checks for the 'open' division. For each test in
92+ `self.test_list`, ensures the expected test directory exists and
93+ that required verification files are present depending on the
94+ test type (accuracy/performance files for specific tests).
95+
96+ Returns:
97+ bool: True if all required files and directories are present,
98+ False otherwise.
99+ """
100+
47101 if self .division .lower () == "open" :
48102 self .log .info (
49103 "Compliance tests not needed for open division. Skipping tests on %s" ,
@@ -86,6 +140,17 @@ def dir_exists_check(self):
86140 return is_valid
87141
88142 def performance_check (self ):
143+ """Run performance compliance checks for applicable tests.
144+
145+ For each test that requires a performance check (TEST01 and
146+ TEST04), construct a `SubmissionLogs` object pointing at the
147+ test's performance log and delegate to `PerformanceCheck`.
148+
149+ Returns:
150+ bool: True if all delegated performance checks pass, False
151+ if any fail.
152+ """
153+
89154 if self .division .lower () == "open" :
90155 self .log .info (
91156 "Compliance tests not needed for open division. Skipping tests on %s" ,
@@ -108,6 +173,20 @@ def performance_check(self):
108173 return is_valid
109174
110175 def accuracy_check (self ):
176+ """Run accuracy compliance checks for applicable tests.
177+
178+ For TEST01, verifies deterministic-mode pass lines and checks the
179+ `accuracy` directory contents and baseline/compliance accuracy
180+ values against model-specific delta thresholds.
181+
182+ For TEST06, inspects the pre-parsed result lines for first-token,
183+ EOS, and sample-length checks.
184+
185+ Returns:
186+ bool: True if all required accuracy checks pass, False
187+ otherwise.
188+ """
189+
111190 if self .division .lower () == "open" :
112191 self .log .info (
113192 "Compliance tests not needed for open division. Skipping tests on %s" ,
@@ -228,6 +307,17 @@ def accuracy_check(self):
228307 return is_valid
229308
230309 def compliance_performance_check (self ):
310+ """Inspect compliance performance verification outputs.
311+
312+ For TEST01 and TEST04, checks the `verify_performance.txt` file for
313+ a passing indicator and ensures the `performance/run_1` directory
314+ contains the expected files (with optional exclusions).
315+
316+ Returns:
317+ bool: True if all compliance performance checks pass, False
318+ if any check fails.
319+ """
320+
231321 if self .division .lower () == "open" :
232322 self .log .info (
233323 "Compliance tests not needed for open division. Skipping tests on %s" ,
0 commit comments