Skip to content

Commit e83607e

Browse files
chore(cuda): BabyBear unified + CUDA_DEBUG + opener in natural order (#2149)
Co-authored-by: Jonathan Wang <[email protected]>
1 parent f21b21d commit e83607e

Some content is hidden

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

54 files changed

+162
-163
lines changed

Cargo.lock

Lines changed: 71 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace.package]
2-
version = "1.4.1-rc.0"
2+
version = "1.4.1-rc.1"
33
edition = "2021"
44
rust-version = "1.86.0"
55
authors = ["OpenVM Authors"]
@@ -113,11 +113,11 @@ lto = "thin"
113113

114114
[workspace.dependencies]
115115
# Stark Backend
116-
openvm-stark-backend = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.2", default-features = false }
117-
openvm-stark-sdk = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.2", default-features = false }
118-
openvm-cuda-backend = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.2", default-features = false }
119-
openvm-cuda-builder = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.2", default-features = false }
120-
openvm-cuda-common = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.2", default-features = false }
116+
openvm-stark-backend = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.3", default-features = false }
117+
openvm-stark-sdk = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.3", default-features = false }
118+
openvm-cuda-backend = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.3", default-features = false }
119+
openvm-cuda-builder = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.3", default-features = false }
120+
openvm-cuda-common = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1-rc.3", default-features = false }
121121

122122
# OpenVM
123123
openvm-sdk = { path = "crates/sdk", default-features = false }

crates/circuits/mod-builder/cuda/src/field_expression.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,5 +371,5 @@ extern "C" int _field_expression_tracegen(
371371
workspace_per_thread
372372
);
373373

374-
return cudaGetLastError();
374+
return CHECK_KERNEL();
375375
}

crates/circuits/poseidon2-air/cuda/src/dummy.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ extern "C" int _poseidon2_dummy_tracegen(Fp *output, Fp *inputs, uint32_t sbox_r
4040
default:
4141
return cudaErrorInvalidConfiguration;
4242
}
43-
return cudaGetLastError();
43+
return CHECK_KERNEL();
4444
}

crates/circuits/primitives/cuda/include/primitives/encoder.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct Encoder {
4848
__device__ uint32_t width() const { return k; }
4949

5050
__device__ void write_flag_pt(RowSlice pt, uint32_t idx) const {
51-
#ifdef DEBUG
51+
#ifdef CUDA_DEBUG
5252
assert(idx < num_flags);
5353
assert(this->k > 0);
5454
#endif

crates/circuits/primitives/cuda/include/primitives/histogram.cuh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "launcher.cuh"
4+
#include "utils.cuh"
45
#include "trace_access.h"
56

67
/**
@@ -64,8 +65,8 @@ struct VariableRangeChecker {
6465
const size_t limbs_len
6566
) {
6667
size_t range_max_bits = max_bits();
67-
#ifdef DEBUG
68-
assert(limbs_len >= div_ceil(bits, range_max_bits));
68+
#ifdef CUDA_DEBUG
69+
assert(limbs_len >= d_div_ceil(bits, range_max_bits));
6970
#endif
7071
uint32_t mask = (1 << range_max_bits) - 1;
7172
size_t bits_remaining = bits;
@@ -77,7 +78,7 @@ struct VariableRangeChecker {
7778
x >>= range_max_bits;
7879
bits_remaining -= min(bits_remaining, range_max_bits);
7980
}
80-
#ifdef DEBUG
81+
#ifdef CUDA_DEBUG
8182
assert(bits_remaining == 0 && x == 0);
8283
#endif
8384
}
@@ -105,9 +106,6 @@ template <uint32_t N> struct RangeTupleChecker {
105106
}
106107

107108
__device__ void add_count(RowSlice values) {
108-
#ifdef DEBUG
109-
assert(values.length == N);
110-
#endif
111109
uint32_t idx = 0;
112110
for (int i = 0; i < N; i++) {
113111
idx = idx * sizes[i] + values[i].asUInt32();

crates/circuits/primitives/cuda/src/bitwise_op_lookup.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ extern "C" int _bitwise_op_lookup_tracegen(
2424
uint32_t num_rows = 1 << (2 * num_bits);
2525
auto [grid, block] = kernel_launch_params(num_rows);
2626
bitwise_op_lookup_tracegen<<<grid, block>>>(d_count, d_cpu_count, d_trace, num_rows);
27-
return cudaGetLastError();
27+
return CHECK_KERNEL();
2828
}

crates/circuits/primitives/cuda/src/dummy/bitwise_op_lookup.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ extern "C" int _bitwise_dummy_tracegen(
5353
) {
5454
auto [grid, block] = kernel_launch_params(records.len());
5555
bitwise_dummy_tracegen<<<grid, block>>>(d_trace, records, bitwise_count, bitwise_num_bits);
56-
return cudaGetLastError();
56+
return CHECK_KERNEL();
5757
}

crates/circuits/primitives/cuda/src/dummy/encoder.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ extern "C" int _encoder_tracegen(
3434

3535
cukernel_encoder_tracegen<<<grid, block>>>(trace, num_flags, max_degree, reserve_invalid, k);
3636

37-
return cudaGetLastError();
37+
return CHECK_KERNEL();
3838
}

crates/circuits/primitives/cuda/src/dummy/fibair.cu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "fp.h"
2+
#include "launcher.cuh"
23

34
__global__ void cukernel_fibair_tracegen(Fp *output, uint32_t a, uint32_t b, uint32_t n) {
45
if (blockIdx.x != 0 || threadIdx.x != 0)
@@ -19,5 +20,5 @@ extern "C" int _fibair_tracegen(Fp *output, uint32_t a, uint32_t b, uint32_t n)
1920
dim3 grid(1);
2021
dim3 block(1);
2122
cukernel_fibair_tracegen<<<grid, block>>>(output, a, b, n);
22-
return cudaGetLastError();
23+
return CHECK_KERNEL();
2324
}

0 commit comments

Comments
 (0)