Right, but the fastest available should be constrained by the available memory. So if you decrease the allowed memory, benchmark=True should never surpass it:
  

      github.com
  

  
    pytorch/pytorch/blob/d52ebf2b1bcf96a3e24e03ea86b59c8cf4a06307/aten/src/ATen/native/cudnn/Conv_v7.cpp#L205



      
      
          size_t getMaxWorkspaceSize(
              const ConvolutionArgs& args,
              const algo_t *algo, int n_algo)
          {
            size_t max_ws_size = 0;
            size_t max_block_size = 0;
            size_t tmp_bytes = 0;  // Only used for filling pointer parameters that aren't used later
          
          
  int device;
            THCudaCheck(cudaGetDevice(&device));
            c10::cuda::CUDACachingAllocator::cacheInfo(device, &tmp_bytes, &max_block_size);
          
          
  for (int i = 0; i < n_algo; i++) {
              cudnnStatus_t err;
              size_t sz;
              err = getWorkspaceSize(args, algo[i], &sz);
              if (CUDNN_STATUS_SUCCESS != err || sz == 0 || sz < max_ws_size || sz > max_block_size)
                continue;
              max_ws_size = sz;
            }
            return max_ws_size;