SkillAgentSearch skills...

Applegpuinfo

Print all known information about the GPU on Apple-designed chips

Install / Use

/learn @philipturner/Applegpuinfo
About this skill

Quality Score

0/100

Category

Design

Supported Platforms

Universal

README

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:

  • Name ✅
  • Vendor ✅
  • Core count ✅
  • Clock frequency ✅
  • Bandwidth ✅
  • FLOPS (FP32 operations per second) ✅
  • IPS (shader instructions per second) ✅
  • System-level cache ✅
  • Memory ✅
  • Family ✅

Interfaces:

Recognized devices:

  • A7 - A17 Pro
  • M1 - M2 Ultra
  • M3 - M3 Max
  • M4 - M4 Max (with LPDDR5X-8533 memory support)
  • Future devices treated like the closest existing analog

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

# Sample output (M4 Max)
GPU name: Apple M4 Max
GPU vendor: Apple
GPU core count: 40
GPU clock frequency: 1.38 GHz
GPU bandwidth: 546.0 GB/s
GPU FLOPS: 14.131 TFLOPS
GPU IPS: 14.131 TIPS
GPU system level cache: 48 MB
GPU memory: 128 GB
GPU family: Apple 9

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.

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. Next, paste the last 15 lines generated by the following command. Different variations of the same chip (e.g. different cores or memory) are welcome.

sudo powermetrics --sample-rate 500 --samplers gpu_power

| Production Year | Chip | Cores | SLC | Memory | Bandwidth | TFLOPS | | --------------- | --- | ----- | ------ | ---- | --------- | ------ | | 2017 | A10X | 12 | 0 MB | 4 GB | 68.2 GB/s | 0.768 | | 2020 | A14 | 4 | 16 MB | 5.54 GB | 34.1 GB/s | 0.654 | | 2020 | M1 | 8 | 8 MB | 8 GB | 68.3 GB/s | 2.617 | | 2021 | A15 | 5 | 32 MB | 5.49 GB | 34.1 GB/s | 1.713 | | 2021 | M1 Pro | 14 | 24 MB | 16 GB | 204.8 GB/s | 4.645 | | 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 | | 2022 | M2 | 10 | 8 MB | 16 GB | 102.4 GB/s | 3.579 | | 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 <b>File > New > Project > iOS > App</b>.
  • Click <b>Next</b>, ensure the interface is <b>SwiftUI</b>, and give the project a name. Click <b>Next > Create</b>.
  • Go to <b>File > Add Package Dependencies > Search or Enter Package URL</b>. Type https://github.com/philipturner/applegpuinfo and click <b>Add Package</b>.
  • Select the <b>AppleGPUInfo</b> product of kind <b>Library</b>, then click <b>Add Package</b>.
  • Replace the code in ContentView.swift with the demonstration below.
  • Connect your iOS device to your Mac with a USB cable. Ensure it is targeted in the build destination.
  • Press Cmd + R and look for text in the Xcode console.
  • Paste the console output into a GitHub issue.
<details> <summary>iOS Demonstration</summary>
import AppleGPUInfo
import SwiftUI

struct ContentView: View {
  var body: some View {
    VStack {
      Image(systemName: "globe")
        .imageScale(.large)
        .foregroundStyle(.tint)
      Text({ () -> String in
        logHardwareSpecifications()
        return "Hello, world!"
      }())
    }
    .padding()
  }
}

func logHardwareSpecifications() {
  do {
    // Create an instance of GPUInfoDevice using its initializer
    let error = setenv("GPUINFO_LOG_LEVEL", "1", 1)
    if error != 0 {
      print("'setenv' failed with error code '\(error)'.")
    }
    _ = try GPUInfoDevice()
  } catch {
    // Handle any errors that may occur
    print("Error: \(error.localizedDescription)")
  }
}
</details>

Attribution

This project was made possible by GPT-4, accessed through Bing Chat.

Related Skills

View on GitHub
GitHub Stars98
CategoryDesign
Updated4d ago
Forks17

Languages

Swift

Security Score

95/100

Audited on Apr 5, 2026

No findings