Skip to content

feat: lower Flow GPU SPIR-V to Metal - #759

Merged
godofecht merged 8 commits into
mainfrom
feature/spirv-metal-lowering
Aug 24, 2026
Merged

godofecht merged 8 commits into
mainfrom
feature/spirv-metal-lowering

Conversation

@godofecht

@godofecht godofecht commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Adds a shared Flow GPU pipeline for Apple targets:

Flow @gpu -> MLIR GPU -> SPIR-V -> SPIRV-Cross -> MSL -> metallib

This keeps SPIR-V as the portable GPU artifact instead of maintaining Metal as an entirely separate lowering path. The existing direct AST-to-MSL backend is left intact for compatibility.

The PR adds SPIRV-Cross and Xcode tool discovery to MLIRSPIRVCompiler, exposes SPIR-V-to-MSL, MLIR-to-MSL, MSL-to-metallib, and MLIR-to-metallib stages, adds a scripts/compile_spirv_metal.py driver for .flow or .spv inputs, and adds unit coverage for the new lowering stages.

It also fixes the stale photoreal shader anchors already present on main, which were blocking the repository's doc-link check.

@godofecht
godofecht merged commit 94be06e into main Aug 24, 2026
25 checks passed

Copy link
Copy Markdown
Contributor Author

Follow-up ABI result from the OpenProjects SPIR-V→Metal investigation: the remaining correctness boundary is not byte translation but preservation of descriptor identity and storage semantics. A binding-only map is unsound because (set=0,binding=3) and (set=2,binding=3) collide. For classic MSL, deterministic dense lexicographic ranks should be assigned independently per admitted buffer/texture/sampler namespace; rejected resources must not consume slots. Conservative first-profile storage mapping is Uniform buffer→constant, StorageBuffer→device, Workgroup→threadgroup, Function/Private→thread-local, UniformConstant texture/sampler→resource object, while PhysicalStorageBuffer should fail closed until Flow owns a physical-pointer ABI. I exhaustively checked per-kind mapping injectivity and declaration-order invariance across 7,140 compact interfaces. Full derivation + Flow witness: https://github.com/godofecht/OpenProjects/blob/main/gpu/spirv-metal-address-space-and-binding-contract.md

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.

1 participant