-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[GH:#9202] [Parity] error: unable to spawn process 'metal' (No such file or directory) #9414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rconnell9
wants to merge
5
commits into
swiftlang:main
Choose a base branch
from
rconnell9:rconnell/swb-metal
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f705ed2
SwiftBuild support for invoking metal compiler using xcrun
rconnell9 4b16b17
Revert changes to Package.swift
rconnell9 aee3614
Remove incomplete test fixture
rconnell9 db92134
Revert unnecessary change
rconnell9 f9a4ed9
Verify we can load the metal library
rconnell9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // swift-tools-version: 6.2 | ||
| // The swift-tools-version declares the minimum version of Swift required to build this package. | ||
| import PackageDescription | ||
|
|
||
| let package = Package( | ||
| name: "MyRenderer", | ||
| products: [ | ||
| .library( | ||
| name: "MyRenderer", | ||
| targets: ["MyRenderer"]), | ||
| ], | ||
| targets: [ | ||
| .target( | ||
| name: "MyRenderer", | ||
| dependencies: ["MySharedTypes"]), | ||
|
|
||
| .target(name: "MySharedTypes") | ||
| ] | ||
| ) |
4 changes: 4 additions & 0 deletions
4
Fixtures/Metal/SimpleLibrary/Sources/MyRenderer/Renderer.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import MySharedTypes | ||
|
|
||
|
|
||
| let vertex = AAPLVertex(position: .init(250, -250), color: .init(1, 0, 0, 1)) |
12 changes: 12 additions & 0 deletions
12
Fixtures/Metal/SimpleLibrary/Sources/MyRenderer/Shaders.metal
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // A relative path to SharedTypes.h. | ||
| #import "../MySharedTypes/include/SharedTypes.h" | ||
|
|
||
| #include <metal_stdlib> | ||
| using namespace metal; | ||
|
|
||
| vertex float4 simpleVertexShader(const device AAPLVertex *vertices [[buffer(0)]], | ||
| uint vertexID [[vertex_id]]) { | ||
| AAPLVertex in = vertices[vertexID]; | ||
| return float4(in.position.x, in.position.y, 0.0, 1.0); | ||
| } | ||
|
|
14 changes: 14 additions & 0 deletions
14
Fixtures/Metal/SimpleLibrary/Sources/MySharedTypes/include/SharedTypes.h
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #ifndef SharedTypes_h | ||
| #define SharedTypes_h | ||
|
|
||
|
|
||
| #import <simd/simd.h> | ||
|
|
||
|
|
||
| typedef struct { | ||
| vector_float2 position; | ||
| vector_float4 color; | ||
| } AAPLVertex; | ||
|
|
||
|
|
||
| #endif /* SharedTypes_h */ |
6 changes: 6 additions & 0 deletions
6
Fixtures/Metal/SimpleLibrary/Tests/MyRendererTests/MyRendererTests.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import Testing | ||
| @testable import MyRenderer | ||
|
|
||
| @Test func example() async throws { | ||
| // Write your test here and use APIs like `#expect(...)` to check expected conditions. | ||
| } |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // This source file is part of the Swift open source project | ||
| // | ||
| // Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
| // Licensed under Apache License v2.0 with Runtime Library Exception | ||
| // | ||
| // See http://swift.org/LICENSE.txt for license information | ||
| // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| import _InternalTestSupport | ||
| import Testing | ||
| import Basics | ||
|
|
||
| @Suite | ||
| struct BuildMetalTests { | ||
|
|
||
| @Test( | ||
| .requireHostOS(.macOS), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: can we add the |
||
| arguments: getBuildData(for: [.swiftbuild]), | ||
| ) | ||
| func simpleLibrary(data: BuildData) async throws { | ||
| let buildSystem = data.buildSystem | ||
| let configuration = data.config | ||
|
|
||
| try await fixture(name: "Metal/SimpleLibrary") { fixturePath in | ||
|
|
||
| // Build the package | ||
| let (_, _) = try await executeSwiftBuild( | ||
| fixturePath, | ||
| configuration: configuration, | ||
| buildSystem: buildSystem, | ||
| throwIfCommandFails: true | ||
| ) | ||
|
|
||
| // Get the bin path | ||
| let (binPathOutput, _) = try await executeSwiftBuild( | ||
| fixturePath, | ||
| configuration: configuration, | ||
| extraArgs: ["--show-bin-path"], | ||
| buildSystem: buildSystem, | ||
| throwIfCommandFails: true | ||
| ) | ||
|
|
||
| let binPath = try AbsolutePath(validating: binPathOutput.trimmingCharacters(in: .whitespacesAndNewlines)) | ||
|
|
||
| // Check that default.metallib exists | ||
| let metallibPath = binPath.appending(components:["MyRenderer_MyRenderer.bundle", "Contents", "Resources", "default.metallib"]) | ||
| #expect( | ||
| localFileSystem.exists(metallibPath), | ||
| "Expected default.metallib to exist at \(metallibPath)" | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: Nice to see a new test target dedicated to validating Metal. 🥳