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

Method VlogOccupancyInfo

tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:542–579  ·  view source on GitHub ↗

This is a non-essential operation; if there's a failure, proceed without logging an error. It's nearly certain that in case of failures, we'd never get here in the first place; these are very low-impact routines.

Source from the content-addressed store, hash-verified

540// logging an error. It's nearly certain that in case of failures, we'd never
541// get here in the first place; these are very low-impact routines.
542void GpuExecutor::VlogOccupancyInfo(const KernelBase& kernel,
543 const ThreadDim& thread_dims,
544 const BlockDim& block_dims) {
545 VLOG(2) << "Computing kernel occupancy for kernel "
546 << kernel.demangled_name();
547 VLOG(2) << "Thread dimensions (" << thread_dims.x << ", " << thread_dims.y
548 << ", " << thread_dims.z << ")";
549
550 int regs_per_thread;
551 if (!kernel.metadata().registers_per_thread(&regs_per_thread)) {
552 return;
553 }
554
555 int smem_per_block;
556 if (!kernel.metadata().shared_memory_bytes(&smem_per_block)) {
557 return;
558 }
559
560 const DeviceDescription &device_description =
561 kernel.parent()->GetDeviceDescription();
562
563 const GpuKernel* cuda_kernel = AsGpuKernel(&kernel);
564 CUfunction cufunc = cuda_kernel->AsGpuFunctionHandle();
565
566 int blocks_per_sm = CalculateOccupancy(device_description, regs_per_thread,
567 smem_per_block, thread_dims, cufunc);
568 VLOG(2) << "Resident blocks per SM is " << blocks_per_sm;
569
570 int suggested_threads =
571 CompareOccupancy(&blocks_per_sm, device_description, regs_per_thread,
572 smem_per_block, thread_dims, cufunc);
573 if (suggested_threads != 0) {
574 VLOG(2) << "The cuda occupancy calculator recommends using "
575 << suggested_threads
576 << " threads per block to achieve an occupancy of " << blocks_per_sm
577 << " blocks per SM.";
578 }
579}
580
581// Compute and return maximum blocks per core (occupancy) based on the
582// device description, some kernel characteristics and the number of threads per

Callers

nothing calls this directly

Calls 6

AsGpuKernelFunction · 0.85
registers_per_threadMethod · 0.80
metadataMethod · 0.80
shared_memory_bytesMethod · 0.80
AsGpuFunctionHandleMethod · 0.80
parentMethod · 0.45

Tested by

no test coverage detected