NOTE(mrry): The default allocator for a Tensor (when none is specified) is the default CPU allocator for NUMA zone 0. Accessing that currently involves acquiring a lock, which guards initialization of the per-NUMA zone allocators, and becomes highly contended. Note also that it would be better if all Tensor allocations required the user to specify an allocator, for purposes of accounting, etc. Ho
| 848 | // to specify an allocator, for purposes of accounting, etc. However, the |
| 849 | // default allocator is widely used throughout the codebase and in client code. |
| 850 | static Allocator* get_default_cpu_allocator() { |
| 851 | static Allocator* default_cpu_allocator = |
| 852 | cpu_allocator(port::kNUMANoAffinity); |
| 853 | return default_cpu_allocator; |
| 854 | } |
| 855 | |
| 856 | Tensor::Tensor(DataType type, const TensorShape& shape) |
| 857 | : Tensor(get_default_cpu_allocator(), type, shape) {} |
no test coverage detected