Conversation
Contributor
|
| Branch | feat/add-missing-macros |
| Testbed | mhovd-pgx |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result nanoseconds (ns) (Result Δ%) | Upper Boundary nanoseconds (ns) (Limit %) |
|---|---|---|---|
| Conditional dose modification | 📈 view plot 🚷 view threshold | 1,150.30 ns(-5.00%)Baseline: 1,210.88 ns | 1,265.76 ns (90.88%) |
| Create large dataset (100 subjects) | 📈 view plot 🚷 view threshold | 54,220.00 ns(-1.12%)Baseline: 54,834.46 ns | 57,230.64 ns (94.74%) |
| Data expand complex (1h intervals) | 📈 view plot 🚷 view threshold | 27,498.00 ns(-1.79%)Baseline: 28,000.24 ns | 30,265.88 ns (90.85%) |
| Data expand simple (1h intervals) | 📈 view plot 🚷 view threshold | 465.57 ns(-5.23%)Baseline: 491.28 ns | 521.47 ns (89.28%) |
| Data expand with additional time | 📈 view plot 🚷 view threshold | 38,338.00 ns(-1.37%)Baseline: 38,870.59 ns | 42,111.34 ns (91.04%) |
| Filter exclude subjects | 📈 view plot 🚷 view threshold | 30,767.00 ns(-0.04%)Baseline: 30,780.84 ns | 31,503.83 ns (97.66%) |
| Filter include subjects | 📈 view plot 🚷 view threshold | 8,148.20 ns(+2.53%)Baseline: 7,947.35 ns | 8,379.02 ns (97.25%) |
| Modify all bolus doses | 📈 view plot 🚷 view threshold | 1,121.90 ns(-4.60%)Baseline: 1,175.97 ns | 1,223.30 ns (91.71%) |
| Modify all infusion doses | 📈 view plot 🚷 view threshold | 1,161.40 ns(-3.84%)Baseline: 1,207.75 ns | 1,258.22 ns (92.30%) |
| SubjectBuilder multi-occasion | 📈 view plot 🚷 view threshold | 261.08 ns(-1.44%)Baseline: 264.89 ns | 275.21 ns (94.87%) |
| SubjectBuilder simple | 📈 view plot 🚷 view threshold | 102.41 ns(-1.95%)Baseline: 104.45 ns | 109.28 ns (93.72%) |
| SubjectBuilder with covariates | 📈 view plot 🚷 view threshold | 283.35 ns(+2.10%)Baseline: 277.53 ns | 294.58 ns (96.19%) |
| nca_auc_cmax_metrics | 📈 view plot 🚷 view threshold | 600.91 ns(+2.28%)Baseline: 587.50 ns | 615.81 ns (97.58%) |
| nca_population/10 | 📈 view plot 🚷 view threshold | 48,527.00 ns(+3.30%)Baseline: 46,974.94 ns | 49,975.42 ns (97.10%) |
| nca_population/100 | 📈 view plot 🚷 view threshold | 125,590.00 ns(+2.50%)Baseline: 122,525.00 ns | 127,813.68 ns (98.26%) |
| nca_population/500 | 📈 view plot 🚷 view threshold | 365,000.00 ns(-9.36%)Baseline: 402,696.11 ns | 432,013.37 ns (84.49%) |
| nca_single_subject | 📈 view plot 🚷 view threshold | 1,008.80 ns(-0.29%)Baseline: 1,011.70 ns | 1,050.42 ns (96.04%) |
| one_compartment | 📈 view plot 🚷 view threshold | 29,515.00 ns(+25.09%)Baseline: 23,595.73 ns | 30,159.08 ns (97.86%) |
| one_compartment_covariates | 📈 view plot 🚷 view threshold | 43,136.00 ns(+36.53%)Baseline: 31,594.68 ns | 46,585.36 ns (92.60%) |
| readme 20 | 📈 view plot 🚷 view threshold | 340,720.00 ns(+3.19%)Baseline: 330,190.27 ns | 351,966.08 ns (96.80%) |
| two_compartment | 📈 view plot 🚷 view threshold | 39,449.00 ns(+46.87%)Baseline: 26,859.27 ns | 41,887.41 ns (94.18%) |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the “declaration-first” modeling surface by adding missing macros and aligning handwritten model APIs with DSL-style metadata, while also updating DSL authoring keywords and runtime route semantics so route/name lookups stay consistent across ODE/Analytical/SDE paths.
Changes:
- Introduces a new shared handwritten model metadata system and wires it into ODE/Analytical/SDE (including name-based index lookups).
- Adds/exports missing macros (
analytical!,sde!) and adds macro-lowering parity tests against handwritten models. - Updates the DSL authoring surface (
model=→name=,kernel=→structure=) and updates runtimes/ABI model info to carry richer route identity (declaration index/kind).
Reviewed changes
Copilot reviewed 45 out of 46 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/support/runtime_corpus.rs | Updates embedded DSL fixtures to use name = ... / structure = .... |
| tests/support/bimodal_ke.rs | Updates DSL fixture to name = .... |
| tests/sde_macro_lowering.rs | Adds parity tests for sde! lowering vs handwritten SDE (metadata + predictions). |
| tests/ode_macro_lowering.rs | Adds parity tests for ode! lowering vs handwritten ODE (metadata + predictions). |
| tests/browser-e2e/site/app.mjs | Updates browser E2E DSL sources from model = to name =. |
| tests/analytical_macro_lowering.rs | Adds parity tests for analytical! lowering vs handwritten analytical models. |
| src/test_fixtures.rs | Updates fixture DSL kernel → structure. |
| src/simulator/equation/sde/mod.rs | Adds metadata attachment + bolus injection mapping hook + SDE event handling changes. |
| src/simulator/equation/ode/mod.rs | Adds metadata attachment and dimension validation for handwritten ODE models. |
| src/simulator/equation/mod.rs | Renames meta module to metadata and re-exports DSL enums. |
| src/simulator/equation/metadata.rs | New shared handwritten metadata builder + validation + lookup helpers. |
| src/simulator/equation/meta.rs | Removes old Meta container. |
| src/simulator/equation/analytical/mod.rs | Adds metadata attachment and validation for handwritten analytical models. |
| src/lib.rs | Re-exports new macros and metadata types through crate root and prelude. |
| src/dsl/wasm_direct_emitter.rs | Updates route-input load representation to the new ExecutionLoad::RouteInput { .. } form. |
| src/dsl/wasm_compile.rs | Updates DSL test sources to use name = .... |
| src/dsl/wasm.rs | Updates WASM tests and route metadata shape expectations (but currently introduces a compile error). |
| src/dsl/rust_backend.rs | Updates route-input load representation to the new ExecutionLoad::RouteInput { .. } form. |
| src/dsl/native.rs | Adds route-kind-aware input validation and refines injection semantics for compiled/native runtime. |
| src/dsl/model_info.rs | Extends native model info route metadata (declaration index/kind) and improves explicit route usage detection. |
| src/dsl/jit.rs | Updates JIT lowering for new ExecutionLoad::RouteInput { .. } and adds shared-channel test. |
| src/dsl/compiled_backend_abi.rs | Updates ABI test fixtures for expanded route info fields. |
| pharmsol-macros/Cargo.toml | Enables syn’s visit feature to support macro parsing/analysis. |
| pharmsol-dsl/tests/dsl_authoring_edge_cases.rs | Updates DSL authoring fixtures to name = .... |
| pharmsol-dsl/src/test_fixtures.rs | Updates fixtures to structure = ... and name = .... |
| pharmsol-dsl/src/semantic.rs | Renames analytical kernel to structure and preserves route kind in typed IR. |
| pharmsol-dsl/src/parser.rs | Renames analytical block key to structure and updates authoring tests to name = .... |
| pharmsol-dsl/src/ir.rs | Extends typed IR to store optional RouteKind and renames analytical kernel to structure. |
| pharmsol-dsl/src/execution.rs | Introduces declaration-index-aware route metadata, route-kind-aware channel assignment, and route-input load encoding. |
| pharmsol-dsl/src/authoring.rs | Renames model = ... → name = ..., kernel = ... → structure = ..., and preserves route order/kind. |
| pharmsol-dsl/src/ast.rs | Adds RouteKind and renames analytical kernel to structure in AST + formatter. |
| examples/two_compartment.rs | Migrates example to declaration-first ode! with metadata-backed indices. |
| examples/sde_readme.rs | New SDE macro example showing name-based indices + prediction calls. |
| examples/one_compartment.rs | Migrates example to analytical!/ode! but currently introduces a compile error. |
| examples/ode_readme.rs | Updates README-style ODE example to ode! and name-based indices. |
| examples/macro_vs_handwritten_two_cpt.rs | New parity example comparing macro vs handwritten ODE for shared-channel dosing. |
| examples/macro_vs_handwritten_one_cpt.rs | New parity example comparing macro vs handwritten ODE for one-compartment IV. |
| examples/dsl_runtime_jit.rs | Updates embedded authoring DSL to name = .... |
| examples/covariates.rs | Migrates covariates example to ode! with covariate declarations and name-based indices. |
| examples/compare_solvers.rs | Migrates solver comparison example to declaration-first ode! and shared-channel route semantics. |
| examples/analytical_vs_ode.rs | Migrates comparison example to macro surfaces and name-based indices. |
| examples/analytical_readme.rs | New analytical macro example for README-style docs. |
| README.md | Rewrites quick start to prefer macro surfaces and links to new examples/migration docs. |
| .gitignore | Adds docs/ to ignored paths. |
Comments suppressed due to low confidence (3)
src/dsl/wasm.rs:932
CompiledModelInfoEnvelopedoesn’t define anamefield; it requiresmodel: NativeModelInfo. As written this won’t compile and it ignores themodel_infovariable defined just above. Use themodelfield here as in other call sites.
fn rejects_compiled_metadata_abi_version_mismatch() {
let model_info = loader_test_model_info("metadata_api_version_mismatch");
let metadata = serde_json::to_vec(&CompiledModelInfoEnvelope {
abi_version: WASM_API_VERSION + 1,
name: "model_info",
kernels: CompiledKernelAvailability {
outputs: true,
..CompiledKernelAvailability::default()
},
})
src/dsl/wasm.rs:958
CompiledModelInfoEnvelopeis being constructed with a nonexistentnamefield and without the requiredmodelfield. This will fail to compile; pass theNativeModelInfoin themodelfield instead.
fn rejects_kernel_metadata_mismatch_from_compiled_envelope() {
let model_info = loader_test_model_info("kernel_metadata_mismatch");
let metadata = serde_json::to_vec(&CompiledModelInfoEnvelope {
abi_version: WASM_API_VERSION,
name: "model_info",
kernels: CompiledKernelAvailability {
outputs: true,
..CompiledKernelAvailability::default()
},
})
src/dsl/wasm.rs:903
CompiledModelInfoEnvelopedoes not have anamefield (it hasmodel: NativeModelInfo). This test code will not compile and also drops themodel_infovalue it just computed. Populate themodelfield instead (and remove the now-unusedmodel_infobinding if appropriate).
let model_info = loader_test_model_info("api_version_export_mismatch");
let metadata = serde_json::to_vec(&CompiledModelInfoEnvelope {
abi_version: WASM_API_VERSION,
name: "model_info",
kernels: CompiledKernelAvailability {
outputs: true,
..CompiledKernelAvailability::default()
},
})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
51
to
57
| // Define the error models for the observations | ||
| let ems = AssayErrorModels::new(). | ||
| // For this example, we use a simple additive error model with 5% error | ||
| add( | ||
| 0, | ||
| cp, | ||
| AssayErrorModel::additive(ErrorPoly::new(0.0, 0.05, 0.0, 0.0), 0.0), | ||
| )?; |
mhovd
reviewed
May 1, 2026
| { | ||
| return Err(ParseError::new( | ||
| "analytical authoring models cannot declare particles, init, or noise equations", | ||
| "analytical authoring models cannot declare particles or noise equations", |
Collaborator
There was a problem hiding this comment.
It is not apparent to me what an "authoring model" is
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.