Skip to content

Conversation

@WardBrian
Copy link
Member

@WardBrian WardBrian commented Apr 2, 2025

Summary

Closes #3170.

This updates the simplex transform and the stochastic matrices to use the ILR transform rather than stick breaking.
The stochastic matrices delegate more to the simplex functions for now, they could be rewritten for efficiency later.

Q: This completely replaces the existing functions, but we may want to preserve them under a different name. If we're fine replacing them, this also closes #3168

Tests

Existing simplex tests pass, and I added one more to test some edge behavior

Side Effects

Release notes

The simplex transform is now defined in terms of the isometric log ratio transform instead of stick breaking.

Checklist

  • Copyright holder: Simons Foundation

    The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
    - Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
    - Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

  • the basic tests are passing

    • unit tests pass (to run, use: ./runTests.py test/unit)
    • header checks pass, (make test-headers)
    • dependencies checks pass, (make test-math-dependencies)
    • docs build, (make doxygen)
    • code passes the built in C++ standards checks (make cpplint)
  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

@WardBrian WardBrian marked this pull request as ready for review April 4, 2025 14:35
@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.31 0.31 1.02 1.9% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 1.0 0.28% faster
gp_regr/gen_gp_data.stan 0.02 0.02 1.04 4.15% faster
gp_regr/gp_regr.stan 0.09 0.09 1.02 1.5% faster
sir/sir.stan 67.75 67.16 1.01 0.87% faster
irt_2pl/irt_2pl.stan 3.96 4.0 0.99 -0.92% slower
eight_schools/eight_schools.stan 0.05 0.05 1.0 -0.09% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.25 0.24 1.04 3.72% faster
pkpd/one_comp_mm_elim_abs.stan 19.49 18.8 1.04 3.53% faster
garch/garch.stan 0.42 0.41 1.02 2.41% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.66 2.61 1.02 1.78% faster
arK/arK.stan 1.73 1.75 0.99 -0.63% slower
gp_pois_regr/gp_pois_regr.stan 2.71 2.72 1.0 -0.23% slower
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.7 8.53 1.02 1.97% faster
performance.compilation 184.79 177.97 1.04 3.69% faster
Mean result: 1.0164970578185035

Jenkins Console Log
Blue Ocean
Commit hash: e082c1dc2ef8131fcbaa13f6637d9e4392971770


Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping: 4
CPU MHz: 2400.000
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities

G++:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@WardBrian
Copy link
Member Author

A quick validation:

Using the multi-logit-normal from https://github.com/bob-carpenter/transforms

Code and data

functions {
  real multi_logit_normal_cholesky_lpdf(vector theta, vector mu,
                                        matrix L_Sigma) {
    int N = rows(theta);
    vector[N] log_theta = log(theta);
    return multi_normal_cholesky_lpdf(log_theta[1 : N - 1] - log_theta[N] | mu, L_Sigma)
           - sum(log_theta);
  }
}
data {
  int<lower=1> N;
  vector[N - 1] mu;
  matrix[N - 1, N - 1] L_Sigma;
}
parameters {
  simplex[N] x;
}
model {
  target += multi_logit_normal_cholesky_lpdf(x | mu, L_Sigma);
}
{
  "N": 5,
  "mu": [-0.0104, -0.006, -0.0062, -0.0081],
  "L_Sigma": [
    [20.8371, 0.0, 0.0, 0.0],
    [65.0306, 58.6011, 0.0, 0.0],
    [-63.5698, 25.1499, 30.1392, 0.0],
    [32.0142, 22.2009, 69.8059, 21.1121]
  ]
}

Here are the stansummarys of the current transform (sb):

$ ./bin/stansummary sb_1.csv sb_2.csv sb_3.csv sb_4.csv

Inference for Stan model: multi_normal_logit_model
4 chains: each with iter=1000; warmup=1000; thin=1; 1000 iterations saved.

Warmup took (0.18, 0.13, 0.14, 0.12) seconds, 0.57 seconds total
Sampling took (0.086, 0.12, 0.080, 0.10) seconds, 0.39 seconds total

                 Mean   MCSE  StdDev      MAD       5%      50%    95%  ESS_bulk  ESS_tail  ESS_bulk/s  R_hat

lp__              -19  0.069     1.4  1.2e+00 -2.2e+01 -1.9e+01    -17       317       717         818    1.0
accept_stat__    0.65  0.060    0.34     0.30  1.1e-03     0.77   1.00        43       279         110    1.1
stepsize__      0.060    nan   0.011    0.010  4.3e-02    0.063  0.071       nan       nan         nan    nan
treedepth__       3.9   0.23     1.5      1.5  1.0e+00      4.0    6.0        48        57         123    1.1
n_leapfrog__       30    5.4      26       28  2.0e+00       26     67        43       346         111    1.1
divergent__      0.36    nan    0.48     0.00  0.0e+00     0.00    1.0       214       214         550    1.0
energy__           21  0.079     1.9      1.8  1.8e+01       21     25       590      1548        1520    1.0

x[1]             0.27  0.025    0.42  1.5e-05  1.7e-23  9.9e-06   1.00       131       528         338    1.0
x[2]             0.12  0.026    0.32  1.8e-21  4.3e-72  1.2e-21   1.00       164       328         423    1.0
x[3]             0.33  0.045    0.46  5.6e-11  1.6e-63  3.8e-11    1.0       135        89         348    1.0
x[4]            0.068  0.031    0.24  5.2e-31  1.2e-79  3.5e-31   0.99       112       346         288    1.0
x[5]             0.21  0.025    0.38  3.2e-06  2.2e-16  2.2e-06   1.00        71       970         182    1.1

$ ./bin/diagnose sb_1.csv sb_2.csv sb_3.csv sb_4.csv

Checking sampler transitions treedepth.
Treedepth satisfactory for all transitions.

Checking sampler transitions for divergences.
1548 of 1000 (154.80%) transitions ended with a divergence.
These divergent transitions indicate that HMC is not fully able to explore the posterior distribution.
Try increasing adapt delta closer to 1.
If this doesn't remove all divergences, try to reparameterize the model.

Checking E-BFMI - sampler transitions HMC potential energy.
E-BFMI satisfactory.

Rank-normalized split effective sample size satisfactory for all parameters.

The following parameters had rank-normalized split R-hat greater than 1.01:
  x[1], x[2], x[3], x[5]
Such high values indicate incomplete mixing and biased estimation.
You should consider regularizating your model with additional prior information or a more effective parameterization.

And this PR (ilr):

$ ./bin/stansummary ilr_1.csv ilr_2.csv ilr_3.csv ilr_4.csv

Inference for Stan model: multi_normal_logit_model
4 chains: each with iter=1000; warmup=1000; thin=1; 1000 iterations saved.

Warmup took (0.20, 0.24, 0.20, 0.20) seconds, 0.83 seconds total
Sampling took (0.22, 0.19, 0.20, 0.22) seconds, 0.84 seconds total

                 Mean     MCSE   StdDev      MAD       5%      50%    95%  ESS_bulk  ESS_tail  ESS_bulk/s  R_hat

lp__              -18  3.4e-02      1.4  1.2e+00 -2.1e+01 -1.8e+01    -17      1734      2095        2071    1.0
accept_stat__    0.93    0.010  1.1e-01  4.3e-02     0.70     0.97   1.00       768      2447         917    1.0
stepsize__      0.033      nan  3.3e-03  4.8e-03    0.029    0.033  0.036       nan       nan         nan    nan
treedepth__       5.9    0.023  1.3e+00  1.5e+00      2.0      6.0    7.0      2952       695        3527    1.0
n_leapfrog__       95      1.3  4.9e+01  4.2e+01      7.0      127    127      1972      2421        2356    1.0
divergent__      0.00      nan  0.0e+00  0.0e+00     0.00     0.00   0.00       nan       nan         nan    nan
energy__           20    0.049  2.0e+00  1.8e+00       18       20     24      1696      2159        2026    1.0

x[1]            0.087  5.6e-03     0.27  1.2e-27  6.0e-75  8.1e-28   1.00      2005      2372        2396   1.00
x[2]             0.30  9.9e-03     0.46  4.4e-20  5.9e-97  3.0e-20    1.0      1806      1998        2157    1.0
x[3]             0.32  9.9e-03     0.46  8.9e-20 6.4e-103  6.0e-20    1.0      1587      2230        1896    1.0
x[4]             0.21  8.7e-03     0.40  1.3e-26  9.9e-84  8.8e-27    1.0      1798      2068        2148    1.0
x[5]            0.080  5.5e-03     0.26  2.1e-27  3.6e-75  1.4e-27   0.98      1599      2009        1910    1.0

$ ./bin/diagnose ilr_1.csv ilr_2.csv ilr_3.csv ilr_4.csv

Checking sampler transitions treedepth.
Treedepth satisfactory for all transitions.

Checking sampler transitions for divergences.
No divergent transitions found.

Checking E-BFMI - sampler transitions HMC potential energy.
E-BFMI satisfactory.

Rank-normalized split effective sample size satisfactory for all parameters.

Rank-normalized split R-hat values satisfactory for all parameters.

@spinkney
Copy link
Collaborator

spinkney commented Apr 7, 2025

@WardBrian there's a bug in the logic for the sampler divergence output calc. It says 154% above

Checking sampler transitions for divergences.
1548 of 1000 (154.80%) transitions ended with a divergence.

@WardBrian
Copy link
Member Author

Yeah, it looks like the denominator never changes as you add chains. I’ll take a look up in the cmdstan repo

SteveBronder
SteveBronder previously approved these changes Apr 7, 2025
Copy link
Collaborator

@SteveBronder SteveBronder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good with a few small suggestions

Comment on lines 68 to 70
for (int i = 0; i <= N; ++i) {
z.coeffRef(i) = exp(z.coeff(i) - max_val) / d;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (int i = 0; i <= N; ++i) {
z.coeffRef(i) = exp(z.coeff(i) - max_val) / d;
}
z.array() = (z.array() - max_val).exp() / d;

Comment on lines 44 to 45
const auto& x_val = to_ref(arena_x.val_op());
const auto& x_adj = to_ref(arena_x.adj_op());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arena_x should not be an expression so you don't need to_ref here

Suggested change
const auto& x_val = to_ref(arena_x.val_op());
const auto& x_adj = to_ref(arena_x.adj_op());
auto&& x_val = arena_x.val_op();
auto&& x_adj = arena_x.adj_op();

Comment on lines 46 to 51

for (Eigen::Index i = 0; i < M; ++i) {
// backprop for softmax
Eigen::VectorXd x_pre_softmax_adj
= -x_val.col(i) * x_adj.col(i).dot(x_val.col(i))
+ x_val.col(i).cwiseProduct(x_adj.col(i));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just make the memory x_pre_softmax_adj once

Suggested change
for (Eigen::Index i = 0; i < M; ++i) {
// backprop for softmax
Eigen::VectorXd x_pre_softmax_adj
= -x_val.col(i) * x_adj.col(i).dot(x_val.col(i))
+ x_val.col(i).cwiseProduct(x_adj.col(i));
Eigen::VectorXd x_pre_softmax_adj(x_val.rows());
for (Eigen::Index i = 0; i < M; ++i) {
// backprop for softmax
x_pre_softmax_adj.noalias()
= -x_val.col(i) * x_adj.col(i).dot(x_val.col(i))
+ x_val.col(i).cwiseProduct(x_adj.col(i));

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also change sum_to_zero_vector_backprop to just take in a matrix

*/
template <typename T>
void sum_to_zero_vector_backprop(T&& y_adj, const Eigen::VectorXd& z_adj) {
const auto N = y_adj.size();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave a small comment so people know z_adj is y_adj.size() + 1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added @params to the docstring and put the sizes there

+= arena_z_adj * arena_z.coeff(k) * (1.0 - arena_z.coeff(k));
}
reverse_pass_callback([arena_y, arena_x]() mutable {
const auto& res_val = to_ref(arena_x.val());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not need to_ref on any of the arena_x vals

const auto& res_val = to_ref(arena_x.val());

// backprop for log jacobian contribution to log density
arena_x.adj().array() += lp.adj() / res_val.array();
Copy link
Collaborator

@SteveBronder SteveBronder Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of confusing, why are we accumulating into the return values adjoints here?
EDIT: nvm I see this is the rhs of the jacobian adjustment. Though I can't think of anywhere else we change the outputs adjoints in the reverse pass of it's function. I need to think about this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can avoid it by making a copy of the adjoints if we want, though I'm pretty sure that nothing else in the AD graph can depend on the adjoints of this by this point

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just use auto lp_adj = so then it's just an expression and you don't need any memory

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean

 auto lp_adj = lp.adj() / res_val.array();

then in the below you can do res_val * (arena_x.adj() + lp_adj).dot(rev_val)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arena_x.adj() is used two places, so you'd be duplicating the work, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is resolved, the code no longer needs to modify the adjoint of the return

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.33 0.34 0.99 -0.91% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 1.02 2.34% faster
gp_regr/gen_gp_data.stan 0.02 0.02 1.06 6.1% faster
gp_regr/gp_regr.stan 0.09 0.09 1.05 5.21% faster
sir/sir.stan 67.99 65.9 1.03 3.07% faster
irt_2pl/irt_2pl.stan 3.89 3.92 0.99 -0.81% slower
eight_schools/eight_schools.stan 0.06 0.05 1.06 5.95% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.24 0.24 1.0 0.13% faster
pkpd/one_comp_mm_elim_abs.stan 18.82 18.84 1.0 -0.1% slower
garch/garch.stan 0.4 0.4 1.01 1.23% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.58 2.58 1.0 0.16% faster
arK/arK.stan 1.72 1.7 1.01 1.16% faster
gp_pois_regr/gp_pois_regr.stan 2.68 2.69 1.0 -0.15% slower
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.34 8.41 0.99 -0.88% slower
performance.compilation 190.29 177.33 1.07 6.81% faster
Mean result: 1.020708780696168

Jenkins Console Log
Blue Ocean
Commit hash: 69dc9570487240d79cce097c90aa37c55f213a30


Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping: 4
CPU MHz: 3478.441
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities

G++:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.37 0.31 1.2 16.51% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 1.06 5.46% faster
gp_regr/gen_gp_data.stan 0.03 0.02 1.1 9.32% faster
gp_regr/gp_regr.stan 0.09 0.09 1.04 3.96% faster
sir/sir.stan 70.13 66.23 1.06 5.56% faster
irt_2pl/irt_2pl.stan 4.07 3.97 1.03 2.51% faster
eight_schools/eight_schools.stan 0.05 0.05 1.02 1.7% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.25 0.25 1.02 1.69% faster
pkpd/one_comp_mm_elim_abs.stan 19.23 18.86 1.02 1.94% faster
garch/garch.stan 0.42 0.41 1.02 2.43% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.65 2.6 1.02 1.89% faster
arK/arK.stan 1.76 1.73 1.02 1.81% faster
gp_pois_regr/gp_pois_regr.stan 2.79 2.73 1.02 2.26% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.76 8.42 1.04 3.86% faster
performance.compilation 184.79 177.89 1.04 3.73% faster
Mean result: 1.0468621449125708

Jenkins Console Log
Blue Ocean
Commit hash: 69dc9570487240d79cce097c90aa37c55f213a30


Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping: 4
CPU MHz: 2400.000
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities

G++:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@spinkney
Copy link
Collaborator

Is this waiting for my review? I can do it next week, otherwise what else is needed?

@WardBrian
Copy link
Member Author

@spinkney this is waiting on final review from @SteveBronder and then us deciding if we’re okay with not preserving the existing code, otherwise it should be good

@spinkney
Copy link
Collaborator

Ok, I still think it's worth another issue on saving different transforms and creating how a user would specify that. For this PR I vote that we can just remove the existing code.

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.34 0.31 1.08 7.32% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 1.02 1.49% faster
gp_regr/gen_gp_data.stan 0.03 0.02 1.07 6.5% faster
gp_regr/gp_regr.stan 0.09 0.09 1.08 7.0% faster
sir/sir.stan 70.06 69.39 1.01 0.96% faster
irt_2pl/irt_2pl.stan 4.31 4.02 1.07 6.81% faster
eight_schools/eight_schools.stan 0.06 0.05 1.03 2.64% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.25 0.24 1.02 2.27% faster
pkpd/one_comp_mm_elim_abs.stan 20.04 18.84 1.06 5.97% faster
garch/garch.stan 0.43 0.4 1.07 6.8% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.76 2.62 1.05 4.97% faster
arK/arK.stan 1.76 1.75 1.01 0.76% faster
gp_pois_regr/gp_pois_regr.stan 3.03 2.73 1.11 9.71% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.81 8.46 1.04 3.98% faster
performance.compilation 182.82 178.55 1.02 2.33% faster
Mean result: 1.049411230989343

Jenkins Console Log
Blue Ocean
Commit hash: 10da93427a21be9ac1f5efc603226a592221bc40


Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping: 4
CPU MHz: 2400.000
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities

G++:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
arma/arma.stan 0.39 0.34 1.12 10.9% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.01 0.01 1.01 0.73% faster
gp_regr/gen_gp_data.stan 0.02 0.02 1.04 3.59% faster
gp_regr/gp_regr.stan 0.09 0.09 1.05 4.59% faster
sir/sir.stan 67.8 66.38 1.02 2.1% faster
irt_2pl/irt_2pl.stan 3.99 4.0 1.0 -0.14% slower
eight_schools/eight_schools.stan 0.06 0.05 1.03 3.11% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.25 0.24 1.01 1.24% faster
pkpd/one_comp_mm_elim_abs.stan 19.48 18.88 1.03 3.08% faster
garch/garch.stan 0.45 0.4 1.12 10.94% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.77 2.62 1.06 5.56% faster
arK/arK.stan 1.76 1.72 1.02 1.99% faster
gp_pois_regr/gp_pois_regr.stan 2.71 2.71 1.0 0.21% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.74 8.43 1.04 3.58% faster
performance.compilation 184.89 181.67 1.02 1.74% faster
Mean result: 1.0380373007382375

Jenkins Console Log
Blue Ocean
Commit hash: 3dcd12419d102d4023893031ac04c0b52dd79879


Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
Stepping: 4
CPU MHz: 2400.000
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities

G++:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang:
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@WardBrian WardBrian merged commit 01fa440 into develop Apr 28, 2025
34 checks passed
@WardBrian WardBrian deleted the ilr-simplex branch April 28, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add inverse ILR simplex transform

5 participants