-
Notifications
You must be signed in to change notification settings - Fork 68
Enable Python EVT Compute UT #650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enables Epilogue Visitor Tree (EVT) Python unit tests for Intel XPU devices (PVC/Xe12 and BMG/Xe20) by adding device detection, platform-specific implementations, and adapting test infrastructure to work with both CUDA and SYCL backends.
Key changes:
- Add Intel Xe12 (PVC) and Xe20 (BMG) support to EVT backend with new node implementations and emitters
- Update device detection to differentiate between BMG (CC=20) and PVC (CC=12) Intel GPUs
- Modify test infrastructure to support XPU tensors and dynamic device selection (CUDA/XPU/CPU)
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
test/python/cutlass/evt/utils/evt_testbed.py |
Adds dynamic device selection for PyTorch tensors (CUDA/XPU/CPU) |
test/python/cutlass/evt/evt_store_sm80_90.py |
Extends test CC support to include Intel Xe12 (12) and Xe20 (20) |
test/python/cutlass/evt/evt_mixed_sm80_90.py |
Extends test CC support to include Intel Xe12 (12) and Xe20 (20) |
test/python/cutlass/evt/evt_load_sm80_90.py |
Extends test CC support to include Intel Xe12 (12) and Xe20 (20) |
test/python/cutlass/evt/evt_layout_sm80_90.py |
Extends test CC support to include Intel Xe12 (12) and Xe20 (20) |
test/python/cutlass/evt/evt_compute_sm80_90.py |
Extends test CC support to include Intel Xe12 (12) and Xe20 (20) |
python/cutlass_cppgen/backend/utils/device.py |
Adds BMG device detection logic to return CC=20 for Battlemage GPUs |
python/cutlass_cppgen/backend/operation.py |
Replaces CUDA-specific return value with generic success code (0) |
python/cutlass_cppgen/backend/gemm_operation.py |
Updates architecture checks and error handling for XPU compatibility |
python/cutlass_cppgen/backend/frontend.py |
Fixes XPU tensor detection and device pointer handling logic |
python/cutlass_cppgen/backend/evt/passes/pass_manager.py |
Adds Xe-specific function name resolution based on device availability |
python/cutlass_cppgen/backend/evt/passes/pass_get_impl.py |
Adds Xe-prefix support for node implementation lookup |
python/cutlass_cppgen/backend/evt/passes/pass_argument_type.py |
Adds xe12/xe20 argument type handling methods |
python/cutlass_cppgen/backend/evt/frontend/frontend_base.py |
Updates CC checks to include Intel Xe12/Xe20 architectures |
python/cutlass_cppgen/backend/evt/epilogue.py |
Adds Xe emitter selection and updates CC checks |
python/cutlass_cppgen/backend/evt/backend/xe20_nodes.py |
New file implementing Xe20-specific EVT node types |
python/cutlass_cppgen/backend/evt/backend/xe20_emitter.py |
New file implementing Xe20 epilogue emitter |
python/cutlass_cppgen/backend/evt/backend/xe12_nodes.py |
New file implementing Xe12-specific EVT node types |
python/cutlass_cppgen/backend/evt/backend/xe12_emitter.py |
New file implementing Xe12 epilogue emitter |
python/cutlass_cppgen/backend/evt/backend/__init__.py |
Registers new Xe12 and Xe20 emitters and nodes |
python/cutlass_cppgen/backend/compiler.py |
Changes default SYCL target from PVC to BMG |
python/cutlass_cppgen/backend/arguments.py |
Adds comprehensive XPU support with device pointer handling |
Co-authored-by: Copilot <[email protected]>
| @@ -0,0 +1,98 @@ | |||
| ################################################################################################### | |||
| # Copyright (c) 2024 - 2024 Codeplay Software Ltd. All rights reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove code play copyright
|
|
||
|
|
||
| class Xe12Emitter: | ||
| def __init__(self, operation: GemmOperationUniversal, graph) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot comment make sense Why cc=90?
| self.nvcc() | ||
| try: | ||
| cc = device_cc() | ||
| if cc in [12, 20]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the constants here ?https://github.com/intel/sycl-tla/blob/main/python/cutlass_library/arch_constants.py
instead hard coding values. It would be easier to track later.
| @unittest.skipIf(device_cc() not in [12, 20, 80, 86, 89, 90], "This unittest is only supported on CC [12, 20, 80, 86, 89, 90]") | ||
| class TestEVTStore(EVTTestCaseBase): | ||
|
|
||
| @unittest.skipIf(device_cc() != 90, "This test is only for CC 90") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is skipping for anything other than cc=90
| return self._type_decl | ||
|
|
||
| self._type_decl = f""" | ||
| using {self.name_camel} = cutlass::epilogue::fusion::Sm90Compute< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain this line for fusion:sm90compute. Is that overridden for xe for just calling to provide a default support.
| from typing import Any | ||
|
|
||
| import networkx as nx | ||
| import torch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we importing torch in cutlass code? Could you please explain?
| def ensures(self) -> None: | ||
| # Some nodes will be lowered to NoOp, eliminate them | ||
| self.no_op_elimination() | ||
| if torch.xpu.is_available(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Torch imported just for this function?
Antonyvance
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistakenly approved. Need explanation for the comments.
This PR depends on #647