mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/34842 This PR (hopefully the last one of such kind) is merging changes from a side branch where tensor expessions based fuser work has been done so far. This PR is is a squashed version of changes in the side branch, which is available here: https://github.com/bertmaher/pytorch Differential Revision: D20478208 Test Plan: Imported from OSS Pulled By: ZolotukhinM fbshipit-source-id: 21556e009f1fd88099944732edba72ac40e9b9c0
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
from __future__ import absolute_import
|
|
from __future__ import division
|
|
from __future__ import print_function
|
|
from __future__ import unicode_literals
|
|
|
|
import torch
|
|
|
|
|
|
class ExecutionCounter(object):
|
|
def __init__(self, name):
|
|
self.name = name
|
|
self.start_value = torch._C._jit_get_trigger_value(self.name)
|
|
|
|
def elapsed_value(self):
|
|
value = torch._C._jit_get_trigger_value(self.name)
|
|
return value - self.start_value
|
|
|
|
|
|
class CudaCodeGenCreated(ExecutionCounter):
|
|
def __init__(self):
|
|
super(CudaCodeGenCreated, self).__init__("cuda_codegen_created")
|
|
|
|
|
|
class CudaCodeGenExecuted(ExecutionCounter):
|
|
def __init__(self):
|
|
super(CudaCodeGenExecuted, self).__init__("cuda_codegen_executed")
|
|
|
|
|
|
class LLVMCodeGenCreated(ExecutionCounter):
|
|
def __init__(self):
|
|
super(LLVMCodeGenCreated, self).__init__("llvm_codegen_created")
|
|
|
|
|
|
class LLVMCodeGenExecuted(ExecutionCounter):
|
|
def __init__(self):
|
|
super(LLVMCodeGenExecuted, self).__init__("llvm_codegen_executed")
|
|
|
|
|
|
class SimpleIREvalExecuted(ExecutionCounter):
|
|
def __init__(self):
|
|
super(SimpleIREvalExecuted, self).__init__("simple_ir_eval_executed")
|