Skip to content

Add Metal compute driver skeleton for macOS GPU compute#91

Open
Sukuna0007Abhi wants to merge 1 commit intolibmir:masterfrom
Sukuna0007Abhi:metal-driver-skeleton
Open

Add Metal compute driver skeleton for macOS GPU compute#91
Sukuna0007Abhi wants to merge 1 commit intolibmir:masterfrom
Sukuna0007Abhi:metal-driver-skeleton

Conversation

@Sukuna0007Abhi
Copy link
Copy Markdown

This adds an initial skeleton for a Metal compute driver, following the
same structure as the existing dcompute.driver.cuda module.

What this adds:

  • Metal300 variant to the Backend enum in backend.d
  • metal/package.d — module entry point (version(OSX) gated)
  • metal/device.dMetalDevice struct wrapping MTLDevice
  • metal/buffer.dMetalBuffer!T typed GPU buffer with storage modes
  • metal/queue.dMetalQueue for command submission and kernel dispatch
  • metal/program.d.metallib file loading via MTLLibrary

All implementations are stubbed out with TODO comments — the actual
extern(Objective-C) calls will be wired up using the Inochi2D/metal-d
bindings once the LDC compiler backend (targetMetal.cpp) is in place.

This is part of my GSoC 2026 proposal for the DCompute Metal Backend project.
I'd appreciate any early feedback on the structure and API design.

Related: ldc-developers/ldc#4958 (Vulkan backend, same pattern)

…ogram)

Adds a new metal/ driver module mirroring the existing cuda/ structure.

- Add Metal300 to Backend enum in backend.d

- Add metal/package.d with version(OSX) gate

- Add metal/device.d wrapping MTLDevice queries

- Add metal/buffer.d with typed MetalBuffer!T and storage modes

- Add metal/queue.d for command queue and compute dispatch

- Add metal/program.d for loading .metallib files

All implementations are stubbed; extern(Objective-C) wiring via Inochi2D/metal-d will follow once LDC compiler backend is ready.
@thewilsonator
Copy link
Copy Markdown
Collaborator

There is a bunch of compiler work that needs to be before this

@Sukuna0007Abhi
Copy link
Copy Markdown
Author

Sukuna0007Abhi commented Mar 31, 2026

There is a bunch of compiler work that needs to be before this

Sure, will continue, actually, I am adding this pr in my proposal and submitting the proposal for the idea DCompute Metal Backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants