Fix a few ClangTidy warnings

PiperOrigin-RevId: 351354684
Change-Id: Iea6c504399dc0fb2ada5b18c5e708efa4a53028c
This commit is contained in:
Adrian Kuegel 2021-01-12 05:58:40 -08:00 committed by TensorFlower Gardener
parent 49752e0f82
commit 3406ea6e8c
6 changed files with 11 additions and 9 deletions

View File

@ -16,6 +16,9 @@ limitations under the License.
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_GPU_TYPES_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_GPU_TYPES_H_
#include <string>
#include <utility>
#include "absl/types/variant.h"
namespace xla {

View File

@ -808,7 +808,7 @@ Status AMDGPUTargetModuleLinker(llvm::Module* module, GpuVersion gpu_version,
// related changes which have not yet been upstreamed (to the LLVM repo)
// When that upstreaming happens (and TF LLVM pointer moves past the
// upstream commit), the following mapping will need to change
static std::string MapGCNArchNameTokenToFeatureStr(const std::string token) {
std::string MapGCNArchNameTokenToFeatureStr(const std::string& token) {
if (token == "sramecc+") {
return "+sram-ecc";
} else if (token == "sramecc-") {
@ -821,8 +821,7 @@ static std::string MapGCNArchNameTokenToFeatureStr(const std::string token) {
return "";
}
static std::string GetFeatureStrFromGCNArchName(
const std::string gcn_arch_name) {
std::string GetFeatureStrFromGCNArchName(const std::string& gcn_arch_name) {
std::string feature_str;
#if TF_ROCM_VERSION < 30900
@ -859,7 +858,8 @@ std::unique_ptr<llvm::TargetMachine> AMDGPUGetTargetMachine(
int gcn_arch_value = amdgpu_version->first;
std::string gcn_arch_name = amdgpu_version->second;
std::string feature_str = GetFeatureStrFromGCNArchName(gcn_arch_name);
return GetTargetMachine(target_triple, absl::StrCat("gfx", gcn_arch_value),
return GetTargetMachine(std::move(target_triple),
absl::StrCat("gfx", gcn_arch_value),
hlo_module_config, feature_str);
}

View File

@ -53,7 +53,7 @@ class GpuDummyCompiler : public GpuCompiler {
return Status::OK();
}
GpuVersion GetGpuVersion(se::StreamExecutor* stream_exec) {
GpuVersion GetGpuVersion(se::StreamExecutor*) override {
return std::make_pair(0, 0);
}

View File

@ -1388,8 +1388,7 @@ GpuDriver::CreateMemoryHandle(GpuContext* context, uint64 bytes) {
"Feature not supported on CUDA platform (GetGpuISAVersion)"};
}
/* static */ port::Status GpuDriver::GetGpuGCNArchName(
CUdevice device, std::string* gcnArchName) {
/* static */ port::Status GpuDriver::GetGpuGCNArchName(CUdevice, std::string*) {
return port::Status{
port::error::INTERNAL,
"Feature not supported on CUDA platform (GetGpuGCNArchName)"};

View File

@ -96,7 +96,7 @@ std::unique_ptr<std::map<std::string, std::string>> DeviceDescription::ToMap()
result["CUDA Compute Capability"] = absl::StrCat(
cuda_compute_capability_major_, ".", cuda_compute_capability_minor_);
result["AMDGPU GCN Arch Name"] = absl::StrCat(rocm_amdgpu_gcn_arch_name_);
result["AMDGPU GCN Arch Name"] = rocm_amdgpu_gcn_arch_name_;
result["NUMA Node"] = absl::StrCat(numa_node());
result["Core Count"] = absl::StrCat(core_count());

View File

@ -820,7 +820,7 @@ GpuExecutor::CreateDeviceDescription(int device_ordinal) {
return status;
}
string gcn_arch_name;
std::string gcn_arch_name;
status = GpuDriver::GetGpuGCNArchName(device, &gcn_arch_name);
if (!status.ok()) {
return status;