Unskip tests in test_profiler_xpu.py#3726
Open
PawelSwider2000 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR aims to unskip / broaden profiler tests so they can run on XPU in addition to CUDA by switching several CUDA-specific assumptions to accelerator-agnostic logic.
Changes:
- Generalize Kineto multi-GPU and activity-filter tests to use the current accelerator (CUDA/XPU) rather than hard-coded CUDA paths.
- Relax/adjust kernel metadata expectations in Chrome traces to account for XPU-specific queue metadata.
- Convert event/trace parity tests to run via
instantiate_device_type_testsfor CUDA and XPU.
Comment on lines
+605
to
+623
| @unittest.skipIf( | ||
| _current_accelerator_device_type() is None, | ||
| "An accelerator is required", | ||
| ) | ||
| @unittest.skipIf( | ||
| _current_accelerator_device_type() == "cuda" and not TEST_MULTIGPU, | ||
| "Multiple GPUs needed", | ||
| ) | ||
| @unittest.skipIf( | ||
| _current_accelerator_device_type() == "xpu" and torch.xpu.device_count() < 2, | ||
| "Multiple GPUs needed", | ||
| ) | ||
| def test_kineto_multigpu(self): | ||
| with profile(activities=[ProfilerActivity.CPU, ProfilerActivity.CUDA]) as prof: | ||
| device_type = _current_accelerator_device_type() | ||
| activity = _current_accelerator_activity() | ||
| self.assertIsNotNone(device_type) | ||
| self.assertIsNotNone(activity) | ||
|
|
||
| with profile(activities=[ProfilerActivity.CPU, activity]) as prof: |
| # on ROCm, Gemm shader is hipblaslt Shader, so we use UserArgs_MT to match. | ||
| gemm_string = "userargs_mt" if is_rocm else "gemm" | ||
| device_string = "hip" if is_rocm else "cuda" | ||
| device_enum = getattr(DeviceType, device_type.upper()) |
Comment on lines
+605
to
+616
| @unittest.skipIf( | ||
| _current_accelerator_device_type() is None, | ||
| "An accelerator is required", | ||
| ) | ||
| @unittest.skipIf( | ||
| _current_accelerator_device_type() == "cuda" and not TEST_MULTIGPU, | ||
| "Multiple GPUs needed", | ||
| ) | ||
| @unittest.skipIf( | ||
| _current_accelerator_device_type() == "xpu" and torch.xpu.device_count() < 2, | ||
| "Multiple GPUs needed", | ||
| ) |
Comment on lines
+2949
to
+2955
| @unittest.skipIf(not TEST_CUDA and not TEST_XPU, "CUDA or XPU is required") | ||
| def test_kineto_kernel_metadata_in_trace(self): | ||
| with profile(activities=[ProfilerActivity.CPU, ProfilerActivity.CUDA]) as prof: | ||
| self.payload(use_cuda=True) | ||
| device_type = _current_accelerator_device_type() | ||
| with profile( | ||
| activities=[ProfilerActivity.CPU, _current_accelerator_activity()] | ||
| ) as prof: | ||
| self.payload(device_type=device_type) |
| class TestProfilerEventsParity(TestCase): | ||
| """Tests validating parity between events() and export_chrome_trace() JSON.""" | ||
|
|
||
| def _device_type(self, device): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.