To run DOOM, I implemented a 3D graphics rasterizer that runs on the Apple Neural Engine (ANE). (Core AI + Swift 6)

Hello.

This time, I'd like to introduce an experiment with our rendering pipeline.

By omitting the traditional GPU rasterizer processing and using Apple Silicon's Apple Neural Engine (ANE) as a fixed-function 3D graphics accelerator, we successfully rendered the original DOOM state in real time.

Currently, the frame rate is a terrible 46 FPS, but I believe it will improve if we improve the CPU processing.

We look forward to your opinions and feedback.

Github: https://github.com/kamisori-daijin/Magnesium/tree/ane-doom
(ane-doom Branch)

Demo:

https://reddit.com/link/1vl7vun/video/07319809goih1/player

https://preview.redd.it/p5g7dx6agoih1.png?width=546&format=png&auto=webp&s=8c64ae08dc0567238928e158a932a9eacd3b2a03

reddit.com
u/AdhesivenessSea9511 — 9 days ago
▲ 169 r/macgaming

I successfully forced the Apple Neural Engine (ANE) to function as a 3D graphics accelerator and ran DOOM! (46 FPS, Core AI + Swift 6)

Hello.

I wanted to try hijacking Apple Silicon's deep learning coprocessor to see if I could enjoy retro games, and I've successfully ported DOOM's rendering pipeline to the Apple Neural Engine (ANE) via Swift 6 and Core AI.

Neural Architecture Resolution Analysis: DOOM's live framebuffer outputs at 640x400 and is reshaped into a 256x256 square tensor map by F.interpolate.

Current Performance Bottleneck (Feedback Needed!):

The ANE is running, but CPU usage is around 40% overall. Profiling reveals that a simple CPU-bound texture packing routine is significantly degrading the frame rate.

Because 256,000 pixels are processed one by one using CPU bit shifts and Float16 division, the frame rate remains at 46 FPS.

By offloading this planar ARGB separation process to Apple's Accelerate framework (vImage/vDSP SIMD vector instructions) or a fast Metal compute shader, we aim to break the 60/120 FPS barrier.

We welcome your opinions, ideas, and feedback on how to maximize the gaming performance of the M-series Neural Engine.

Github: https://github.com/kamisori-daijin/Magnesium/tree/ane-doom

(ane-doom branch)

demo:

https://reddit.com/link/1vl7sjz/video/ytezpwhffoih1/player

https://preview.redd.it/h8hyunkgfoih1.png?width=546&format=png&auto=webp&s=43567aed3005176dc52636f99223f752611442fe

func updateTexture(pixelData: [Float16]) { extern var gp_DoomScreenBuffer: UnsafeMutablePointer<UInt32>?

guard let doomPixels = gp_DoomScreenBuffer else { return }

let actualWidth = 640
let actualHeight = 400
let totalPixels = actualWidth * actualHeight

var doomFP16Buffer = [Float16](repeating: 0.0, count: 3 * totalPixels)

let rOffset = 0
let gOffset = totalPixels
let bOffset = totalPixels * 2


for i in 0..<totalPixels {
let argbPixel = doomPixels[i]
doomFP16Buffer[rOffset + i] = Float16((argbPixel >> 16) & 0xFF) / 255.0
doomFP16Buffer[gOffset + i] = Float16((argbPixel >> 8) & 0xFF) / 255.0
doomFP16Buffer[bOffset + i] = Float16(argbPixel & 0xFF) / 255.0
}
var texView = self.rawTextureArray.mutableView(as: Float16.self)
texView.copyElements(fromContentsOf: doomFP16Buffer)
}
reddit.com
u/AdhesivenessSea9511 — 9 days ago
▲ 76 r/swift

DOOM on Apple Neural Engine(ANE) via Core AI!!!!!

[UPDATE]
After staring at the code for a while, I realized that I had simply been taking the DOOM screen—processed by the CPU—and mapping it as a texture onto a rectangle rasterized via ANE. I had mistakenly thought DOOM was outputting vertex data. How embarrassing... 😂 

I plan to try again later with a proper 3D game that actually uses vertex data. 

Hello everyone.

We have successfully ported DOOM's rendering to the Apple Neural Engine (ANE), and have successfully run Apple's AI/deep learning silicon as a 3D graphics accelerator via Swift 6 and Core AI!

CPU usage is high, around 40%, but the ANE is running.

  • DOOM's frame buffer has an original resolution of 640x400 (320x200), but it is converted to 256x256 by a custom texture model and then transferred to a 64-channel ANE rasterizer model.

  • Apparently

    func updateTexture(pixelData: [Float16]) {

    guard let doomPixels = gp_DoomScreenBuffer else { return }

    let actualWidth = 640 let actualHeight = 400 let totalPixels = actualWidth * actualHeight

    var doomFP16Buffer = [Float16](repeating: 0.0, count: 3 * totalPixels)

    let rOffset = 0 let gOffset = totalPixels let bOffset = totalPixels * 2

    for i in 0..<totalPixels { let argbPixel = doomPixels[i] doomFP16Buffer[rOffset + i] = Float16((argbPixel >> 16) & 0xFF) / 255.0 doomFP16Buffer[gOffset + i] = Float16((argbPixel >> 8) & 0xFF) / 255.0 doomFP16Buffer[bOffset + i] = Float16(argbPixel & 0xFF) / 255.0 }

    var texView = self.rawTextureArray.mutableView(as: Float16.self) texView.copyElements(fromContentsOf: doomFP16Buffer) }

This function seems to be increasing CPU usage.

We welcome your comments and feedback!

GitHub: https://github.com/kamisori-daijin/Magnesium/tree/ane-doom

(ane-doom Branch)

Demo:

https://i.redd.it/mvb9rrr5eoih1.gif

https://preview.redd.it/uljd9gs7eoih1.png?width=546&format=png&auto=webp&s=a6e60cc6938bd71c7330585c38c4bf386a9fd827

reddit.com
u/AdhesivenessSea9511 — 9 days ago

We've implemented a custom 3D rasterizer that runs on the Apple Neural Engine. It supports multi-instance rendering and perspective-corrected centroid texturing!

Hello everyone.

This is a 3D graphics pipeline running on the Apple Neural Engine (ANE).

As you can see from the screenshot, this pipeline performs multi-instance rendering of independent 3D meshes with Z-depth occlusion testing.

The geometry engine packs the transformations into a single [1, 4, 4, 1, 64] tensor.

This represents 64 independent MVP matrices.

The vertices are structured in a flat channel layout.

By performing a fused torch.sum broadcast element-wise matrix multiplication, the ANE simultaneously performs multiple transformations on 64 unique coordinate spaces.

The spatial depth inversion maps the coordinates by replacing the division denominator in the clipping space with the spatial distance channel . The 3D geometry engine outputs the 3-vertex inverse depth gradient via tensor blocks .

The rasterizer then constructs a depth gradient across the entire face grid to perform overlap occlusion testing.

The ANE hardware flushes the raw plane data (R, G, B, and mask channels arranged sequentially as separate sheets) directly into an `MTLBuffer` allocated on the heap. The metal fragment shader directly samples these planes using byte offsets based on the layout stride to achieve the final rendering on the GPU screen.

// Direct plane scanning within the metal fragment shader
uint componentStride = 64 * width * height;
uint rIndex = (componentStride * 0) + pixelIndex;
uint gIndex = (componentStride * 1) + pixelIndex;
uint bIndex = (componentStride * 2) + pixelIndex;
  • Due to the active intermediate tensor lifecycle, memory usage is currently high at approximately 1.6GB, and CPU usage is approximately 15% (acting as a memory controller pushing buffers).

We'd love to hear your thoughts on using NPU/AI accelerators for fixed-function graphics computations!

Github: https://github.com/kamisori-daijin/Magnesium

https://reddit.com/link/1vhobrk/video/8v9rwjvc7vhh1/player

https://preview.redd.it/nojdxtxd7vhh1.png?width=562&format=png&auto=webp&s=e26a48192ff21549f270e3a400cb1f9d0a62ce66

reddit.com
u/AdhesivenessSea9511 — 14 days ago
▲ 14 r/swift

We've built a 3D graphics pipeline that runs on Apple Neural Engine (ANE) (Using CoreAI). Full multi-instance 3D rendering is now possible with Swift 6!

Hello developers!

We've finally achieved multi-instance 3D rendering with CoreAI!

This pipeline enables multi-object spatial placement and perspective-corrected texturing!

It directly maps a multiplane tensor stream to a metal buffer (MTLBuffer) allocated on the heap. By using a `MutableRawView` with a strict stride offset, the NPU dumps the R, G, B, and mask sheets directly into the GPU memory layout.

By passing an input matrix tensor layout [1, 4, 4, 1, 64], the engine uses torch.sumto multifire 64 independent MVP matrices in parallel on a single graph, avoiding the latency of structural depth-based graph reconstruction.

The CPU acts as a memory controller (approximately 15% utilization), while the ANE handles the entire graphics computation array.

We'd love to hear your feedback!

Github: https://github.com/kamisori-daijin/Magnesium

Demo:

https://i.redd.it/4ip98fgl5vhh1.gif

https://preview.redd.it/ffc7g4um5vhh1.png?width=562&format=png&auto=webp&s=173cbd37044f8a75ac47a11c414ac62bb1330791

reddit.com
u/AdhesivenessSea9511 — 14 days ago

I hacked Apple's Neural Engine (ANE) and built my own 3D graphics pipeline! I successfully achieved multi-instance 3D rendering!

Hello everyone.

Previously, I posted a very basic demo of rendering a single polygon on the Apple Neural Engine (ANE) using a hack of the Core AI framework.

This time, I've successfully implemented multi-instance rendering and perspective-corrected texturing.

As you can see in the screenshot, using proper depth testing (Z-buffering) and spatial distance calculations, I've successfully rendered two completely independent 3D pyramid instances orbiting each other.

The CPU acts as a controller (usage around 15%), and the ANE flushes the rendered buffer directly to a shared Metal buffer.

I believe other objects besides pyramids can also be rendered.

Please let me know what you think!

Github: https://github.com/kamisori-daijin/Magnesium

demo:

https://preview.redd.it/1nh95dmw3vhh1.png?width=562&format=png&auto=webp&s=cb90b7e0d183db06979216c42ed90b8919cd4a35

https://reddit.com/link/1vhnxk4/video/eebbhrqu3vhh1/player

reddit.com
u/AdhesivenessSea9511 — 14 days ago
▲ 5 r/Cubers

warning: Both the GAN16 ui Maglev MAX and the GAN12 ui SP have serious flaws!

I am a GAN 12ui SP user, and I recently watched a review video for the GAN 16ui Maglev MAX.

To my surprise, it suffers from the exact same critical sensor flaw found in the older 12ui SP model. Specifically, the following bugs occur:

An "Auto-Solve" bug, where the cube is randomly registered as "solved" while being turned, resulting in an impossible time—such as five seconds—being recorded.

(This was resolved for the GAN 12ui SP via a CubeStation update; I am unsure if the same applies to the GAN 16ui.)

Connection errors: The app displays a message stating, "Failed to reset Rubik's Cube. No response notification received."

This issue occurs with the GAN 12ui SP as well; after about 15 solves, synchronization with the screen fails, requiring the cube's state to be manually reset each time.

It is highly likely that this problem also affects the GAN 16ui Maglev MAX.

Incidentally, this issue was also highlighted in a review video by YAMI CUBES (published on July 17, 2026).

Looking at the new ball core in the 16ui, the interior appears completely hollow and feels "flimsy" compared to the older model.

It seems likely that the ball core ended up feeling cheap because GAN prioritized cost-cutting measures.

The GAN 12ui Maglev/Freeplay represented the pinnacle of perfection for GAN's smart cubes.

If you are looking to buy a new smart cube, I would recommend the GAN 12ui FreePlay or Maglev over the 16ui—a $140 device that has essentially become nothing more than a paperweight (a useless ornament).

Until these disastrous hardware and firmware issues are fixed, I suggest avoiding the GAN 16ui to ensure you don't waste your money.

If you are interested in the internal structure, please take a look at this as well:
https://www.reddit.com/r/Cubers/comments/1s2x5d6/why_gan_12_ui_sp_is_standard_precision/

reddit.com
u/AdhesivenessSea9511 — 18 days ago

[Update] Driving the 3D texture engine on Apple Neural Engine (ANE) via Core AI

Hello everyone. This is a continuation of the previous proof-of-concept.

New Features:

  • 3D Texture Mapping: Textures can now be routed to the rasterizer by converting the input with Conv2d.

Known Issues (v3.0.0):

  • CPU Usage: 22%. (Profiling with Instruments shows that NeuralEngine Prediction is fragmented, resulting in host-side synchronization overhead.)
  • Memory Usage: Stable at approximately 1.1GB due to MetalHeap and buffer miniaturization.

We welcome your feedback.

GitHub: https://github.com/kamisori-daijin/Magnesium

Demo:

https://i.redd.it/0nxbtff7hhgh1.gif

https://preview.redd.it/nh666my9hhgh1.png?width=556&format=png&auto=webp&s=89d1026d6cdde6fc9cbce690cada5be661ca01dc

reddit.com
u/AdhesivenessSea9511 — 21 days ago
▲ 2 r/swift

[Update] Successfully rendered textured 3D objects using CoreAI/ANE!

This is a continuation from the previous post.

I successfully added a texture and rendered the pyramid.

I added a new texture model, converted it from RGB using Conv2d, and then fed it to the rasterizer model.

  • Known issues:
  • CPU usage is still high (22%),
  • Checking with Instruments, it appears that NeuralEngine Prediction is fragmented, which is likely causing some part of the model to fall back.
  • memory consumption is around 1.1GB.

Github: https://github.com/kamisori-daijin/Magnesium

Demo:

https://i.redd.it/0jhkapsgehgh1.gif

https://preview.redd.it/5wk7783iehgh1.png?width=556&format=png&auto=webp&s=22b832e9dce14c2db2a7b0e8756fe3620e9d0b02

reddit.com
u/AdhesivenessSea9511 — 21 days ago
▲ 32 r/swift

Abusing the Apple Neural Engine (ANE) in Swift 6: Built a 3D software rasterizer using Core AI, simd, and Metal 4 tensor binding!

Hello everyone.

I’ve built a 3D software rasterizer that leverages the ANE (Apple Neural Engine) via Core AI. The rendering quality is still poor, though. Regarding the pipeline:

I use SIMD for preprocessing, delegate matrix operations to the ANE (using `f.conv2d`), and utilize Metal 4 tensor bindings to achieve low-overhead, direct rendering.

By offloading computationally intensive tasks to the ANE, I’ve managed to reduce CPU usage to approximately 10%.

A current challenge is that memory usage hits around 5GB due to the use of fixed-length graphs.

I’m developing this using Swift 6 features (such as `@MainActor` and `~Escapable`) and Siri AI, but I would love to hear your thoughts on optimization and memory management!

Thanks in advance.

GitHub: https://github.com/kamisori-daijin/Magnesium

Demo:

https://i.redd.it/8ezv5gtklofh1.gif

https://preview.redd.it/sl342vq9lofh1.png?width=578&format=png&auto=webp&s=ebdec2f9914a3e1aa63c7579c1ba0a4b649a966a

reddit.com
u/AdhesivenessSea9511 — 25 days ago

3D rendering is now possible using the CoreAI / Apple Neural Engine (ANE) software rasterizer (CPU usage reduced to 9%). The quality is still terrible.

Here is a follow-up on the triangle rasterizer running on CoreAI that I previously introduced here.

We have finally succeeded in rendering 3D graphics! As shown in the video, we are currently rendering two intersecting vertical triangular planes.

While the rendering quality is still in the early stages and a new challenge regarding the massive 5GB memory footprint has emerged, we have fully achieved real-time operation.

We optimized the codebase by actively reducing reliance on CPU fallbacks and ensuring the pipeline runs entirely on the ANE's matrix operation hardware, successfully cutting CPU usage from the previous 38% to approximately 9%.

Much of the pipeline code—written in Python, Swift, and Metal—was rapidly prototyped and generated with the help of Siri AI.

GitHub: https://github.com/kamisori-daijin/Magnesium

Please feel free to leave comments with any questions or optimization tips (especially regarding that 5GB memory usage!).

https://reddit.com/link/1v6z66k/video/83iqp5iknjfh1/player

https://preview.redd.it/a6mkfncmnjfh1.png?width=578&format=png&auto=webp&s=75148974988a31b7f25d3465b2450b2d614d70dc

reddit.com
u/AdhesivenessSea9511 — 25 days ago

Update: 3D Rendering Now Possible with Software Rasterizer for CoreAI / Apple Neural Engine (ANE)!

Here is an update on the triangle rasterizer running on CoreAI that I previously introduced.

We have finally succeeded in rendering 3D graphics! As shown in the video, we are rendering two triangular faces.

While the rendering quality is still low and the project is a work in progress—and a new challenge has arisen regarding the massive 5GB memory consumption—it is actually running in real-time.

As a side note, the majority of the Python, Swift, and Metal pipeline code was generated using Siri AI. By reducing the reliance on CPU fallbacks, we successfully cut CPU usage from the previous 38% down to approximately 9%.

Please feel free to ask any questions.

GitHub: https://github.com/kamisori-daijin/Magnesium

https://reddit.com/link/1v6z2lp/video/k0sobeg9mjfh1/player

https://preview.redd.it/i3c8t3iamjfh1.png?width=578&format=png&auto=webp&s=13980bf9b52d3e9951ff0720daf8b98dc4d16284

reddit.com
u/AdhesivenessSea9511 — 25 days ago

I built a custom real-time software rasterizer inside Apple's new Core AI framework in Swift 6. It actually works!

Hello everyone! Wanting to try out Apple's newly announced Core AI framework, last week I developed a custom real-time software rasterizer that renders a rotating triangle at 60fps using AI computation. Instead of relying on the traditional graphics pipeline, I mapped the triangle's edge function to a 2D convolution kernel (`f.conv2d`) and used ReLU for pixel masking.

You can see a video of the Core AI rasterizer in action here.

https://reddit.com/link/1uwxz5l/video/vkmgjux7acdh1/player

For those interested in the Swift 6 implementation, please see the open-source code here: https://github.com/kamisori-daijin/Magnesium

Currently, there is some CPU fallback (specifying ComputeUnitKind for the ANE effectively forces the machine learning framework to perform 3D graphics rendering).

We welcome your comments and feedback.

reddit.com
u/AdhesivenessSea9511 — 1 month ago

I built a real-time software rasterizer that runs on the Apple Neural Engine (ANE) using Core AI and Swift 6.

Hello everyone. This past week, I successfully developed a custom software rasterizer that uses the newly announced Core AI framework to offload edge functions/line equations to the Apple Neural Engine via f.conv2d and ReLU operations.

It's a 60FPS rasterizer that draws a red triangle.

The source code can be found here: https://github.com/kamisori-daijin/Magnesium

There are still some issues, such as high CPU usage.

I welcome any feedback or comments.

https://reddit.com/link/1uwve68/video/lvw22toxybdh1/player

reddit.com
u/AdhesivenessSea9511 — 1 month ago

Successfully flashed LineageOS 23 (Android 16) GSI on Redmi Note 10T 5G (lilac) - Full Guide &amp; Critical vbmeta Fix!

My Redmi Note 10T 5G (lilac) was stuck on Android 13, but I successfully got it running Android 16 (LineageOS 23 GSI). Wi-Fi works flawlessly, and the refresh rate reaches a smooth 90Hz.

Here is the exact guide on how I achieved this, especially focusing on how to bypass the common fastboot bootloop issues.

What you'll need

  • A device with the bootloader unlocked
  • A reliable USB cable
  • PC with ADB/Fastboot environment configured
  • Official Fastboot Image (Required to extract stock vbmeta and vbmeta_system)
  • LineageOS GSI (Android 16)
    • Link: https://github.com
    • Download the latest EXT4 version. I used LineageOS-23.2-20260524-GAPPS-EXT4-GSI.7z. (Vanilla is fine, but make sure to choose EXT4).
    • Note: The download redirects to SourceForge. If it's too slow, click the "Problems Downloading?" button to choose a faster mirror.

Flashing Steps

Step 1: Boot into Fastboot

Turn on USB debugging on your device, connect to PC, and run:

adb reboot bootloader

Step 2: Enter Fastbootd

This is crucial. The flash WILL NOT succeed without entering Fastbootd mode:

fastboot reboot fastboot

Step 3: Flash Stock vbmeta & vbmeta_system

Extract the official Fastboot Image you downloaded. Locate vbmeta.img and vbmeta_system.img, then move them to your working directory. Run:

fastboot flash vbmeta --disable-verity --disable-verification vbmeta.img
fastboot flash vbmeta_system --disable-verity --disable-verification vbmeta_system.img

>⚠️ CRITICAL WARNING: Many posts on the internet suggest flashing an empty vbmeta or the one included with Google's GSI. Do NOT do this on this device. Doing so will hard-revert you back to fastboot no matter how many times you flash. (It took me several painful days to figure this out).

Step 4: Make Room for the GSI

There isn't enough system space to flash the GSI, so you need to delete the /product partition. (Note: Make sure you have a stock ROM backup if you ever want to revert).

fastboot erase product

Step 5: Flash LineageOS GSI

Unzip the downloaded .7z file to extract the .img file. Then run:

fastboot erase system
fastboot flash system (your_unzipped_lineageos_filename).img
fastboot -w
fastboot reboot

>⚠️ Don't skip fastboot -w! Junk data left behind will absolutely cause a boot loop.

Verdict & Summary

Switching from bloated MIUI 14 to LineageOS makes this budget device run incredibly smooth. Bumping the OS from Android 13 to 16 really shows the true potential of pure AOSP. It feels like manufacturer skins just ruin the overall Android experience.

Bonus Tip: Install GCam!

You should definitely install GCam. The image quality improves so much you won't believe it's the same camera sensor.

u/AdhesivenessSea9511 — 1 month ago