MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetGpu2DLaunchConfig

Function GetGpu2DLaunchConfig

tensorflow/core/util/gpu_launch_config.h:253–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251CREATE_CUDA_TYPE_ALIAS(Gpu2DLaunchConfig, Cuda2DLaunchConfig);
252
253inline Gpu2DLaunchConfig GetGpu2DLaunchConfig(int xdim, int ydim,
254 const Eigen::GpuDevice& d) {
255 Gpu2DLaunchConfig config;
256
257 if (xdim <= 0 || ydim <= 0) {
258 return config;
259 }
260
261 const int kThreadsPerBlock = 256;
262 int block_cols = std::min(xdim, kThreadsPerBlock);
263 // ok to round down here and just do more loops in the kernel
264 int block_rows = std::max(kThreadsPerBlock / block_cols, 1);
265
266 const int physical_thread_count =
267 d.getNumGpuMultiProcessors() * d.maxGpuThreadsPerMultiProcessor();
268
269 const int max_blocks = std::max(physical_thread_count / kThreadsPerBlock, 1);
270
271 config.virtual_thread_count = dim3(xdim, ydim, 1);
272 config.thread_per_block = dim3(block_cols, block_rows, 1);
273
274 int grid_x = std::min(DivUp(xdim, block_cols), max_blocks);
275
276 config.block_count = dim3(
277 grid_x, std::min(max_blocks / grid_x, std::max(ydim / block_rows, 1)), 1);
278 return config;
279}
280#ifndef TENSORFLOW_USE_ROCM
281inline Cuda2DLaunchConfig GetCuda2DLaunchConfig(int xdim, int ydim,
282 const Eigen::GpuDevice& d) {

Callers 9

ConcatGPUImplFunction · 0.85
RunMethod · 0.85
DoNMSBatchedFunction · 0.85
SortScoresFunction · 0.85
ComputeMethod · 0.85
RunSVDMethod · 0.85
GetCuda2DLaunchConfigFunction · 0.85

Calls 4

DivUpFunction · 0.85
GetGpu3DLaunchConfigFunction · 0.85
minFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected