zhuhaozhe / pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration
https://pytorch.org
Other
0 stars 1 forks source link

Options for FP32 precsion #7

Open zhuhaozhe opened 5 months ago

zhuhaozhe commented 5 months ago

Flag Names

Option1: set_float32_precision + (highest, high, medium)

Option2: allow_+data_type, e.g., allow_tf32. And easier to extend with newer dtypes.

How/Where place flags

Option1: Only 1 flag set_fp32_precision under torch.* for all operators (conv,matmul,lstm) and all backends (CUDA, CUDNN, MKLDNN). Do not allow backend-specific flags.

Option2: Layering structure. All these flags should have an Optional[bool (or enum value from highest, high, medium)] type such that whenever a level is not specified, it uses the parent value image

Option3: 3 flags set_fp32_conv/rnn/matmul_precision under torch.* for all backends. Allow backends to have backend-specific flags and setting backend-specific flags will also change the backend irrelevant flags.