87 return make_unique<HIPRTDevice>(info, stats, profiler, headless);
89 return make_unique<HIPDevice>(info, stats, profiler, headless);
90#elif defined(WITH_HIP)
91 return make_unique<HIPDevice>(info, stats, profiler, headless);
98 LOG(FATAL) <<
"Request to create HIP device without compiled-in support. Should never happen.";
129 hipError_t
result = device_hip_safe_init();
130 if (
result != hipSuccess) {
131 if (
result != hipErrorNoDevice) {
132 fprintf(stderr,
"HIP hipInit: %s\n", hipewErrorString(
result));
139 if (
result != hipSuccess) {
140 fprintf(stderr,
"HIP hipGetDeviceCount: %s\n", hipewErrorString(
result));
145 const bool has_hardware_raytracing = hiprtewInit();
147 const bool has_hardware_raytracing =
false;
155 result = hipDeviceGetName(name, 256,
num);
156 if (
result != hipSuccess) {
157 fprintf(stderr,
"HIP :hipDeviceGetName: %s\n", hipewErrorString(
result));
161 if (!hipSupportsDevice(
num)) {
180 if (
num != peer_num) {
181 if (hipSupportsDevice(peer_num)) {
183 hipDeviceCanAccessPeer(&can_access,
num, peer_num);
192 int pci_location[3] = {0, 0, 0};
193 hipDeviceGetAttribute(&pci_location[0], hipDeviceAttributePciDomainID,
num);
194 hipDeviceGetAttribute(&pci_location[1], hipDeviceAttributePciBusId,
num);
195 hipDeviceGetAttribute(&pci_location[2], hipDeviceAttributePciDeviceId,
num);
198 (
unsigned int)pci_location[0],
199 (
unsigned int)pci_location[1],
200 (
unsigned int)pci_location[2]);
203# if defined(WITH_OPENIMAGEDENOISE)
206# if OIDN_VERSION >= 20300
207 if (hipSupportsDeviceOIDN(
num) && oidnIsHIPDeviceSupported(
num)) {
209 if (hipSupportsDeviceOIDN(
num) && OIDNDenoiserGPU::is_device_supported(info)) {
218 int timeout_attr = 0;
219 hipDeviceGetAttribute(&timeout_attr, hipDeviceAttributeKernelExecTimeout,
num);
222 VLOG_INFO <<
"Device is recognized as display.";
225 display_devices.push_back(info);
228 VLOG_INFO <<
"Device has compute preemption or is not used for display.";
229 devices.push_back(info);
235 VLOG_INFO <<
"Device with id \"" << info.
id <<
"\" supports "
240 if (!display_devices.empty()) {
241 devices.insert(devices.end(), display_devices.begin(), display_devices.end());
251 hipError_t
result = device_hip_safe_init();
252 if (
result != hipSuccess) {
253 if (
result != hipErrorNoDevice) {
254 return string(
"Error initializing HIP: ") + hipewErrorString(
result);
256 return "No HIP device found\n";
261 if (
result != hipSuccess) {
262 return string(
"Error getting devices: ") + hipewErrorString(
result);
268 if (hipDeviceGetName(name, 256,
num) != hipSuccess) {
271 capabilities += string(
"\t") + name +
"\n";
273# define GET_ATTR(attr) \
275 if (hipDeviceGetAttribute(&value, hipDeviceAttribute##attr, num) == hipSuccess) { \
276 capabilities += string_printf("\t\thipDeviceAttribute" #attr "\t\t\t%d\n", value); \
283 GET_ATTR(MaxThreadsPerBlock);
284 GET_ATTR(MaxBlockDimX);
285 GET_ATTR(MaxBlockDimY);
286 GET_ATTR(MaxBlockDimZ);
287 GET_ATTR(MaxGridDimX);
288 GET_ATTR(MaxGridDimY);
289 GET_ATTR(MaxGridDimZ);
290 GET_ATTR(MaxSharedMemoryPerBlock);
291 GET_ATTR(TotalConstantMemory);
294 GET_ATTR(MaxRegistersPerBlock);
296 GET_ATTR(TextureAlignment);
297 GET_ATTR(MultiprocessorCount);
298 GET_ATTR(KernelExecTimeout);
299 GET_ATTR(Integrated);
300 GET_ATTR(CanMapHostMemory);
301 GET_ATTR(ComputeMode);
302 GET_ATTR(MaxTexture1DWidth);
303 GET_ATTR(MaxTexture2DWidth);
304 GET_ATTR(MaxTexture2DHeight);
305 GET_ATTR(MaxTexture3DWidth);
306 GET_ATTR(MaxTexture3DHeight);
307 GET_ATTR(MaxTexture3DDepth);
308 GET_ATTR(ConcurrentKernels);
309 GET_ATTR(EccEnabled);
310 GET_ATTR(MemoryClockRate);
311 GET_ATTR(MemoryBusWidth);
312 GET_ATTR(L2CacheSize);
313 GET_ATTR(MaxThreadsPerMultiProcessor);
314 GET_ATTR(ComputeCapabilityMajor);
315 GET_ATTR(ComputeCapabilityMinor);
316 GET_ATTR(MaxSharedMemoryPerMultiprocessor);
317 GET_ATTR(ManagedMemory);
318 GET_ATTR(IsMultiGpuBoard);
320 capabilities +=
"\n";