[pre_compile] Add check for cuda and hardware version (#162438)

if we detect compiled model is using cuda in meaningful way, we should store information about cuda + hardware

 Example: `SystemInfo(python_version='3.12.9', torch_version='2.9.0a0+gite02b0e6', cuda_version='12.6', triton_version=(3, 4), gpu_name='NVIDIA PG509-210')`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/162438
Approved by: https://github.com/zhxchen17
This commit is contained in:
Shangdi Yu
2025-09-12 01:42:03 +00:00
committed by PyTorch MergeBot
parent ae97eb86f7
commit ccb450b190
5 changed files with 155 additions and 15 deletions

View File

@ -1264,6 +1264,7 @@ def _compile(
assert check_fn.guards_state is not None
package.add_guarded_code(check_fn.guards_state, out_code)
package.add_inlined_source(output.tracing_context.traced_code)
package.update_use_cuda(output.current_tracer.graph)
compile_id_str = str(compile_id) if compile_id is not None else "Unknown"
annotation_str = "Torch-Compiled Region: " + compile_id_str