public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	bpf@vger.kernel.org,  ast@kernel.org, andrii@kernel.org
Cc: daniel@iogearbox.net, martin.lau@linux.dev, kernel-team@fb.com,
	 yonghong.song@linux.dev, shung-hsi.yu@suse.com,
	paul.chaignon@gmail.com,  harishankar.vishwanathan@gmail.com
Subject: Re: [PATCH RFC bpf-next 0/4] bpf: replace min/max fields with struct cnum{32,64}
Date: Tue, 21 Apr 2026 09:33:06 -0700	[thread overview]
Message-ID: <b9b278f28ff94dc3207624d304be1080584603a7.camel@gmail.com> (raw)
In-Reply-To: <DHYYQ6F0ZVAB.1FNAHDCF3WHKX@gmail.com>

On Tue, 2026-04-21 at 09:10 -0700, Alexei Starovoitov wrote:
> On Tue Apr 21, 2026 at 3:28 AM PDT, Eduard Zingerman wrote:
> > 
> > Debug metrics
> > =============
> > 
> > To understand the practical impact of the precision trade-offs,
> > two debug counters were added (here [3]):
> > 
> > - isec_overapprox: counts how many times cnum_intersect() in
> >   conditional branch refinement had to collapse two disjoint arcs into
> >   one, losing precision that the signed/unsigned pair could represent.
> > 
> > - crossing_poles: counts how many times an ALU operation produces a
> >   cnum that crosses both the unsigned (0/U_MAX) and signed
> >   (S_MAX/S_MIN) boundaries simultaneously. Such cnums cannot be
> >   represented as a pair of signed and unsigned ranges.
> > 
> > Across 6683 programs:
> > - crossing_poles fires 551K times for 21% of programs.
> > - isec_overapprox fires 119K times for 12% of programs,
> 
> so cnums win 551k times and lose 119k ?

Yes

> >   most programs have only 1-5 hits. The bulk comes from a few large
> >   sched_ext and profiling programs.
> 
> and most losses are in sched_ext, yet overall it's a win:
> 
>  scx_rusty.bpf.o  rusty_enqueue         39842      22053  -17789 (-44.65%)
>  scx_rusty.bpf.o  rusty_stopping        37738      19949  -17789 (-47.14%)
>  scx_wd40.bpf.o   wd40_stopping         37729      19880  -17849 (-47.31%)

Yes

> > - 801 programs have crossing_poles > 0 with isec_overapprox = 0.
> > - 202 programs have isec_overapprox > 0 with crossing_poles = 0.
> 
> similar wins vs losses story ?

Yes, is similar to the ratio for win/loss.
But it was counted when general win/loss summary was computed.
I guess, the main takeaway is that crossing_poles happens more often
than isec_overapprox and it can lead to some overall performance wins.
I thought about forking additional states if an over-approximation
is about to happen, but didn't to the experiment.

> 
> I think even without wins we have to adopt cnum-s mainly for memory
> savings. Once we move to model where do_check_insn() is a transfer
> function the memory savings will become more important.

  reply	other threads:[~2026-04-21 16:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 10:28 [PATCH RFC bpf-next 0/4] bpf: replace min/max fields with struct cnum{32,64} Eduard Zingerman
2026-04-21 10:28 ` [PATCH RFC bpf-next 1/4] bpf: representation and basic operations on circular numbers Eduard Zingerman
2026-04-21 11:16   ` bot+bpf-ci
2026-04-21 17:18   ` sashiko-bot
2026-04-21 17:45     ` Eduard Zingerman
2026-04-21 10:28 ` [PATCH RFC bpf-next 2/4] bpf: use accessor functions for bpf_reg_state min/max fields Eduard Zingerman
2026-04-21 10:28 ` [PATCH RFC bpf-next 3/4] bpf: replace min/max fields with struct cnum{32,64} Eduard Zingerman
2026-04-21 11:16   ` bot+bpf-ci
2026-04-21 16:23   ` Alexei Starovoitov
2026-04-21 16:48     ` Eduard Zingerman
2026-04-21 17:16       ` Alexei Starovoitov
2026-04-21 17:20         ` Eduard Zingerman
2026-04-21 18:06   ` sashiko-bot
2026-04-21 18:31     ` Eduard Zingerman
2026-04-21 10:28 ` [PATCH RFC bpf-next 4/4] selftests/bpf: new cases handled by 32->64 range refinements Eduard Zingerman
2026-04-21 16:10 ` [PATCH RFC bpf-next 0/4] bpf: replace min/max fields with struct cnum{32,64} Alexei Starovoitov
2026-04-21 16:33   ` Eduard Zingerman [this message]
2026-04-21 17:14     ` Alexei Starovoitov
2026-04-21 23:45 ` Eduard Zingerman
2026-04-22 14:50 ` Yazhou Tang
2026-04-22 15:03   ` Alexei Starovoitov
2026-04-22 15:32     ` Yazhou Tang
2026-04-22 16:13       ` Alexei Starovoitov
2026-04-23 11:23         ` shenghao yuan
2026-04-22 19:05   ` Eduard Zingerman
2026-04-23 11:45     ` shenghao yuan
2026-04-23 14:18       ` Yazhou Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9b278f28ff94dc3207624d304be1080584603a7.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=harishankar.vishwanathan@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=paul.chaignon@gmail.com \
    --cc=shung-hsi.yu@suse.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox