@brief Compute density map. @param pos cell locations, array of x locations and then y locations @param node_size_x_tensor cell width array @param node_size_y_tensor cell height array @param bin_center_x_tensor bin center x locations @param bin_center_y_tensor bin center y locations @param initial_density_map initial density map @param xl left boundary @param yl bottom boundary @param xh right bou
| 112 | /// @param num_filler_nodes number of filler cells |
| 113 | /// @return density map |
| 114 | at::Tensor density_map_forward(at::Tensor pos, at::Tensor node_size_x, |
| 115 | at::Tensor node_size_y, at::Tensor bin_center_x, |
| 116 | at::Tensor bin_center_y, |
| 117 | at::Tensor initial_density_map, double xl, |
| 118 | double yl, double xh, double yh, |
| 119 | double bin_size_x, double bin_size_y, |
| 120 | int num_movable_nodes, int num_filler_nodes) { |
| 121 | CHECK_FLAT_CPU(pos); |
| 122 | CHECK_EVEN(pos); |
| 123 | CHECK_CONTIGUOUS(pos); |
| 124 | |
| 125 | int num_bins_x = int(ceil((xh - xl) / bin_size_x)); |
| 126 | int num_bins_y = int(ceil((yh - yl) / bin_size_y)); |
| 127 | at::Tensor density_map = initial_density_map.clone(); |
| 128 | |
| 129 | DREAMPLACE_DISPATCH_FLOATING_TYPES( |
| 130 | pos, "computeDensityMapLauncher", [&] { |
| 131 | computeDensityMapLauncher<scalar_t>( |
| 132 | DREAMPLACE_TENSOR_DATA_PTR(pos, scalar_t), |
| 133 | DREAMPLACE_TENSOR_DATA_PTR(pos, scalar_t) + pos.numel() / 2, |
| 134 | DREAMPLACE_TENSOR_DATA_PTR(node_size_x, scalar_t), |
| 135 | DREAMPLACE_TENSOR_DATA_PTR(node_size_y, scalar_t), |
| 136 | DREAMPLACE_TENSOR_DATA_PTR(bin_center_x, scalar_t), |
| 137 | DREAMPLACE_TENSOR_DATA_PTR(bin_center_y, scalar_t), |
| 138 | num_movable_nodes, // only compute that for movable cells |
| 139 | num_bins_x, num_bins_y, xl, yl, xh, yh, bin_size_x, bin_size_y, |
| 140 | at::get_num_threads(), |
| 141 | DREAMPLACE_TENSOR_DATA_PTR(density_map, scalar_t)); |
| 142 | }); |
| 143 | if (num_filler_nodes) { |
| 144 | DREAMPLACE_DISPATCH_FLOATING_TYPES( |
| 145 | pos, "computeDensityMapLauncher", [&] { |
| 146 | computeDensityMapLauncher<scalar_t>( |
| 147 | DREAMPLACE_TENSOR_DATA_PTR(pos, scalar_t) + pos.numel() / 2 - |
| 148 | num_filler_nodes, |
| 149 | DREAMPLACE_TENSOR_DATA_PTR(pos, scalar_t) + pos.numel() - |
| 150 | num_filler_nodes, |
| 151 | DREAMPLACE_TENSOR_DATA_PTR(node_size_x, scalar_t) + |
| 152 | pos.numel() / 2 - num_filler_nodes, |
| 153 | DREAMPLACE_TENSOR_DATA_PTR(node_size_y, scalar_t) + |
| 154 | pos.numel() / 2 - num_filler_nodes, |
| 155 | DREAMPLACE_TENSOR_DATA_PTR(bin_center_x, scalar_t), |
| 156 | DREAMPLACE_TENSOR_DATA_PTR(bin_center_y, scalar_t), |
| 157 | num_filler_nodes, // only compute that for movable cells |
| 158 | num_bins_x, num_bins_y, xl, yl, xh, yh, bin_size_x, bin_size_y, |
| 159 | at::get_num_threads(), |
| 160 | DREAMPLACE_TENSOR_DATA_PTR(density_map, scalar_t)); |
| 161 | }); |
| 162 | } |
| 163 | |
| 164 | return density_map; |
| 165 | } |
| 166 | |
| 167 | /// @brief Compute the density overflow for fixed cells. |
| 168 | /// This map can be used as the initial density map since it only needs to be |
nothing calls this directly
no outgoing calls
no test coverage detected