mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
trigger tracing for MTIA events (#102288)
Summary: trigger tracing for MTIA events on python side when ProfilerActivity.MTIA is specified
Test Plan:
Test diff: D45437426
```
hg graft D45437426
```
- in one terminal
```
cd ~/fbsource/fbcode
buck2 run -j 8 \
//infra_asic_fpga/firmware/tools/mad/service:mad_service
```
- in another terminal
Pytorch profiler
```
buck run mode/dev-nosan -j 8 //caffe2/torch/fb/acc_runtime/afg/tests:test_afg -- -m kernel_add
```
Differential Revision: D46122853
Pull Request resolved: https://github.com/pytorch/pytorch/pull/102288
Approved by: https://github.com/aaronenyeshi
This commit is contained in:
parent
2c2e4d5228
commit
f1f57e1e54
3 changed files with 6 additions and 0 deletions
|
|
@ -37,6 +37,7 @@ class ActiveProfilerType(Enum):
|
|||
class ProfilerActivity(Enum):
|
||||
CPU = ...
|
||||
CUDA = ...
|
||||
MTIA = ...
|
||||
|
||||
class _EventType(Enum):
|
||||
TorchOp = ...
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ class profile:
|
|||
with_modules=False,
|
||||
use_kineto=False,
|
||||
use_cpu=True,
|
||||
use_mtia=False,
|
||||
experimental_config=None):
|
||||
self.enabled: bool = enabled
|
||||
if not self.enabled:
|
||||
|
|
@ -194,6 +195,7 @@ class profile:
|
|||
self.with_stack = with_stack
|
||||
self.with_modules = with_modules
|
||||
self.use_cpu = use_cpu
|
||||
self.use_mtia = use_mtia
|
||||
if experimental_config is None:
|
||||
experimental_config = _ExperimentalConfig()
|
||||
self.experimental_config = experimental_config
|
||||
|
|
@ -210,6 +212,8 @@ class profile:
|
|||
self.kineto_activities = set()
|
||||
if self.use_cpu:
|
||||
self.kineto_activities.add(ProfilerActivity.CPU)
|
||||
if self.use_mtia:
|
||||
self.kineto_activities.add(ProfilerActivity.MTIA)
|
||||
|
||||
self.profiler_kind = ProfilerState.KINETO
|
||||
if self.use_cuda:
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ class _KinetoProfile:
|
|||
self.profiler = prof.profile(
|
||||
use_cuda=(ProfilerActivity.CUDA in self.activities),
|
||||
use_cpu=(ProfilerActivity.CPU in self.activities),
|
||||
use_mtia=(ProfilerActivity.MTIA in self.activities),
|
||||
record_shapes=self.record_shapes,
|
||||
with_flops=self.with_flops,
|
||||
profile_memory=self.profile_memory,
|
||||
|
|
|
|||
Loading…
Reference in a new issue