This is a mini-framework for querying parameters of an Apple-designed GPU. It also contains a command-line tool, gpuinfo, which reports information similarly to clinfo. It was co-authored with an AI.
Future devices treated like the closest existing analog (e.g. A17 like A16)
Usage
One way to use this library is from the command-line:
git clone https://github.com/philipturner/applegpuinfo
cd applegpuinfo
swift run gpuinfo list
# Sample output
GPU name: Apple M1 Max
GPU vendor: Apple
GPU core count: 32
GPU clock frequency: 1.296 GHz
GPU bandwidth: 409.6 GB/s
GPU FLOPS: 10.617 TFLOPS
GPU IPS: 5.308 TIPS
GPU system level cache: 48 MB
GPU memory: 32 GB
GPU family: Apple 7
You can also use it directly from Swift:
// Inside package manifest
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/philipturner/applegpuinfo", branch: "main"),
],
// Inside source code
import AppleGPUInfo
let device = try GPUInfoDevice()
print(device.flops)
print(device.bandwidth)
Methodology
Original Goal: In one hour, finish a mini-package and command-line tool for querying Apple GPU device parameters.
Results: I spent 57 minutes finishing the file that wraps the AppleGPUDevice structure. I asked GPT-4 to generate the tests and command-line tool. I renamed the command-line tool from applegpuinfo to gpuinfo according to the AI’s suggestion. Finally, I congratulated it and asked for it to leave a comment to users on the README. That triggered a safeguard and it quit the conversation. The stop time was 1 hour, 25 minutes.
After creating the first release of the library, I have continued experimenting with workflows accelerated by free access to GPT-4. The above document details these subsequent modifications to the library.
Testing
This framework is confirmed to work on the following devices. If anyone wishes to contribute to this list, please paste the output of gpuinfo into a new GitHub issue. Different variations of the same chip (e.g. different cores or memory) are welcome.
Production Year
Chip
Cores
SLC
Memory
Bandwidth
TFLOPS
2017
A10X
12
0 MB
4 GB
68.2 GB/s
0.768
2021
A15
5
32 MB
5.49 GB
34.1 GB/s
1.713
2021
M1 Pro
16
24 MB
32 GB
204.8 GB/s
5.308
2021
M1 Max
32
48 MB
32 GB
409.6 GB/s
10.617
2022
M1 Ultra
48
96 MB
64 GB
819.2 GB/s
15.925
2023
M2 Pro
19
24 MB
16 GB
204.8 GB/s
6.800
2023
M2 Pro
19
24 MB
32 GB
204.8 GB/s
6.800
gpuinfo runs on macOS. On iOS, you need to create an Xcode project.
Go to File > New > Project > iOS > App.
Click Next, ensure the interface is SwiftUI, and give the project a name. Click Next > Create.
Apple GPU Info
This is a mini-framework for querying parameters of an Apple-designed GPU. It also contains a command-line tool,
gpuinfo
, which reports information similarly to clinfo. It was co-authored with an AI.Features
Listed parameters:
Interfaces:
Recognized devices:
Usage
One way to use this library is from the command-line:
You can also use it directly from Swift:
Methodology
Original Goal: In one hour, finish a mini-package and command-line tool for querying Apple GPU device parameters.
Results: I spent 57 minutes finishing the file that wraps the
AppleGPUDevice
structure. I asked GPT-4 to generate the tests and command-line tool. I renamed the command-line tool fromapplegpuinfo
togpuinfo
according to the AI’s suggestion. Finally, I congratulated it and asked for it to leave a comment to users on the README. That triggered a safeguard and it quit the conversation. The stop time was 1 hour, 25 minutes.Documentation of AI contributions: bing-conversation.md
After creating the first release of the library, I have continued experimenting with workflows accelerated by free access to GPT-4. The above document details these subsequent modifications to the library.
Testing
This framework is confirmed to work on the following devices. If anyone wishes to contribute to this list, please paste the output of
gpuinfo
into a new GitHub issue. Different variations of the same chip (e.g. different cores or memory) are welcome.gpuinfo
runs on macOS. On iOS, you need to create an Xcode project.ContentView.swift
with the demonstration below.Cmd + R
and look for text in the Xcode console.iOS Demonstration
Attribution
This project was made possible by GPT-4, accessed through Bing Chat.