diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b398db1..3613b01 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,8 +7,11 @@ on: - main pull_request: -# Pin: 0.941.0, the latest release, and aeb v0.347, the one ae3d builds -# beside. 0.941.0 was a tracking bump, no source change (actor message +# Pin: 0.944.0, the latest release, and aeb v0.347, the one ae3d builds +# beside. 0.944.0 brings std.math's square root inline (aether#3852, an +# out-of-line call before: trees25 3% faster) and a returned view's +# release without a call (#3853); 0.942.0 and 0.943.0 were runtime and +# actor fixes nothing here uses. 0.941.0 was a tracking bump, no source change (actor message # batching and the account trip under a parent account, #3857 and #3858; # nothing here sends actor messages or sets a memory account). 0.940.0 # brings lane min/max as minps/maxps (aether#3815) and @@ -32,7 +35,7 @@ on: # bootstrap version: the floor this code needs, verified by every job # below. env: - AE_PIN: 0.941.0 + AE_PIN: 0.944.0 AEB_REF: v0.347 jobs: diff --git a/README.md b/README.md index aca1e02..e64d18b 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Install Aether with the version-pinned installer (it puts `ae` and `aeb` in ```sh curl -fsSL https://raw.githubusercontent.com/aether-lang-dev/aeb/main/get.sh \ - | AE_PIN=0.941.0 AEB_REF=v0.347 sh + | AE_PIN=0.944.0 AEB_REF=v0.347 sh export PATH="$HOME/.local/bin:$PATH" ``` diff --git a/aephysics/contact_solver_wide/module.ae b/aephysics/contact_solver_wide/module.ae index fa9da54..7f7ba7b 100644 --- a/aephysics/contact_solver_wide/module.ae +++ b/aephysics/contact_solver_wide/module.ae @@ -99,15 +99,20 @@ struct PtrW { l7: ptr } -// A lane of a wide value, read by index: the store works a contact at -// a time, where the stages before it work eight. -lane(f: f32x8, index: int) -> float { return (lanes.lane8(f, index as long)) as float } - int_lane(v: *IntW, index: int) -> int { lanes = (v as ptr) as int[] return lanes[index] } +// A lane of a wide value where it lies in memory, read as one float (the +// reference's ((float*)&value)[lane]). lanes.lane8 takes the vector by +// value, and an index known only at run time costs a 32-byte load, a spill +// and a reload. +lane_at(v: ptr, index: int) -> f32 { + lanes = v as f32[] + return lanes[index] +} + ptr_lane(v: *PtrW, index: int) -> ptr { lanes = (v as ptr) as ptr[] return lanes[index] @@ -1005,21 +1010,21 @@ store_wide_range(ctx: *StepContext, color: *GraphColor, start: int, end: int, hi m = ptr_lane(&c.manifolds, l) as *Manifold // In single precision, as the reference stores it. lw = l as long - f1 = lanes.lane8(c.friction_impulse.x, lw) - f2 = lanes.lane8(c.friction_impulse.y, lw) - m.friction_impulse = Vec3f { x: f1 * lanes.lane8(c.tangent1.x, lw) + f2 * lanes.lane8(tangent2.x, lw), - y: f1 * lanes.lane8(c.tangent1.y, lw) + f2 * lanes.lane8(tangent2.y, lw), - z: f1 * lanes.lane8(c.tangent1.z, lw) + f2 * lanes.lane8(tangent2.z, lw) } - m.twist_impulse = lane(c.twist_impulse, l) - m.rolling_impulse = Vec3f { x: lanes.lane8(c.rolling_impulse.x, l as long), y: lanes.lane8(c.rolling_impulse.y, l as long), z: lanes.lane8(c.rolling_impulse.z, l as long) } + f1 = lane_at((&c.friction_impulse.x) as ptr, l) + f2 = lane_at((&c.friction_impulse.y) as ptr, l) + m.friction_impulse = Vec3f { x: f1 * lane_at((&c.tangent1.x) as ptr, l) + f2 * lanes.lane8(tangent2.x, lw), + y: f1 * lane_at((&c.tangent1.y) as ptr, l) + f2 * lanes.lane8(tangent2.y, lw), + z: f1 * lane_at((&c.tangent1.z) as ptr, l) + f2 * lanes.lane8(tangent2.z, lw) } + m.twist_impulse = lane_at((&c.twist_impulse) as ptr, l) + m.rolling_impulse = Vec3f { x: lane_at((&c.rolling_impulse.x) as ptr, l), y: lane_at((&c.rolling_impulse.y) as ptr, l), z: lane_at((&c.rolling_impulse.z) as ptr, l) } point_count = m.point_count point_index = 0 while point_index < point_count { cp = wide_point_at(c, point_index) mp = dynamics.manifold_point_at(m, point_index) - mp.normal_impulse = lane(cp.normal_impulse, l) - mp.total_normal_impulse = lane(cp.total_normal_impulse, l) - mp.normal_velocity = lane(cp.relative_velocity, l) + mp.normal_impulse = lane_at((&cp.normal_impulse) as ptr, l) + mp.total_normal_impulse = lane_at((&cp.total_normal_impulse) as ptr, l) + mp.normal_velocity = lane_at((&cp.relative_velocity) as ptr, l) point_index = point_index + 1 } if (c.hit_lanes & (1 << l)) != 0 {