Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU/GC abstraction #2

Open
4 of 6 tasks
ThePhD opened this issue May 31, 2016 · 9 comments
Open
4 of 6 tasks

GPU/GC abstraction #2

ThePhD opened this issue May 31, 2016 · 9 comments

Comments

@ThePhD
Copy link
Owner

ThePhD commented May 31, 2016

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

  • Vendor
  • Name / ID information
  • Thread count (WARPs or max workgroups or whatever)
  • OpenGL / D3D / Vulkan, or at least supported version?
  • Memory (size in bytes)
  • Clock Speed
@ThePhD ThePhD added this to the Information.Basic milestone May 31, 2016
@nabijaczleweli nabijaczleweli changed the title gpu abstraction GPU/GC abstraction Jun 1, 2016
@ThePhD
Copy link
Owner Author

ThePhD commented Jun 1, 2016

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...

nabijaczleweli added a commit that referenced this issue Jun 6, 2016
OpenGL is literal hell on earth, I cri everytiem

Ref: #2
@ThePhD
Copy link
Owner Author

ThePhD commented Jun 16, 2016

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
Copy link
Collaborator

nabijaczleweli commented Jun 16, 2016

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
Copy link

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

@nabijaczleweli
Copy link
Collaborator

Which detector (D3D/OCL/OGL)?

@nabijaczleweli
Copy link
Collaborator

@captainwong ping

@nabijaczleweli
Copy link
Collaborator

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
Copy link
Collaborator

nabijaczleweli commented Oct 17, 2019

@nabijaczleweli
Copy link
Collaborator

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).

nabijaczleweli added a commit that referenced this issue Oct 18, 2019
Functional on OpenCL, dead on D3D because I couldn't find the API that
supposedly exists for that

Ref: #2
nabijaczleweli added a commit that referenced this issue Oct 18, 2019
Functional on OpenCL, dead on D3D because I couldn't find the API that
supposedly exists for that

Ref: #2
nabijaczleweli added a commit that referenced this issue Mar 20, 2024
==> tarta <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : Unknown
      Name         : llvmpipe (LLVM 15.0.6, 128 bits)
      RAM size     : 2147483648B
      Cache size   : 0B
      Max frequency: 0Hz

==> chrust <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : Intel
      Name         : Intel(R) UHD Graphics 600 (GLK 2)
      RAM size     : 1986174976B
      Cache size   : 0B
      Max frequency: 0Hz
    Device #2:
      Vendor       : Unknown
      Name         : llvmpipe (LLVM 17.0.6, 128 bits)
      RAM size     : 3972349952B
      Cache size   : 0B
      Max frequency: 0Hz

==> nabuter <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : AMD
      Name         : AMD Radeon RX 5700 XT
      RAM size     : 16866344960B
      Cache size   : 0B
      Max frequency: 0Hz

==> rozbian <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : AMD
      Name         : AMD Radeon RX 6500 XT (RADV NAVI24)
      RAM size     : 37947559936B
      Cache size   : 0B
      Max frequency: 0Hz
    Device #2:
      Vendor       : Unknown
      Name         : llvmpipe (LLVM 17.0.6, 256 bits)
      RAM size     : 67338743808B
      Cache size   : 0B
      Max frequency: 0Hz

==> babtop <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : Intel
      Name         : Intel(R) UHD Graphics (AML-CFL)
      RAM size     : 12505884672B
      Cache size   : 0B
      Max frequency: 0Hz
    Device #2:
      Vendor       : Unknown
      Name         : llvmpipe (LLVM 16.0.6, 256 bits)
      RAM size     : 16674512896B
      Cache size   : 0B
      Max frequency: 0Hz
nabijaczleweli added a commit that referenced this issue Mar 20, 2024
==> tarta <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : Unknown
      Name         : llvmpipe (LLVM 15.0.6, 128 bits)
      RAM size     : 2147483648B
      Cache size   : 0B
      Max frequency: 0Hz

==> chrust <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : Intel
      Name         : Intel(R) UHD Graphics 600 (GLK 2)
      RAM size     : 1986174976B
      Cache size   : 0B
      Max frequency: 0Hz
    Device #2:
      Vendor       : Unknown
      Name         : llvmpipe (LLVM 17.0.6, 128 bits)
      RAM size     : 3972349952B
      Cache size   : 0B
      Max frequency: 0Hz

==> nabuter <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : AMD
      Name         : AMD Radeon RX 5700 XT
      RAM size     : 16866344960B
      Cache size   : 0B
      Max frequency: 0Hz

==> rozbian <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : AMD
      Name         : AMD Radeon RX 6500 XT (RADV NAVI24)
      RAM size     : 37947559936B
      Cache size   : 0B
      Max frequency: 0Hz
    Device #2:
      Vendor       : Unknown
      Name         : llvmpipe (LLVM 17.0.6, 256 bits)
      RAM size     : 67338743808B
      Cache size   : 0B
      Max frequency: 0Hz

==> babtop <==
Infoware version 0.6.0

  Properties:
    Device #1:
      Vendor       : Intel
      Name         : Intel(R) UHD Graphics (AML-CFL)
      RAM size     : 12505884672B
      Cache size   : 0B
      Max frequency: 0Hz
    Device #2:
      Vendor       : Unknown
      Name         : llvmpipe (LLVM 16.0.6, 256 bits)
      RAM size     : 16674512896B
      Cache size   : 0B
      Max frequency: 0Hz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants