     (if (< 0 cnt)
       (with-release [sum-kernel (function modl "vector_sum")
                      sum-reduction-kernel (function modl "sum_reduction")
-                     cu-acc (mem-alloc (* (.entryWidth da) (count-blocks block-dim cnt)))]
+                     cu-acc (mem-alloc (* (.entryWidth da) (blocks-count block-dim cnt)))]
         (launch-reduce! hstream sum-kernel sum-reduction-kernel
                         [(.buffer x) (.offset x) (.stride x) cu-acc] [cu-acc] cnt block-dim)
         (first (memcpy-host! cu-acc (.wrapPrim da 0.0) hstream)))

        wgs-sd 32
        wgs-fd 32
        wgs 1024
        grid-dim-x (count-blocks wgs-sd cnt-sd)
        grid-dim-y (count-blocks wgs-fd cnt-fd)
        acc-count (* grid-dim-x grid-dim-y)]
    (if (< 0 (.dim a))
      (with-release [sum-kernel (function modl "ge_sum")

        wgs-sd 32
        wgs-fd 32
        wgs 1024
        grid-dim-x (blocks-count wgs-sd cnt-sd)
        grid-dim-y (blocks-count wgs-fd cnt-fd)
        acc-count (* grid-dim-x grid-dim-y)]
    (if (< 0 (.dim a))
      (with-release [sum-kernel (function modl sum-kernel-name)
