pytorch/torch/_dynamo
Mark Saroufim 37c85cf5f2 Add warning if tensor cores are not used (#88844)
Fixes https://github.com/pytorch/torchdynamo/issues/1839

Should I do this for all backends or just inductor?

## Test
On a V100 I got from AWS

```python
from torch._dynamo import optimize
import torch

def fn(x, y):
    a = torch.cos(x)
    b = torch.sin(y)
    return a + b

new_fn = optimize("inductor")(fn)

a = new_fn(torch.Tensor(1),torch.Tensor(1))
print(a)
```

## New logs
```
(sourcetorch) ubuntu@ip-172-31-31-152:~/test$ python test.py
/home/ubuntu/pytorch/torch/_dynamo/eval_frame.py:318: UserWarning: Tensor cores are available but not enabled. Consider setting torch.backends.cuda.matmul.allow_tf32 == True in your python script for speedups
  warnings.warn(
tensor([1.3717])
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/88844
Approved by: https://github.com/ngimel, https://github.com/mlazos, https://github.com/anijain2305
2022-11-17 07:24:58 +00:00
..
optimizations [dynamo] Port all pytorch/dynamo and test/dynamo pieces over from symbolic-shapes branch (#88768) 2022-11-13 04:50:21 +00:00
variables [Dynamo] Support typing.Mapping & Support function as argument (#88963) 2022-11-17 06:57:42 +00:00
__init__.py [dynamo][reland] API Support for nn.Module (#89113) 2022-11-17 02:03:48 +00:00
allowed_functions.py Graph-break on FSDP in dynamo (#87420) 2022-10-25 17:07:44 +00:00
bytecode_analysis.py Fix line numbers bug (#87247) 2022-10-19 22:44:01 +00:00
bytecode_transformation.py Fix line numbers bug (#87247) 2022-10-19 22:44:01 +00:00
codegen.py [dynamo] Port all pytorch/dynamo and test/dynamo pieces over from symbolic-shapes branch (#88768) 2022-11-13 04:50:21 +00:00
config.py Revert "Rewrite assert statement with torch._assert under config (#88246)" 2022-11-16 09:45:49 +00:00
convert_frame.py [reland][dynamo] fixes dict changed during runtime error (#88877) 2022-11-13 16:20:45 +00:00
debug_utils.py [dynamo][reland] API Support for nn.Module (#89113) 2022-11-17 02:03:48 +00:00
eval_frame.py Add warning if tensor cores are not used (#88844) 2022-11-17 07:24:58 +00:00
exc.py Fix all references to torchdynamo from the merge (#87731) 2022-10-31 06:51:07 +00:00
guards.py [dynamo] Port all pytorch/dynamo and test/dynamo pieces over from symbolic-shapes branch (#88768) 2022-11-13 04:50:21 +00:00
logging.py Fix CODE level usage in dynamo config.py (#87522) 2022-10-25 22:47:54 +00:00
mutation_guard.py
output_graph.py Don't iterate over graph when adding graph input (#89084) 2022-11-16 00:08:34 +00:00
profiler.py
replay_record.py
resume_execution.py
side_effects.py
skipfiles.py Graph-break on FSDP in dynamo (#87420) 2022-10-25 17:07:44 +00:00
source.py
symbolic_convert.py Revert "Rewrite assert statement with torch._assert under config (#88246)" 2022-11-16 09:45:49 +00:00
test_case.py [dynamo] Unify raise_on_* config to suppress_errors and raise by default (#87440) 2022-10-21 17:03:29 +00:00
test_minifier_common.py Add comprehensive minifier tests (#88022) 2022-11-17 02:02:29 +00:00
testing.py [dynamo][benchmarks] HF - Fix seq len and batch sizes (#89165) 2022-11-17 06:14:24 +00:00
utils.py [Dynamo] Support typing.Mapping & Support function as argument (#88963) 2022-11-17 06:57:42 +00:00