1 /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #include "tensorflow/compiler/xla/service/gpu/gpu_device_info.h" 17 18 namespace xla { 19 namespace gpu { 20 GetGpuDeviceInfo(stream_executor::StreamExecutor * stream_exec)21GpuDeviceInfo GetGpuDeviceInfo(stream_executor::StreamExecutor* stream_exec) { 22 GpuDeviceInfo gpu_device_info; 23 gpu_device_info.threads_per_block_limit = 24 stream_exec->GetDeviceDescription().threads_per_block_limit(); 25 gpu_device_info.threads_per_warp = 26 stream_exec->GetDeviceDescription().threads_per_warp(); 27 gpu_device_info.shared_memory_per_block = 28 stream_exec->GetDeviceDescription().shared_memory_per_block(); 29 gpu_device_info.threads_per_core_limit = 30 stream_exec->GetDeviceDescription().threads_per_core_limit(); 31 gpu_device_info.core_count = stream_exec->GetDeviceDescription().core_count(); 32 gpu_device_info.block_dim_limit_x = 33 stream_exec->GetDeviceDescription().block_dim_limit().x; 34 gpu_device_info.block_dim_limit_y = 35 stream_exec->GetDeviceDescription().block_dim_limit().y; 36 gpu_device_info.block_dim_limit_z = 37 stream_exec->GetDeviceDescription().block_dim_limit().z; 38 return gpu_device_info; 39 } 40 41 } // namespace gpu 42 } // namespace xla 43