77 return new HIPRTDevice(info, stats, profiler, headless);
79 return new HIPDevice(info, stats, profiler, headless);
80#elif defined(WITH_HIP)
81 return new HIPDevice(info, stats, profiler, headless);
88 LOG(FATAL) <<
"Request to create HIP device without compiled-in support. Should never happen.";
119 hipError_t result = device_hip_safe_init();
120 if (result != hipSuccess) {
121 if (result != hipErrorNoDevice)
122 fprintf(stderr,
"HIP hipInit: %s\n", hipewErrorString(result));
127 result = hipGetDeviceCount(&
count);
128 if (result != hipSuccess) {
129 fprintf(stderr,
"HIP hipGetDeviceCount: %s\n", hipewErrorString(result));
134 const bool has_hardware_raytracing = hiprtewInit();
136 const bool has_hardware_raytracing =
false;
141 for (
int num = 0; num <
count; num++) {
144 result = hipDeviceGetName(name, 256, num);
145 if (result != hipSuccess) {
146 fprintf(stderr,
"HIP :hipDeviceGetName: %s\n", hipewErrorString(result));
150 if (!hipSupportsDevice(num)) {
166 if (num != peer_num) {
168 hipDeviceCanAccessPeer(&can_access, num, peer_num);
175 int pci_location[3] = {0, 0, 0};
176 hipDeviceGetAttribute(&pci_location[0], hipDeviceAttributePciDomainID, num);
177 hipDeviceGetAttribute(&pci_location[1], hipDeviceAttributePciBusId, num);
178 hipDeviceGetAttribute(&pci_location[2], hipDeviceAttributePciDeviceId, num);
181 (
unsigned int)pci_location[0],
182 (
unsigned int)pci_location[1],
183 (
unsigned int)pci_location[2]);
186# if defined(WITH_OPENIMAGEDENOISE)
189# if OIDN_VERSION >= 20300
190 if (hipSupportsDeviceOIDN(num) && oidnIsHIPDeviceSupported(num)) {
192 if (hipSupportsDeviceOIDN(num) && OIDNDenoiserGPU::is_device_supported(info)) {
201 int timeout_attr = 0;
202 hipDeviceGetAttribute(&timeout_attr, hipDeviceAttributeKernelExecTimeout, num);
205 VLOG_INFO <<
"Device is recognized as display.";
208 display_devices.push_back(info);
211 VLOG_INFO <<
"Device has compute preemption or is not used for display.";
212 devices.push_back(info);
218 VLOG_INFO <<
"Device with id \"" << info.
id <<
"\" supports "
222 if (!display_devices.empty())
223 devices.insert(devices.end(), display_devices.begin(), display_devices.end());
232 hipError_t result = device_hip_safe_init();
233 if (result != hipSuccess) {
234 if (result != hipErrorNoDevice) {
235 return string(
"Error initializing HIP: ") + hipewErrorString(result);
237 return "No HIP device found\n";
241 result = hipGetDeviceCount(&
count);
242 if (result != hipSuccess) {
243 return string(
"Error getting devices: ") + hipewErrorString(result);
246 string capabilities =
"";
247 for (
int num = 0; num <
count; num++) {
249 if (hipDeviceGetName(name, 256, num) != hipSuccess) {
252 capabilities += string(
"\t") + name +
"\n";
254# define GET_ATTR(attr) \
256 if (hipDeviceGetAttribute(&value, hipDeviceAttribute##attr, num) == hipSuccess) { \
257 capabilities += string_printf("\t\thipDeviceAttribute" #attr "\t\t\t%d\n", value); \
264 GET_ATTR(MaxThreadsPerBlock);
265 GET_ATTR(MaxBlockDimX);
266 GET_ATTR(MaxBlockDimY);
267 GET_ATTR(MaxBlockDimZ);
268 GET_ATTR(MaxGridDimX);
269 GET_ATTR(MaxGridDimY);
270 GET_ATTR(MaxGridDimZ);
271 GET_ATTR(MaxSharedMemoryPerBlock);
272 GET_ATTR(TotalConstantMemory);
275 GET_ATTR(MaxRegistersPerBlock);
277 GET_ATTR(TextureAlignment);
278 GET_ATTR(MultiprocessorCount);
279 GET_ATTR(KernelExecTimeout);
280 GET_ATTR(Integrated);
281 GET_ATTR(CanMapHostMemory);
282 GET_ATTR(ComputeMode);
283 GET_ATTR(MaxTexture1DWidth);
284 GET_ATTR(MaxTexture2DWidth);
285 GET_ATTR(MaxTexture2DHeight);
286 GET_ATTR(MaxTexture3DWidth);
287 GET_ATTR(MaxTexture3DHeight);
288 GET_ATTR(MaxTexture3DDepth);
289 GET_ATTR(ConcurrentKernels);
290 GET_ATTR(EccEnabled);
291 GET_ATTR(MemoryClockRate);
292 GET_ATTR(MemoryBusWidth);
293 GET_ATTR(L2CacheSize);
294 GET_ATTR(MaxThreadsPerMultiProcessor);
295 GET_ATTR(ComputeCapabilityMajor);
296 GET_ATTR(ComputeCapabilityMinor);
297 GET_ATTR(MaxSharedMemoryPerMultiprocessor);
298 GET_ATTR(ManagedMemory);
299 GET_ATTR(IsMultiGpuBoard);
301 capabilities +=
"\n";