perf(thermal): take the heat map's short steps only around the torch

While the torch cuts, every cell of the plate took steps short enough to
follow it: 4 to 76 times more steps than diffusion needs. On the processor
only the cells within four cells of the torch's recent path take them now;
the rest of the plate takes one long step per slot. A full sheet at
quarter-inch cells runs in 0.23-0.45 s instead of 0.9-2.9 s, and a fast
feed no longer makes it slower.

Peaks stay within 1% of the color scale at the 99th percentile of the
whole-plate result. Graphics cards keep whole-plate steps. Decay factors
for the support bed are worked out per distinct contact fraction.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Fable 5.2 committed 2026-12-02 20:21:08 -05:00
1 parent 8493f8c7f8
commit ff8f97f44a
6 files changed
+423 -49

No files matched your search

+28 -11
View File
@@ -29,11 +29,23 @@ a removed heat-aware sequencer used a cheaper estimate of the same physics ([Seq
that move's speed (half a cell where cells are under 4 mm), but not shorter than 5 ms for that.
A step adds its heat all at once, so a longer one shows stripes along a straight cut; rapids and
pierces keep the long steps (`HeatStepSchedule`). Splits come from a short list of counts, and
the boundaries depend on the timeline alone, so a replay takes the same steps. This limit does
not enter the choice of cell size, so a fast feed can take a few times longer to run. Sheet edges
the boundaries depend on the timeline alone, so a replay takes the same steps. Sheet edges
are insulated. A rise below 1e-30 °C is set to zero: the front of the spreading heat would
otherwise pass through subnormal floats, which make each step several times slower. It changes
no cell above about 1e-18 °C.
- Short steps only around the torch: on the processor, the short steps of a slot are taken only by
the window of cells within four cells of where the torch put heat during those steps or during
the slot before them (which keeps the cells beside a fresh cut on short steps until their own
peak has passed). The cells touching the window hold their starting values meanwhile, and every
other cell takes one step as long as the short ones together (`StepInterval`). Heat moves about a
cell per slot, so the cells past the window change too slowly to need more. A piece that changes
inside a slot ends the long step there, and a new one starts; steps in which the torch adds no
heat are one long step for every cell. Compared with every cell taking the
short steps, on full sheets at 100 to 1600 in/min: peaks differ by under 1% of the color scale
at the 99th percentile and a few dozen cells of 115,200 by more than 5%, final temperatures by
under 0.1%, total heat by under 0.06%, and the stripe check is unchanged. For scale, halving
every step moves the peaks by 5-7% at the 99th percentile. So a fast feed no longer makes the
run longer. `ThermalParameters.WholePlateSteps` (internal) turns the window off for comparison.
- Loss: convection from both faces at `SurfaceCoefficient` (W/m²·K), plus, when
`ThermalParameters.SupportBed` is given, contact with the bed through the bottom face at
`ContactCoefficient` (W/m²·K) times each cell's share of area over the bed. The share is the
@@ -69,9 +81,10 @@ Each step runs a vector of cells at a time, with the links between neighbors of
precomputed as 1 or 0 whenever the pieces change; grids of 65,536 cells or more split each
step across processors. Neither changes a result bit.
A straight run from the start (one never stopped short of a scheduled step) keeps checkpoints of
the temperatures, peaks and event cursors, about every 500,000 cell updates and within 128 MB,
more widely spaced on large grids. The simulator's first run to the end, made to set the color
A straight run from the start (one never stopped short of a scheduled step, or partway through
a slot's run of short steps) keeps checkpoints of the temperatures, peaks and event cursors, about
every 500,000 cell updates of short steps and within 128 MB, more widely spaced on large grids.
The simulator's first run to the end, made to set the color
scale, lays them down. Going back in time, or more than eight steps ahead, resumes from the
latest checkpoint that a straight run to the target passes, so a seek steps through at most one
checkpoint's interval instead of the whole run, and gives exactly the state a straight run from
@@ -92,15 +105,19 @@ a usable card, or when it fails while building or playing (out of memory, driver
runs on the processor with the cell size that suits it.
The simulation keeps the pieces, timeline and checkpoints and the card keeps the temperatures.
Its results are not bit for bit the processor's (devices may fuse a multiply and an add): measured
within one part in a million. The processor stays the reference. `GpuHeatAcceleratorTests`
compares the two within a tolerance, running the card's programs on ILGPU's processor emulation
On the card every cell takes the short steps, so its picture differs from the processor's by what
the window costs (above). Against the processor taking whole-plate steps too, its results are
within one part in a million, not bit for bit (devices may fuse a multiply and an add). The
processor stays the reference. `GpuHeatAcceleratorTests` compares the card with whole-plate steps
on the processor within a tolerance, running the card's programs on ILGPU's processor emulation
everywhere and on a real card where there is one (skipped otherwise, as on build agents). A
change to `DiffuseCells` or `Add` needs the same change in `OpenNest.Gpu/HeatKernels.cs`.
Measured on a Ryzen 7 3700X and an RTX 4060, two 5×10 ft nests, 100 and 400 in/min: 0.125 in
cells took 9-23 s on the processor and 0.8-1.6 s on the card with the previous step schedule,
which took more steps than this one.
Measured on a Ryzen 7 3700X and an RTX 4060, 5×10 ft nests, 0.25 in and 16 gauge mild steel at
100 to 1600 in/min, whole run: 0.25 in cells took 0.9-2.9 s on the processor before the window
and take 0.23-0.45 s with it; the card takes 0.45-1.0 s, most of it the fixed cost of starting
two programs per step, so at this cell size the processor is now the faster of the two. 0.125 in
cells take 1.3-6.2 s on the processor (11-22 s before) and 1.1-2.7 s on the card.
## Display