using global memory for scratch (p, bounds)