ThePhD / infoware

C++ Library for pulling system and hardware information, without hitting the command line.
Creative Commons Zero v1.0 Universal
410 stars 84 forks source link

GPU/GC abstraction #2

Open ThePhD opened 8 years ago

ThePhD commented 8 years ago

We need a way of finding out all relevant GPU information. This issue will be for what should theoretically be in there.

ThePhD commented 8 years ago

IDXGIAdapter::GetDesc from D3D11. https://cgit.freedesktop.org/mesa/demos/tree/src/xdemos/glxinfo.c, basically fucking around with OpenGL.

I might as well do OpenGL first and then D3D11 afterwards, just to verify a few extra bits of information...

ThePhD commented 8 years ago

So, Using OpenGL/OpenCL/D3D is only ever going to be a half-assed way of handling this. It's never going to give us all the information we need, just things like "and hey, this is how capable your DirectX Card is"/""this is how capable your OpenGL card is".

We might want to relegate DirectX capabilities of a GPU device to either OpenGL / DirectX, and depending on INFOWARE_USE_D3D/OPENGL/OPENCL fill out separate sub-structures that describe the capabilities specific to that device for that specific API.

nabijaczleweli commented 8 years ago

ENOPARSE Half-assed way of handling what? What while doing things like [...]?

We don't have any DX caps as of now (and your comment is the only mention of DX here) so we can't relegate them.

captainwong commented 6 years ago

FYI the GPU memory size is incorrect for my 8GiB RX580 Series card, it just shows 3Gib.

nabijaczleweli commented 6 years ago

Which detector (D3D/OCL/OGL)?

nabijaczleweli commented 5 years ago

@captainwong ping

nabijaczleweli commented 4 years ago

The following patch adds (max) GPU clock speed via OpenCL. Problem is, despite purportedly an API existing for that on Winblows, I couldn't find it.

diff --git a/include/infoware/gpu.hpp b/include/infoware/gpu.hpp
index c77a300..fa88b01 100644
--- a/include/infoware/gpu.hpp
+++ b/include/infoware/gpu.hpp
@@ -34,6 +34,7 @@ namespace iware {
            std::string name;
            std::size_t memory_size;
            std::size_t cache_size;
+           std::uint64_t max_frequency;
        };

diff --git a/src/gpu/memory/OpenCL.cpp b/src/gpu/memory/OpenCL.cpp
index c1a4d6c..9ab9d55 100644
--- a/src/gpu/memory/OpenCL.cpp
+++ b/src/gpu/memory/OpenCL.cpp
@@ -51,13 +51,15 @@ std::vector<iware::gpu::device_properties_t> iware::gpu::device_properties() {
            char vendorname[256];
            cl_ulong cache;
            cl_ulong memory;
+           cl_uint max_frequency;

            clGetDeviceInfo(devices[j], CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, sizeof(cache), &cache, nullptr);
+           clGetDeviceInfo(devices[j], CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof(max_frequency), &max_frequency, nullptr);
            clGetDeviceInfo(devices[j], CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(memory), &memory, nullptr);
            clGetDeviceInfo(devices[j], CL_DEVICE_VENDOR, sizeof(vendorname) / sizeof(*vendorname), &vendorname, nullptr);
            clGetDeviceInfo(devices[j], CL_DEVICE_NAME, sizeof(name) / sizeof(*name), &name, nullptr);

-           ret.push_back({parse_vendor(vendorname), name, memory, cache});
+           ret.push_back({parse_vendor(vendorname), name, memory, cache, max_frequency});
        }
    }

diff --git a/src/gpu/memory/d3d.cpp b/src/gpu/memory/d3d.cpp
index e7933c3..95178dc 100644
--- a/src/gpu/memory/d3d.cpp
+++ b/src/gpu/memory/d3d.cpp
@@ -57,7 +57,7 @@ std::vector<iware::gpu::device_properties_t> iware::gpu::device_properties() {
        auto device             = iware::detail::identify_device(adapterdesc.VendorId, adapterdesc.DeviceId);
        std::string device_name = device.device_name ? device.device_name : iware::detail::narrowen_winstring(adapterdesc.Description);

-       devices.push_back({vendor_from_name(device.vendor_name), device_name, adapterdesc.DedicatedVideoMemory, adapterdesc.SharedSystemMemory});
+       devices.push_back({vendor_from_name(device.vendor_name), device_name, adapterdesc.DedicatedVideoMemory, adapterdesc.SharedSystemMemory, 0});
    }
    return devices;
 }
nabijaczleweli commented 4 years ago

https://github.com/ROCm-Developer-Tools/HIP?

clinfo

nabijaczleweli commented 4 years ago

Played around with HIP – it's a whole thing and beyond the scope of me being able to build it (at least at this current moment).