anchor.diff:              let maxAllocationBits_ = getInfo OpenCL.Net.DeviceInfo.MaxMemAllocSize
   
               // todo: type size
  -            let maxAllocatedBitsForVar = maxMatrixSize * maxMatrixSize * 32 * ntsCount
  +            let realMaxMatrixSize = 
  +                match options.Cuda with
  +                | Some {MinMatrixSize = size} -> size / 2
  +                | None -> maxMatrixSize
  +            let maxMaxMatricesCount = maxMatrixSize / realMaxMatrixSize
  +            let maxAllocatedBitsForVar = maxMaxMatricesCount * realMaxMatrixSize * realMaxMatrixSize * 32 * ntsCount
   
               let maxAllocationBits = 
                   match maxAllocationBits_ with
  
positive.code:             }
  
          let createCudaHelper cudaOptions =   
              {
                  worker = Worker.Default
                  options = cudaOptions
              }
  
          let helpers = {
              _1DBrahma = 
                  match options._1DBrahma with 
                  | Some options -> Some (Options.map (newCreateBrahmaHelper options.MinMatrixSize) options)
                  | None -> None
              Brahma = Option.map (Options.map createBrahmaHelper) options.Brahma
              Cuda = Option.map (Options.map createCudaHelper) options.Cuda
  
negative.code:             let localLinesRestriction = 
                  match localMem with
                      // todo:
                      | Some size -> size / (32 * realMaxMatrixSize)
                      | None -> 32 * (1 <<< 20) / (32 * realMaxMatrixSize)
                                                  
              // todo: sizes
              let gridSize = maxMatrixSize
              let wgSize = min (floorToPowerOf2 wgSizeRestriction) (min (floorToPowerOf2 localLinesRestriction) <| min 128 (floorToPowerOf2 gridSize))
              let grid = new _1D(gridSize, wgSize)
  
              let mult1 = Array.create bufferSize <| Probability.InnerType.zero
  