Skip to content

Commit 6ea4cd0

Browse files
authored
Merge pull request #26 from rust-lang/make-benchmarks-reliable3
add workspace handling, cleanups
2 parents 5abddac + 115376b commit 6ea4cd0

File tree

11 files changed

+25
-22
lines changed

11 files changed

+25
-22
lines changed

enzyme/benchmarks/ReverseMode/adbench/gmm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ int main(const int argc, const char* argv[]) {
268268

269269
struct GMMOutput result = { 0, std::vector<double>(Jcols) };
270270

271-
if (0) {
271+
if (1) {
272272
try {
273273
struct timeval start, end;
274274
gettimeofday(&start, NULL);
@@ -350,7 +350,7 @@ int main(const int argc, const char* argv[]) {
350350
test_suite["tools"].push_back(enzyme);
351351
}
352352
}
353-
353+
354354
{
355355

356356
struct GMMInput input;

enzyme/benchmarks/ReverseMode/adbench/lstm.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ int main(const int argc, const char* argv[]) {
245245

246246
std::vector<std::string> paths = { "lstm_l2_c1024.txt", "lstm_l4_c1024.txt", "lstm_l2_c4096.txt", "lstm_l4_c4096.txt" };
247247
//std::vector<std::string> paths = { "lstm_l4_c4096.txt" };
248-
248+
249249
std::ofstream jsonfile("results.json", std::ofstream::trunc);
250250
json test_results;
251251

@@ -289,7 +289,7 @@ int main(const int argc, const char* argv[]) {
289289

290290
}
291291

292-
if (0){
292+
if (1){
293293

294294
struct LSTMInput input = {};
295295

@@ -385,7 +385,7 @@ int main(const int argc, const char* argv[]) {
385385
enzyme["result"].push_back(result.gradient[i]);
386386
}
387387
test_suite["tools"].push_back(enzyme);
388-
388+
389389
printf("\n");
390390
}
391391
}
@@ -418,7 +418,7 @@ int main(const int argc, const char* argv[]) {
418418
enzyme["result"].push_back(result.gradient[i]);
419419
}
420420
test_suite["tools"].push_back(enzyme);
421-
421+
422422
printf("\n");
423423
}
424424

enzyme/benchmarks/ReverseMode/ba/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ lto = "fat"
2121

2222
[dependencies]
2323
libm = { version = "0.2.8", optional = true }
24+
25+
[workspace]

enzyme/benchmarks/ReverseMode/ba/Makefile.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: cd %S && LD_LIBRARY_PATH="%bldpath:$LD_LIBRARY_PATH" PTR="%ptr" BENCH="%bench" BENCHLINK="%blink" LOAD="%loadEnzyme" LOADCLANG="%loadClangEnzyme" ENZYME="%enzyme" make -B ba-raw.ll results.json -f %s
1+
# RUN: cd %S && LD_LIBRARY_PATH="%bldpath:$LD_LIBRARY_PATH" PTR="%ptr" BENCH="%bench" BENCHLINK="%blink" LOAD="%loadEnzyme" LOADCLANG="%loadClangEnzyme" ENZYME="%enzyme" make -B results.json -f %s
22

33
.PHONY: clean
44

enzyme/benchmarks/ReverseMode/fft/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ strip = true
2020

2121
[profile.dev]
2222
lto = "fat"
23+
24+
[workspace]

enzyme/benchmarks/ReverseMode/gmm/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ lto = "fat"
2424

2525
[dependencies]
2626
libm = { version = "0.2.8", optional = true }
27+
28+
[workspace]

enzyme/benchmarks/ReverseMode/gmm/src/safe.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ fn lgamma(x: f64) -> f64 {
1919

2020
#[no_mangle]
2121
pub extern "C" fn rust_dgmm_objective(
22-
d: i32,
23-
k: i32,
24-
n: i32,
22+
d: usize,
23+
k: usize,
24+
n: usize,
2525
alphas: *const f64,
2626
dalphas: *mut f64,
2727
means: *const f64,
@@ -33,9 +33,6 @@ pub extern "C" fn rust_dgmm_objective(
3333
err: *mut f64,
3434
derr: *mut f64,
3535
) {
36-
let k = k as usize;
37-
let n = n as usize;
38-
let d = d as usize;
3936
let alphas = unsafe { std::slice::from_raw_parts(alphas, k) };
4037
let means = unsafe { std::slice::from_raw_parts(means, k * d) };
4138
let icf = unsafe { std::slice::from_raw_parts(icf, k * d * (d + 1) / 2) };
@@ -85,19 +82,16 @@ pub extern "C" fn rust_dgmm_objective(
8582

8683
#[no_mangle]
8784
pub extern "C" fn rust_gmm_objective(
88-
d: i32,
89-
k: i32,
90-
n: i32,
85+
d: usize,
86+
k: usize,
87+
n: usize,
9188
alphas: *const f64,
9289
means: *const f64,
9390
icf: *const f64,
9491
x: *const f64,
9592
wishart: *const Wishart,
9693
err: *mut f64,
9794
) {
98-
let k = k as usize;
99-
let n = n as usize;
100-
let d = d as usize;
10195
let alphas = unsafe { std::slice::from_raw_parts(alphas, k) };
10296
let means = unsafe { std::slice::from_raw_parts(means, k * d) };
10397
let icf = unsafe { std::slice::from_raw_parts(icf, k * d * (d + 1) / 2) };

enzyme/benchmarks/ReverseMode/lstm/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ strip = true
2020

2121
[profile.dev]
2222
lto = "fat"
23+
24+
[workspace]

enzyme/benchmarks/ReverseMode/lstm/Makefile.make

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: cd %S && LD_LIBRARY_PATH="%bldpath:$LD_LIBRARY_PATH" PTR="%ptr" BENCH="%bench" BENCHLINK="%blink" LOAD="%loadEnzyme" LOADCLANG="%loadClangEnzyme" ENZYME="%enzyme" make -B lstm-raw.ll results.json -f %s
1+
# RUN: cd %S && LD_LIBRARY_PATH="%bldpath:$LD_LIBRARY_PATH" PTR="%ptr" BENCH="%bench" BENCHLINK="%blink" LOAD="%loadEnzyme" LOADCLANG="%loadClangEnzyme" ENZYME="%enzyme" make -B results.json -f %s
22

33
.PHONY: clean
44

@@ -41,7 +41,6 @@ $(dir)/benchmarks/ReverseMode/lstm/target/release/liblstm.a: src/lib.rs Cargo.to
4141

4242
lstm.o: lstm-opt.ll $(dir)/benchmarks/ReverseMode/lstm/target/release/liblstm.a
4343
$(CLANG) -pthread -O3 $^ -o $@ $(BENCHLINK) -lm
44-
#$(CLANG) -pthread -O3 -fno-math-errno $^ -o $@ $(BENCHLINK) -lm
4544

4645
results.json: lstm.o
4746
numactl -C 1 ./$^

enzyme/benchmarks/ReverseMode/ode-real/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ strip = true
2020

2121
[profile.dev]
2222
lto = "fat"
23+
24+
[workspace]

enzyme/benchmarks/ReverseMode/ode-real/Makefile.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: cd %S && LD_LIBRARY_PATH="%bldpath:$LD_LIBRARY_PATH" PTR="%ptr" BENCH="%bench" BENCHLINK="%blink" LOAD="%loadEnzyme" ENZYME="%enzyme" make -B ode-raw.ll ode-opt.ll results.json VERBOSE=1 -f %s
1+
# RUN: cd %S && LD_LIBRARY_PATH="%bldpath:$LD_LIBRARY_PATH" PTR="%ptr" BENCH="%bench" BENCHLINK="%blink" LOAD="%loadEnzyme" ENZYME="%enzyme" make -B results.json VERBOSE=1 -f %s
22

33
.PHONY: clean
44

0 commit comments

Comments
 (0)