Skip to content

Commit e17c8cc

Browse files
committed
Merge branch 'main' into cleaner-operator-syntax
# Conflicts: # dynamic_expressions/tests/test_math_wrappers_coverage.rs # dynamic_expressions/tests/test_opset_macro_panics.rs # symbolic_regression/src/prelude.rs
2 parents b8f3f4f + 4b4c370 commit e17c8cc

46 files changed

Lines changed: 1278 additions & 1568 deletions

Some content is hidden

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

.github/workflows/publish-crates.yml

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ on:
1111
CARGO_REGISTRY_TOKEN:
1212
required: true
1313

14+
workflow_dispatch:
15+
inputs:
16+
git_ref:
17+
description: Git ref to publish from (tag, SHA, or branch)
18+
required: true
19+
type: string
20+
1421
env:
1522
CARGO_TERM_COLOR: always
1623

@@ -21,46 +28,47 @@ jobs:
2128
- name: Checkout
2229
uses: actions/checkout@v4
2330
with:
24-
ref: ${{ inputs.git_ref }}
31+
ref: ${{ inputs.git_ref || github.event.inputs.git_ref }}
2532

2633
- name: Install Rust
2734
uses: actions-rust-lang/setup-rust-toolchain@v1
2835

2936
- name: Rust cache
3037
uses: Swatinem/rust-cache@v2
3138

32-
- name: Publish dynamic_expressions
39+
- name: Publish crates
3340
shell: bash
41+
env:
42+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3443
run: |
3544
set -euo pipefail
36-
CRATE=dynamic_expressions
37-
VERSION=$(cargo metadata --no-deps --format-version 1 | python3 -c 'import json,sys; d=json.load(sys.stdin); print([p["version"] for p in d["packages"] if p["name"]=="dynamic_expressions"][0])')
38-
if curl -sSf "https://crates.io/api/v1/crates/$CRATE" | grep -q "\"num\":\"$VERSION\""; then
39-
echo "$CRATE $VERSION already exists on crates.io – skipping publish."
40-
else
41-
cargo publish -p "$CRATE" --verbose --no-verify --token "${{ secrets.CARGO_REGISTRY_TOKEN }}"
42-
fi
4345
44-
- name: Publish symbolic_regression
45-
shell: bash
46-
run: |
47-
set -euo pipefail
48-
CRATE=symbolic_regression
49-
VERSION=$(cargo metadata --no-deps --format-version 1 | python3 -c 'import json,sys; d=json.load(sys.stdin); print([p["version"] for p in d["packages"] if p["name"]=="symbolic_regression"][0])')
50-
if curl -sSf "https://crates.io/api/v1/crates/$CRATE" | grep -q "\"num\":\"$VERSION\""; then
51-
echo "$CRATE $VERSION already exists on crates.io – skipping publish."
52-
else
53-
cargo publish -p "$CRATE" --verbose --no-verify --token "${{ secrets.CARGO_REGISTRY_TOKEN }}"
54-
fi
46+
publish_or_skip_if_exists() {
47+
local crate="$1"
48+
echo "::group::cargo publish -p ${crate}"
49+
set +e
50+
out="$(cargo publish -p "$crate" --verbose --no-verify 2>&1)"
51+
code=$?
52+
set -e
53+
echo "$out"
54+
echo "::endgroup::"
5555
56-
- name: Publish symbolic_regression_wasm
57-
shell: bash
58-
run: |
59-
set -euo pipefail
60-
CRATE=symbolic_regression_wasm
61-
VERSION=$(cargo metadata --no-deps --format-version 1 | python3 -c 'import json,sys; d=json.load(sys.stdin); print([p["version"] for p in d["packages"] if p["name"]=="symbolic_regression_wasm"][0])')
62-
if curl -sSf "https://crates.io/api/v1/crates/$CRATE" | grep -q "\"num\":\"$VERSION\""; then
63-
echo "$CRATE $VERSION already exists on crates.io – skipping publish."
64-
else
65-
cargo publish -p "$CRATE" --verbose --no-verify --token "${{ secrets.CARGO_REGISTRY_TOKEN }}"
66-
fi
56+
if [ "$code" -eq 0 ]; then
57+
echo "${crate}: published"
58+
return 0
59+
fi
60+
61+
if echo "$out" | grep -q "already exists on crates.io index"; then
62+
echo "${crate}: already published, skipping"
63+
return 0
64+
fi
65+
66+
echo "${crate}: publish failed"
67+
exit "$code"
68+
}
69+
70+
publish_or_skip_if_exists dynamic_expressions
71+
sleep 15
72+
publish_or_skip_if_exists symbolic_regression
73+
sleep 15
74+
publish_or_skip_if_exists symbolic_regression_wasm

.release-please-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"dynamic_expressions": "0.9.1",
3-
"symbolic_regression": "0.11.0",
4-
"web/wasm": "0.7.1"
3+
"symbolic_regression": "0.12.0",
4+
"web/wasm": "0.7.2"
55
}

dynamic_expressions/src/evaluate.rs

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use ndarray::{Array2, ArrayView2};
22
use num_traits::Float;
33

44
use crate::compile::{EvalPlan, build_node_hash, compile_plan};
5-
use crate::dispatch::{EvalKernelCtx, GradRef, SrcRef};
5+
use crate::dispatch::{EvalKernelCtx, SrcRef};
66
use crate::expression::PostfixExpr;
77
use crate::node::Src;
88
use crate::traits::{OpId, OperatorSet};
@@ -111,76 +111,6 @@ pub(crate) fn resolve_val_src<'a, T: Float>(
111111
}
112112
}
113113

114-
pub(crate) fn resolve_der_src<'a, T: Float>(
115-
src: Src,
116-
direction: usize,
117-
dst_slot: usize,
118-
before: &'a [T],
119-
after: &'a [T],
120-
n_rows: usize,
121-
) -> SrcRef<'a, T> {
122-
match src {
123-
Src::Var(f) => {
124-
if f as usize == direction {
125-
SrcRef::Const(T::one())
126-
} else {
127-
SrcRef::Const(T::zero())
128-
}
129-
}
130-
Src::Const(_) => SrcRef::Const(T::zero()),
131-
Src::Slot(s) => {
132-
let slot = s as usize;
133-
if slot < dst_slot {
134-
let start = slot * n_rows;
135-
SrcRef::Slice(&before[start..start + n_rows])
136-
} else if slot > dst_slot {
137-
let start = (slot - dst_slot - 1) * n_rows;
138-
SrcRef::Slice(&after[start..start + n_rows])
139-
} else {
140-
panic!("source references dst slot");
141-
}
142-
}
143-
}
144-
}
145-
146-
pub(crate) fn resolve_grad_src<'a, T: Float>(
147-
src: Src,
148-
variable: bool,
149-
dst_slot: usize,
150-
before: &'a [T],
151-
after: &'a [T],
152-
slot_stride: usize,
153-
) -> GradRef<'a, T> {
154-
match src {
155-
Src::Var(f) => {
156-
if variable {
157-
GradRef::Basis(f as usize)
158-
} else {
159-
GradRef::Zero
160-
}
161-
}
162-
Src::Const(c) => {
163-
if variable {
164-
GradRef::Zero
165-
} else {
166-
GradRef::Basis(c as usize)
167-
}
168-
}
169-
Src::Slot(s) => {
170-
let slot = s as usize;
171-
if slot < dst_slot {
172-
let start = slot * slot_stride;
173-
GradRef::Slice(&before[start..start + slot_stride])
174-
} else if slot > dst_slot {
175-
let start = (slot - dst_slot - 1) * slot_stride;
176-
GradRef::Slice(&after[start..start + slot_stride])
177-
} else {
178-
panic!("source references dst slot");
179-
}
180-
}
181-
}
182-
}
183-
184114
pub fn eval_tree_array<T, Ops, const D: usize>(
185115
expr: &PostfixExpr<T, Ops, D>,
186116
x_columns: ArrayView2<'_, T>,

0 commit comments

Comments
 (0)