block and grid dimentions automatic optimal generation added