Skip to content

[PERF IMPROVEMENT] func_update_constraint_batch: hoist Jaref load in constraint update loop#34

Open
lohiaj wants to merge 1 commit intoamd-integrationfrom
perf/jlohia/monolith-B-jaref
Open

[PERF IMPROVEMENT] func_update_constraint_batch: hoist Jaref load in constraint update loop#34
lohiaj wants to merge 1 commit intoamd-integrationfrom
perf/jlohia/monolith-B-jaref

Conversation

@lohiaj
Copy link
Copy Markdown

@lohiaj lohiaj commented Apr 25, 2026

Summary

Hoists constraint_state.Jaref[i_c, i_b] into a local in the per-constraint update loop used by func_solve_iter.

The same Jaref value is used multiple times in the friction, contact, and force update branches. Keeping it in a local makes the intended reuse explicit to Quadrants/LLVM and avoids re-materializing the same indexed load across branch-local computations.

The change is intentionally narrow:

  • no change to active-state writes
  • no loop fusion
  • no algorithmic change
  • no change to sparse_solve semantics

Correctness

Differential simulation against current amd-integration: position and velocity statistics remain within floating-point noise, and contact counts are identical.

Scope

Single file: genesis/engine/solvers/rigid/constraint/solver.py.

@lohiaj
Copy link
Copy Markdown
Author

lohiaj commented Apr 27, 2026

/run-ci

1 similar comment
@lohiaj
Copy link
Copy Markdown
Author

lohiaj commented Apr 27, 2026

/run-ci

@lohiaj lohiaj force-pushed the perf/jlohia/monolith-B-jaref branch from d7f57b9 to 0c5bd5b Compare April 27, 2026 07:04
@lohiaj
Copy link
Copy Markdown
Author

lohiaj commented Apr 27, 2026

/run-ci

@lohiaj lohiaj force-pushed the perf/jlohia/monolith-B-jaref branch from 0c5bd5b to a7fbfc1 Compare April 27, 2026 07:34
@lohiaj lohiaj changed the title [PERF IMPROVEMENT] func_update_constraint_batch: hoist Jaref load in constraint update loop [PERF IMPROVEMENT] monolith inner: hoist reused constraint and DoF bounds loads Apr 27, 2026
@lohiaj lohiaj force-pushed the perf/jlohia/monolith-B-jaref branch from a7fbfc1 to 0c5bd5b Compare April 27, 2026 11:00
@lohiaj lohiaj changed the title [PERF IMPROVEMENT] monolith inner: hoist reused constraint and DoF bounds loads [PERF IMPROVEMENT] func_update_constraint_batch: hoist Jaref load in constraint update loop Apr 27, 2026
@yaoliu13
Copy link
Copy Markdown
Collaborator

/run-ci

@lohiaj lohiaj changed the title [PERF IMPROVEMENT] func_update_constraint_batch: hoist Jaref load in constraint update loop [PERF IMPROVEMENT] func_update_constraint_batch: hoist Jaref + fuse cost loop Apr 28, 2026
@lohiaj
Copy link
Copy Markdown
Author

lohiaj commented Apr 28, 2026

/run-ci

@lohiaj lohiaj force-pushed the perf/jlohia/monolith-B-jaref branch from 21cd235 to 0c5bd5b Compare April 28, 2026 11:14
@lohiaj lohiaj changed the title [PERF IMPROVEMENT] func_update_constraint_batch: hoist Jaref + fuse cost loop [PERF IMPROVEMENT] func_update_constraint_batch: hoist Jaref load in constraint update loop Apr 28, 2026
@lohiaj
Copy link
Copy Markdown
Author

lohiaj commented Apr 28, 2026

/run-ci

1 similar comment
@lohiaj
Copy link
Copy Markdown
Author

lohiaj commented Apr 28, 2026

/run-ci

…constraint update loop

Hoist `constraint_state.Jaref[i_c, i_b]` into a local in the
per-constraint update loop used by `func_solve_iter`.

The same Jaref value is used multiple times in the friction, contact, and
force update branches. Keeping it in a local makes the intended reuse
explicit to Quadrants/LLVM and avoids re-materializing the same indexed
load across branch-local computations.

The change is intentionally narrow:
- no change to active-state writes
- no loop fusion
- no algorithmic change
- no change to sparse_solve semantics

Correctness verified locally by differential simulation against the current
`amd-integration` baseline: position and velocity statistics remain within
floating-point noise, and contact counts are identical.
@lohiaj lohiaj force-pushed the perf/jlohia/monolith-B-jaref branch from 0c5bd5b to 0b109fa Compare April 30, 2026 16:17
@lohiaj
Copy link
Copy Markdown
Author

lohiaj commented Apr 30, 2026

/run-ci

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.

2 participants