(
self,
problem_blocks: dim3,
cluster_shape: HyperCube,
hw_info: KernelHardwareInfo,
max_swizzle_size: int,
raster_order_option: "TileParams.RasterOrderOptions",
)
| 47 | ) |
| 48 | |
| 49 | def _initialize( |
| 50 | self, |
| 51 | problem_blocks: dim3, |
| 52 | cluster_shape: HyperCube, |
| 53 | hw_info: KernelHardwareInfo, |
| 54 | max_swizzle_size: int, |
| 55 | raster_order_option: "TileParams.RasterOrderOptions", |
| 56 | ): |
| 57 | log_swizzle_size = self.get_log_swizzle_size( |
| 58 | problem_blocks.x, problem_blocks.y, max_swizzle_size |
| 59 | ) |
| 60 | problem_blocks_m = round_up( |
| 61 | problem_blocks.x, (1 << log_swizzle_size) * cluster_shape[0] |
| 62 | ) |
| 63 | problem_blocks_n = round_up( |
| 64 | problem_blocks.y, (1 << log_swizzle_size) * cluster_shape[1] |
| 65 | ) |
| 66 | |
| 67 | raster_order = self.get_rasterization_order( |
| 68 | problem_blocks_m, problem_blocks_n, raster_order_option |
| 69 | ) |
| 70 | |
| 71 | self.blocks_per_problem = problem_blocks_m * problem_blocks_n * problem_blocks.z |
| 72 | self.log_swizzle_size = log_swizzle_size |
| 73 | self.raster_order = raster_order |
| 74 | |
| 75 | self.divmod_batch = FastDivmodU64(problem_blocks_m * problem_blocks_n) |
| 76 | |
| 77 | if raster_order == TileParams.RasterOrder.AlongN: |
| 78 | self.divmod_cluster_shape_major = FastDivmodU64Pow2(cluster_shape[1]) |
| 79 | self.divmod_cluster_shape_minor = FastDivmodU64Pow2(cluster_shape[0]) |
| 80 | self.divmod_cluster_blk_major = FastDivmodU64( |
| 81 | problem_blocks_n // cluster_shape[1] |
| 82 | ) |
| 83 | |
| 84 | else: |
| 85 | self.divmod_cluster_shape_major = FastDivmodU64Pow2(cluster_shape[0]) |
| 86 | self.divmod_cluster_shape_minor = FastDivmodU64Pow2(cluster_shape[1]) |
| 87 | self.divmod_cluster_blk_major = FastDivmodU64( |
| 88 | problem_blocks_m // cluster_shape[0] |
| 89 | ) |
| 90 | |
| 91 | @staticmethod |
| 92 | def get_grid_shape( |
no test coverage detected