Skip to content

Commit 3046f0e

Browse files
authored
Remove Metal feature (#993)
* rm all metal features * fix clippy * fix attribute * fix another attribute
1 parent 3b0450f commit 3046f0e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+85
-1824
lines changed

Diff for: .github/workflows/ci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ jobs:
182182
components: clippy
183183

184184
- name: Run clippy
185-
run: make clippy-metal
185+
run: make clippy
186186

187187
- name: Run tests
188-
run: make test-metal
188+
run: make test

Diff for: Makefile

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: test clippy docker-shell nix-shell benchmarks benchmark docs build-cuda build-metal clippy-metal test-metal coverage clean
1+
.PHONY: test clippy docker-shell nix-shell benchmarks benchmark docs build-cuda coverage clean
22

33
FUZZ_DIR = fuzz/no_gpu_fuzz
44

@@ -33,18 +33,8 @@ benchmark:
3333
flamegraph_stark:
3434
CARGO_PROFILE_BENCH_DEBUG=true cargo flamegraph --root --bench stark_benchmarks -- --bench
3535

36-
coverage:
36+
coverage:
3737
cargo llvm-cov nextest --lcov --output-path lcov.info
38-
39-
METAL_DIR = math/src/gpu/metal
40-
build-metal:
41-
xcrun -sdk macosx metal $(METAL_DIR)/all.metal -o $(METAL_DIR)/lib.metallib
42-
43-
clippy-metal:
44-
cargo clippy --workspace --all-targets -F metal -- -D warnings
45-
46-
test-metal:
47-
cargo test -F metal
4838

4939
CUDA_DIR = math/src/gpu/cuda/shaders
5040
CUDA_FILES:=$(wildcard $(CUDA_DIR)/**/*.cu)
@@ -69,10 +59,6 @@ run-fuzzer:
6959

7060
proof-deserializer-fuzzer:
7161
cargo +nightly fuzz run --fuzz-dir $(FUZZ_DIR) deserialize_stark_proof
72-
73-
run-metal-fuzzer:
74-
cd fuzz/metal_fuzz
75-
cargo +nightly fuzz run --fuzz-dir $(FUZZ_DIR) fft_diff
7662

7763
run-cuda-fuzzer:
7864
cd fuzz/cuda_fuzz

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ This can be used in a multi prover setting for extra security, or as a standalon
135135

136136
### Fuzzers
137137

138-
Fuzzers are divided between the ones that use only the CPU, the ones that use Metal, and the ones that use CUDA.
138+
Fuzzers are divided between the ones that use only the CPU, and the ones that use CUDA.
139139

140140
To use them, make sure you have installed ```cargo fuzzer```
141141

@@ -153,7 +153,7 @@ make run-fuzzer FUZZER=stark252
153153

154154
The list of fuzzers can be found in `fuzz/no_gpu_fuzz`
155155

156-
Fuzzers for FTT in Metal and Cuda can be run with `make run-metal-fuzzer` and `make run-cuda-fuzzer`
156+
Fuzzers for FTT in Cuda can be run with `make run-cuda-fuzzer`
157157

158158

159159
Run a specific fuzzer from the ones contained in **fuzz/fuzz_targets/** folder with`cargo`, for example to run the one for the target `field_from_hex`:
@@ -222,7 +222,7 @@ The following links, repos, companies and projects have been important in the de
222222

223223
# Security
224224

225-
We take security seriously. If you discover a vulnerability in this project, please report it responsibly.
225+
We take security seriously. If you discover a vulnerability in this project, please report it responsibly.
226226

227227
- You can report vulnerabilities directly via the **[GitHub "Report a Vulnerability" feature](../../security/advisories/new)**.
228228
- Alternatively, send an email to **[[email protected]](mailto:[email protected])**.

Diff for: crates/gpu/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ license.workspace = true
99

1010
[dependencies]
1111
thiserror = "1.0.38"
12-
metal = { version = "0.24.0", optional = true }
13-
objc = { version = "0.2.7", optional = true }
1412

1513
[dev-dependencies]
1614
proptest = "1.1.0"
@@ -20,7 +18,6 @@ rand = "0.8.5"
2018
walkdir = { version = "2.3.3", optional = true }
2119

2220
[features]
23-
metal = ["dep:metal", "dep:objc"]
2421
cuda = ["dep:walkdir"]
2522

2623
# Some features activate compilation of code which isn't

Diff for: crates/gpu/build.rs

-36
Original file line numberDiff line numberDiff line change
@@ -50,43 +50,7 @@ fn compile_cuda_shaders() {
5050
});
5151
}
5252

53-
#[cfg(feature = "metal")]
54-
fn compile_metal_shaders() {
55-
use std::process::Command;
56-
let source_dir = env!("CARGO_MANIFEST_DIR").to_string() + "/../math/src/gpu/metal";
57-
58-
// Tell cargo to invalidate the built crate whenever the source changes
59-
println!("cargo:rerun-if-changed={source_dir}");
60-
61-
let input = source_dir.clone() + "/all.metal";
62-
let output = source_dir + "/lib.metallib";
63-
64-
println!("cargo:warning=compiling:'{input}'->'{output}'");
65-
66-
let cmd = Command::new("xcrun")
67-
.args(["-sdk", "macosx", "metal"])
68-
.arg(&input)
69-
.arg("-o")
70-
.arg(&output)
71-
.spawn()
72-
.expect("Failed to spawn process");
73-
74-
let res = cmd.wait_with_output().expect("Command waiting failed");
75-
76-
if !res.status.success() {
77-
println!();
78-
println!("{}", String::from_utf8(res.stdout).unwrap());
79-
println!();
80-
eprintln!("{}", String::from_utf8(res.stderr).unwrap());
81-
println!();
82-
panic!("Compilation failed for source '{}'", input);
83-
}
84-
}
85-
8653
fn main() {
8754
#[cfg(feature = "cuda")]
8855
compile_cuda_shaders();
89-
90-
#[cfg(feature = "metal")]
91-
compile_metal_shaders();
9256
}

Diff for: crates/gpu/src/lib.rs

-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
1-
#[cfg(all(feature = "metal", feature = "cuda"))]
2-
compile_error!(
3-
"Can't enable both \"metal\" and \"cuda\" features at the same time.
4-
If you were using the `--all-features` flag please read this crate's Cargo.toml"
5-
);
6-
7-
#[cfg(feature = "metal")]
8-
pub mod metal;
9-
101
#[cfg(feature = "cuda")]
112
pub mod cuda;

Diff for: crates/gpu/src/metal/abstractions/errors.rs

-17
This file was deleted.

Diff for: crates/gpu/src/metal/abstractions/mod.rs

-2
This file was deleted.

Diff for: crates/gpu/src/metal/abstractions/state.rs

-115
This file was deleted.

Diff for: crates/gpu/src/metal/mod.rs

-1
This file was deleted.

Diff for: crates/math/Cargo.toml

-15
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ rand = { version = "0.8.5", default-features = false }
2222
# rayon
2323
rayon = { version = "1.7", optional = true }
2424

25-
# metal
26-
metal = { version = "0.24.0", optional = true }
27-
objc = { version = "0.2.7", optional = true }
28-
2925
# cuda
3026
cudarc = { version = "0.9.7", optional = true }
3127

@@ -55,12 +51,6 @@ instruments = []
5551

5652

5753
# gpu
58-
metal = [
59-
"dep:metal",
60-
"dep:objc",
61-
"dep:lambdaworks-gpu",
62-
"lambdaworks-gpu?/metal",
63-
]
6454
cuda = ["dep:cudarc", "dep:lambdaworks-gpu"]
6555

6656
[target.wasm32-unknown-unknown.dependencies]
@@ -102,8 +92,3 @@ harness = false
10292
[[bench]]
10393
name = "iai_fft"
10494
harness = false
105-
106-
[[bench]]
107-
name = "criterion_metal"
108-
harness = false
109-
required-features = ["metal"]

Diff for: crates/math/benches/criterion_fft.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn poly_interpolation_benchmarks(c: &mut Criterion) {
140140
group.finish();
141141
}
142142

143-
#[cfg(not(any(feature = "metal", feature = "cuda")))]
143+
#[cfg(not(feature = "cuda"))]
144144
criterion_group!(
145145
name = seq_fft;
146146
config = Criterion::default().sample_size(10);
@@ -152,7 +152,7 @@ criterion_group!(
152152
poly_interpolation_benchmarks,
153153
);
154154

155-
#[cfg(any(feature = "metal", feature = "cuda"))]
155+
#[cfg(feature = "cuda")]
156156
criterion_group!(
157157
name = seq_fft;
158158
config = Criterion::default().sample_size(10);

0 commit comments

Comments
 (0)