Commit f508cba3 authored by Tim Shen's avatar Tim Shen Committed by TensorFlower Gardener
Browse files

Refactor AlgorithmDesc and AlgorithmConfig.

The DNN library communicates to the caller with algorithm information in
3 ways:
(a) The caller asks DNN, for a list of available algorithms.
(b) When calling a convolution/RNN, the caller asks the DNN library for a suggestion
    of an algorithm. This also includes the case that the caller just wants one
    specific algorithm.
(c) The response of (b), sent from the DNN library back to the caller,
    including which algorithm is picked, and how much scratch space is used.

For (a), the data is (algo_id, tensor_ops_enabled).
For (b), the data is (optional (algo_id, tensor_ops_enabled), optional (algo_id, tensor_ops_enable) with no scratch).
For (c), the data is (selected (algo_id, tensor_ops_enabled), the actual scratch size).

Ideally we can have separate data structures for (a), (b) and (c), e.g.
AlgorithmDesc for (a), AlgorithmConfig for (b), and ProfileResult for
(c).

Currently, the scratch size is in AlgorithmDesc, and the optionality is
in AlgorithmDesc as well.

This patch moves scratch size to ProfileResult, and optionality to
AlgorithmConfig.

Historically, PR20708 first tried to add the scratch size to AlgorithmConfig,
but that's not the right place (as explained above). The scratch size ended up
in AlgorithmDesc, because I was concerned that changing ProfileResult was too much
work (I asked for a TODO for it, but I didn't find it in the current code).
Now hopefully all bits are moved to right places.

PiperOrigin-RevId: 219359118
parent 15d50e38
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment