You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[REQ] Add opt-in setting to enable builtin approximates for wp.inverse and wp.division #1199
Add an opt-in parameter: "use_rcp_approx", to disable/enable the explicit usage of the PTX intrinsic "div.approx" and "rcp.approx" for both FP32/FP64-based matrix inverses (wp.inverse) and division (wp.div).
i.e.
wp.div(a, b, use_rcp_approx = True)
wp.inverse(a, use_rcp_approx = True)
changed the title [-][REQ] Add opt-in reciprocal approximate setting to wp.inverse and wp.division[/-][+][REQ] Add opt-in builtin approximate setting to wp.inverse and wp.division[/+]on Jan 28, 2026
changed the title [-][REQ] Add opt-in builtin approximate setting to wp.inverse and wp.division[/-][+][REQ] Add opt-in setting to enable builtin approximates for wp.inverse and wp.division[/+]on Jan 28, 2026
This is now available on main (e8106c0). Rather than adding an opt-in parameter to the existing wp.div() / wp.inverse(), we introduced two new built-in functions:
wp.div_approx(a, b) â uses div.approx.f32 for float32; for float64, uses rcp.approx.ftz.f64 followed by a multiply (no div.approx.f64 exists in PTX)
wp.inverse_approx(a) â uses rcp.approx.f32 for float32 and rcp.approx.ftz.f64 for float64
This approach keeps the semantics explicit: callers opt in by choosing a different function rather than toggling a flag. Both fall back to exact arithmetic on CPU. Only floating-point scalar types are supported.
The merged changes look good but one thing worth noting is that it might be unexpected that float16 approximate division falls back to using full float32 division. It would make more sense to use the 32-bit div_approx. Not an immediate priority though.
The merged changes look good but one thing worth noting is that it might be unexpected that float16 approximate division falls back to using full float32 division. It would make more sense to use the 32-bit div_approx. Not an immediate priority though.
Sounds good, I'll prepare a change for this today so we don't have to risk confusing people with a behavior change in a future release.
Activity
[-][REQ] Add opt-in reciprocal approximate setting to wp.inverse and wp.division[/-][+][REQ] Add opt-in builtin approximate setting to wp.inverse and wp.division[/+][-][REQ] Add opt-in builtin approximate setting to wp.inverse and wp.division[/-][+][REQ] Add opt-in setting to enable builtin approximates for wp.inverse and wp.division[/+]shi-eric commentedon Feb 21, 2026
This is now available on
main(e8106c0). Rather than adding an opt-in parameter to the existingwp.div()/wp.inverse(), we introduced two new built-in functions:wp.div_approx(a, b)â usesdiv.approx.f32forfloat32; forfloat64, usesrcp.approx.ftz.f64followed by a multiply (nodiv.approx.f64exists in PTX)wp.inverse_approx(a)â usesrcp.approx.f32forfloat32andrcp.approx.ftz.f64forfloat64This approach keeps the semantics explicit: callers opt in by choosing a different function rather than toggling a flag. Both fall back to exact arithmetic on CPU. Only floating-point scalar types are supported.
Will ship in the 1.12.0 release.
Add div_approx and inverse_approx builtins for approximate PTX intrinâĶ
Merge branch 'ershi/approx-div' into 'main'
c0d1f1ed commentedon Feb 22, 2026
The merged changes look good but one thing worth noting is that it might be unexpected that
float16approximate division falls back to using fullfloat32division. It would make more sense to use the 32-bitdiv_approx. Not an immediate priority though.shi-eric commentedon Feb 22, 2026
Sounds good, I'll prepare a change for this today so we don't have to risk confusing people with a behavior change in a future release.
Add div_approx and inverse_approx builtins for approximate PTX intrinâĶ