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

Function IsDeviceSupported

tensorflow/compiler/xla/service/platform_util.cc:130–162  ·  view source on GitHub ↗

Returns whether the device underlying the given StreamExecutor is supported by XLA.

Source from the content-addressed store, hash-verified

128// Returns whether the device underlying the given StreamExecutor is supported
129// by XLA.
130static bool IsDeviceSupported(se::StreamExecutor* executor) {
131 const auto& description = executor->GetDeviceDescription();
132 if (executor->platform()->id() == se::cuda::kCudaPlatformId) {
133 // CUDA devices must have a minimum compute capability.
134 int major_version, minor_version;
135 if (description.cuda_compute_capability(&major_version, &minor_version)) {
136 if (major_version < kMinCudaComputeCapabilityMajor ||
137 (major_version == kMinCudaComputeCapabilityMajor &&
138 minor_version < kMinCudaComputeCapabilityMinor)) {
139 LOG(INFO) << "StreamExecutor cuda device ("
140 << executor->device_ordinal() << ") is of "
141 << "insufficient compute capability: "
142 << kMinCudaComputeCapabilityMajor << "."
143 << kMinCudaComputeCapabilityMinor << " required, "
144 << "device is " << major_version << "." << minor_version;
145 return false;
146 }
147 }
148 } else if (executor->platform()->id() == se::rocm::kROCmPlatformId) {
149 int isa_version = 0;
150 if (description.rocm_amdgpu_isa_version(&isa_version)) {
151 if (isa_version < kMinAMDGPUISAVersion) {
152 LOG(INFO) << "StreamExecutor ROCM device ("
153 << executor->device_ordinal() << ") is of "
154 << "obsolete AMDGPU ISA version: "
155 << "gfx" << kMinAMDGPUISAVersion << " required, "
156 << "device is gfx" << isa_version;
157 return false;
158 }
159 }
160 }
161 return true;
162}
163
164/* static */ StatusOr<std::vector<se::StreamExecutor*>>
165PlatformUtil::GetStreamExecutors(

Callers 1

GetStreamExecutorsMethod · 0.85

Calls 5

idMethod · 0.45
platformMethod · 0.45
device_ordinalMethod · 0.45

Tested by

no test coverage detected