Add Metal compute driver skeleton for macOS GPU compute#91
Open
Sukuna0007Abhi wants to merge 1 commit intolibmir:masterfrom
Open
Add Metal compute driver skeleton for macOS GPU compute#91Sukuna0007Abhi wants to merge 1 commit intolibmir:masterfrom
Sukuna0007Abhi wants to merge 1 commit intolibmir:masterfrom
Conversation
…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.
Collaborator
|
There is a bunch of compiler work that needs to be before this |
Author
Sure, will continue, actually, I am adding this pr in my proposal and submitting the proposal for the idea DCompute Metal Backend |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds an initial skeleton for a Metal compute driver, following the
same structure as the existing
dcompute.driver.cudamodule.What this adds:
Metal300variant to theBackendenum inbackend.dmetal/package.d— module entry point (version(OSX) gated)metal/device.d—MetalDevicestruct wrappingMTLDevicemetal/buffer.d—MetalBuffer!Ttyped GPU buffer with storage modesmetal/queue.d—MetalQueuefor command submission and kernel dispatchmetal/program.d—.metallibfile loading viaMTLLibraryAll implementations are stubbed out with TODO comments — the actual
extern(Objective-C)calls will be wired up using theInochi2D/metal-dbindings 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)