perf(amggpu): G1 throughput optimizations enabled by Hyperloom agent - 1#73
Open
usaxena-4md wants to merge 1 commit into
Open
perf(amggpu): G1 throughput optimizations enabled by Hyperloom agent - 1#73usaxena-4md wants to merge 1 commit into
usaxena-4md wants to merge 1 commit into
Conversation
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.
Summary
Performance optimizations for the Genesis rigid-body RL physics path. Some changes are AMD/gfx942-specific; others adjust kernel launch configuration and dispatch behavior that also apply to CUDA. No numerical behavior is changed.
Changes
Cross-backend (affects CUDA and AMD)
constraint/solver.py— CG solver dispatch interval@qd.perf_dispatch(repeat_after_seconds=5 → 3600)onfunc_solve_body. The dispatcher periodically re-benchmarks the CG solver variants (tiled_wc, wavecoop, monolith) on a timer; each re-evaluation runs extra substeps on slower variants plus Python dispatch overhead and pipeline flushes between switches. Raising the interval keeps the initial variant selection during warmup while avoiding repeated mid-run re-benchmarking. This is backend-agnostic.block_dim=64on hot loopsPinned
block_dim=64viaqd.loop_config(...)on:constraint/solver.py:add_collision_constraints,add_frictionloss_constraints, warmstart init loop infunc_solve_initcollider/broadphase.py:func_collision_clearcollider/narrowphase.py:func_narrow_phase_convex_vs_convex,func_narrow_phase_convex_specializations,func_narrow_phase_any_vs_terrain,func_narrow_phase_nonconvex_vs_nonterrainMotivation is AMD wave64 lane utilization (default 32-thread workgroups underfill the SIMD), but note
block_dimalso sets the CUDA block size, so this changes the launch configuration on CUDA as well (32 → 64 threads/block). Each environment is independent, so 64 threads/workgroup map cleanly onto envs with no data sharing. Metal serialize guards are preserved; the directive is skipped only on the pure-Python backend.kinematic_solver.py— avoid full-tensor clonesget_links_quat/get_links_angpreviously cloned the full(n_envs, n_links, 4)tensor before slicing. They now take a zero-copy view and clone only the requested slice whengs.use_zerocopyis enabled andlinks_idxis provided, falling back to the original path otherwise.use_zerocopydefaults on for both CUDA and AMD backends, so this path is exercised on CUDA too.AMD-only (gfx942 / CDNA3)
collider/collider.py— multicontact thread-count tuningInside
if torch.version.hip:, the CU multiplier is 256 → 64 andmax_items_per_thread128 → 512, keeping total processing capacity identical. The original launch oversubscribed wavefronts that mostly retire after a single empty-queue check; the tuned config gives each wavefront more real work, matching MI300X/MI325X occupancy. CUDA path is unchanged.constraint/solver_amdgpu.py— CG kernel occupancy hintamdgpu-waves-per-eu: "1,1"on_kernel_solve_body_tiled_wc_amdgpu(viafn_attrs={"amdgpu": ...}). Removes the JIT default"1,2"max constraint so the compiler can allocate VGPRs freely instead of spending effort on VGPR compression it can't satisfy. AMD compilation only.rigid_solver.py—kernel_step_1occupancy hintamdgpu-waves-per-eu: "3,4" → "1,4". The"3,4"target forced aggressive VGPR compression and triggered register spilling to scratch (compile-time occupancy warnings)."1,4"lets the compiler allocate VGPRs naturally while still packing waves where they fit. AMD compilation only.