Due to legacy issues in user code, we can't currently call InpectNumaNodes at module initialization time, because non-GPU programs still include this plugin via various methods, so instead, it has to be init-on-reference.
| 36 | // at module initialization time, because non-GPU programs still include this |
| 37 | // plugin via various methods, so instead, it has to be init-on-reference. |
| 38 | void ROCmPlatform::InspectNumaNodes() { |
| 39 | // To get NUMA node information, we need to create all executors, so we can |
| 40 | // examine their device descriptions to see their bus assignments. |
| 41 | std::once_flag once; |
| 42 | std::call_once(once, [&] { |
| 43 | StreamExecutorConfig config; |
| 44 | for (int i = 0; i < VisibleDeviceCount(); i++) { |
| 45 | config.ordinal = i; |
| 46 | StreamExecutor* exec = GetExecutor(config).ValueOrDie(); |
| 47 | if (i == 0) { |
| 48 | // NUMA nodes may not start at 0, so set the minimum node based on the |
| 49 | // first executor we see. |
| 50 | min_numa_node_ = exec->GetDeviceDescription().numa_node(); |
| 51 | limit_numa_node_ = min_numa_node_ + 1; |
| 52 | } else { |
| 53 | min_numa_node_ = |
| 54 | std::min(min_numa_node_, exec->GetDeviceDescription().numa_node()); |
| 55 | limit_numa_node_ = std::max( |
| 56 | limit_numa_node_, exec->GetDeviceDescription().numa_node() + 1); |
| 57 | } |
| 58 | } |
| 59 | }); |
| 60 | } |
| 61 | |
| 62 | int ROCmPlatform::BusCount() { |
| 63 | InspectNumaNodes(); |
nothing calls this directly
no test coverage detected