Added observability tests for PCI Spyre adapter - #3192
Conversation
d32e6b6 to
79f6b64
Compare
|
Logs: Fetching asset from spyre_observability_tests.py:ObservabilityTests.test_aiu_smi |
79f6b64 to
8979066
Compare
|
Logs: Fetching asset from spyre_observability_tests.py:ObservabilityTests.test_aiu_smi |
f80b8bd to
ec49d79
Compare
| def run_cmd(self, cmd): | ||
| """Execute a command and track failures.""" | ||
| if process.system(cmd, ignore_status=True, sudo=True, shell=True): | ||
| self.is_fail += 1 |
There was a problem hiding this comment.
Not used any where else. Should this be removed?
| if result.exit_status == 0: | ||
| self.log.info("SELinux set to Permissive mode") | ||
| else: | ||
| self.log.warning( |
There was a problem hiding this comment.
Given this is a hard requirement, warning wouldn't be sufficient. Should we mark this as failed?
| tarball = self.fetch_asset('ServiceReport.zip', locations=[ | ||
| 'https://github.com/linux-ras/ServiceReport' | ||
| '/archive/master.zip'], expire='7d') | ||
| archive.extract(tarball, self.workdir) |
There was a problem hiding this comment.
Just extract will not ensure this tool is installed. You will need to explicitly install it.
|
|
||
| self.log.info("Setting up spyre group access") | ||
| self.run_cmd("servicereport -r -p spyre") | ||
| self.run_cmd("servicereport -v -p spyre") |
There was a problem hiding this comment.
Check for failure and mark the test as failed. Spyre setup is a hard requirement before running the tests.
There was a problem hiding this comment.
yes look for FAIL in command output
| self.run_cmd(f"rm -rf {clone_dir}") | ||
|
|
||
| clone_cmd = f"cd /tmp && git clone https://github.com/IBM/aiu-trace-analyzer.git" | ||
| result = process.run(clone_cmd, shell=True, ignore_status=True) |
There was a problem hiding this comment.
in teardown() make sure to remove this directory
|
|
||
| script_path = os.path.join(self.workdir, "continuous_inference.py") | ||
| with open(script_path, 'w') as f: | ||
| f.write(inference_script) |
There was a problem hiding this comment.
in teardown() clean up this script.
| "PASS: AIU-SMI observability test completed successfully") | ||
| self.log.info("Metrics were successfully captured and validated") | ||
|
|
||
| def _build_acelyzer_podman_command(self): |
There was a problem hiding this comment.
this function implementation is similar to test_aiu_smi(). some of the code and be moved to a helper function which then both functions can use.
abdhaleegit
left a comment
There was a problem hiding this comment.
Please follow the existing template for spyre test
| GROUP_ADD: "keep-groups" | ||
| PORT_MAPPING: "127.0.0.1::8000" | ||
| METRICS_DURATION: "30" | ||
| ``` |
There was a problem hiding this comment.
if yaml is already added.. remove details from readme ..
| - Verifying acelyzer can process trace files | ||
| - Validating performance metrics extraction | ||
| - Confirming trace analysis tools are functioning correctly | ||
| - Measuring AIU device utilization and kernel execution times |
There was a problem hiding this comment.
too much explanation, optmize overview and test purpose into single
|
|
||
| ### Observability-Specific Parameters | ||
| - `METRICS_DURATION`: Duration to capture metrics in seconds (default: "30") - for aiu-smi test | ||
| - `TRACE_NUM_REQUESTS`: Number of inference requests for trace generation (default: "10") - for Acelyzer test |
There was a problem hiding this comment.
remove parameter explanation as already taken care in yaml
| - Test generates 10 inference requests by default (configurable via TRACE_NUM_REQUESTS) | ||
| - Each inference request waits 2 seconds before the next one | ||
| - Trace files are automatically found and analyzed | ||
| - Performance metrics (AIU utilization, kernel times) are extracted and validated |
There was a problem hiding this comment.
remove trouble shooting and notes , pass fail criteria..
| # Duration to capture metrics in seconds (for aiu-smi test) | ||
| METRICS_DURATION: "" | ||
| # Number of inference requests for trace generation (for Acelyzer test) | ||
| TRACE_NUM_REQUESTS: "" |
There was a problem hiding this comment.
| self.run_cmd(f"rm -rf {clone_dir}") | ||
|
|
||
| clone_cmd = f"cd /tmp && git clone https://github.com/IBM/aiu-trace-analyzer.git" | ||
| result = process.run(clone_cmd, shell=True, ignore_status=True) |
There was a problem hiding this comment.
avocado has git utils to clone .. please check
| "Failed to clone aiu-trace-analyzer: %s", result.stderr_text) | ||
| self.fail("Failed to clone aiu-trace-analyzer repository") | ||
|
|
||
| self.log.info("Successfully cloned aiu-trace-analyzer") |
There was a problem hiding this comment.
are we not compiling the source ?
| self.log.info("Starting container with FLEX environment variables") | ||
| podman_cmd = self._build_acelyzer_podman_command() | ||
| self.log.info("Podman command: %s", podman_cmd) | ||
| container_output = self.run_cmd_out(podman_cmd) |
There was a problem hiding this comment.
reuse create container run utils
| self.fail("Failed to create container") | ||
|
|
||
| self.container_id = container_id | ||
| self.log.info("Container created: %s", container_id) |
There was a problem hiding this comment.
avoids all above logic
|
|
||
| self.log.info("Copying aiu-trace-analyzer to container") | ||
| copy_cmd = f"podman cp {clone_dir} {container_id}:/tmp" | ||
| result = process.run(copy_cmd, shell=True, ignore_status=True) |
There was a problem hiding this comment.
there exists copy container utils .. please reuse
|
@saijanani-c any updates here ? |
ec49d79 to
b1ea413
Compare
|
JOB ID : 04f28119148799ba21fedb89cb7acd5dedaaf2af |
| 3. ** test_aiu_smi_nonroot**: Create non-root container, capture aiu-smi metrics | ||
| 4. ** test_trace_analyzer_nonroot**: Use non-root container, analyze traces with acelyzer | ||
|
|
||
| # Required Parameters |
There was a problem hiding this comment.
Are all the below mentioned parameters required?
There was a problem hiding this comment.
I have changed this section
| avocado run spyre_observability_tests.py: ObservabilityTests.test_trace_analyzer_nonroot - m spyre_observability_tests.py.data/spyre_observability_tests.yaml | ||
| ``` | ||
|
|
||
| # Test Flow |
There was a problem hiding this comment.
Remove the test flow section. It is additional work to keep this in sync with the implementation.
| metrics_output = f.read() | ||
|
|
||
| if not metrics_output or len(metrics_output.strip()) == 0: | ||
| self.log.error("No metrics were captured during the teno st") |
|
|
||
| repo_url = self.params.get("TRACE_ANALYZER_REPO", | ||
| default="https://github.com/IBM/aiu-trace-analyzer.git") | ||
| branch = self.params.get("TRACE_ANALYZER_BRANCH", default="main") |
There was a problem hiding this comment.
This is missing from YAML file.
There was a problem hiding this comment.
Has been removed
|
|
||
| Run all tests: | ||
| ```bash | ||
| avocado run - -max-parallel-tasks = 1 spyre_observability_tests.py - m spyre_observability_tests.py.data/spyre_observability_tests.yaml |
There was a problem hiding this comment.
test name is spyre_Observability_tests.py. Similarly the .data directory name
| - `CONTAINER_TAG`: Container image tag | ||
| - `API_KEY`: Container registry API key(optional) | ||
| - `DEVICE`: Device to mount(default: "/dev/vfio") | ||
| - `PRIVILEGED`: Run privileged(default: "true") |
There was a problem hiding this comment.
Has been removed
|
|
||
| # VLLM Options | ||
| - `VLLM_SPYRE_USE_CB`: Enable Spyre callback(e.g., "1") | ||
| - `VLLM_DT_CHUNK_LEN`: Data transfer chunk length(optional) |
There was a problem hiding this comment.
These are not present in YAML file.
There was a problem hiding this comment.
Has been removed
|
|
||
| return container_id | ||
|
|
||
| def test_aiu_smi_root(self): |
There was a problem hiding this comment.
test_aiu_smi_root and test_aiu_smi_nonroot are near-identical. Create a helper function for common code.
| self.log.info( | ||
| "PASS: AIU-SMI observability test (root) completed successfully") | ||
|
|
||
| def test_trace_analyzer_root(self): |
There was a problem hiding this comment.
test_trace_analyzer_root and test_trace_analyzer_nonroot are near-identical. Create a helper function for common code.
| else: | ||
| self.log.warning("Active file not found or empty") | ||
|
|
||
| return "out.json" in output |
There was a problem hiding this comment.
This is reached when the active CSV is empty or missing. The semantics are: "if the active CSV is absent but the output JSON exists, consider it a pass." This silent degradation is not documented and may mask real failures. If the active CSV is expected to always be present, this should be return False or at minimum accompanied by a log warning.
There was a problem hiding this comment.
if the CSV is missing or empty, the test now logs an error and fails.
Added tests to validate AIU-SMI observability and Acelyzer trace analysis functionality on Spyre AIU devices during inferencing. Features: - Creates a containerized VLLM environment - Starts continuous inference in the background - Captures aiu-smi metrics continuously for a specified duration - Validates that metrics are successfully captured and contain expected data - Integrates Acelyzer (aiu-trace-analyzer) for post-processing JSON trace files - Generates FLEX timing traces during inference workloads - Analyzes traces with enhanced statistics for performance analysis - Validates trace generation and successful acelyzer processing Test Methods: 1. test_aiu_smi_root 2. test_trace_analyzer_root 3. test_aiu_smi_nonroot 4. test_trace_analyzer_nonroot Signed-off-by: Sai Janani C <jananic@linux.ibm.com>
b1ea413 to
04ada28
Compare
|
Logs: |
Added tests to validate AIU-SMI observability
functionality on Spyre AIU devices during
inferencing.
Features: