Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BPF] Avoid potential long compilation time without -g #96575

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

yonghong-song
Copy link
Contributor

Alastair Robertson reported a huge compilation time increase without -g for bpf target when comparing to x86 ([1]). In my setup, with '-O0', for x86, a large basic block compilation takes 0.19s while bpf target takes 2.46s. The top function which contributes to the compile time is eliminateFrameIndex().

Such long compilation time without -g is caused by commit
05de2e4 ("[bpf] error when BPF stack size exceeds 512 bytes")
The compiler tries to get some debug loc by iterating all insns in the basic block which will be used when compiler warns larger-than-512 stack size. Even without -g, such iterating also happens which cause unnecessary compile time increase.

To fix the issue, let us move the related code when the compiler is about to warn stack limit violation. This fixed the compile time regression, and on my system, the compile time is reduced from 2.46s to 0.35s.

[1] bpftrace/bpftrace#3257

Alastair Robertson reported a huge compilation time increase
without -g for bpf target when comparing to x86 ([1]). In my setup,
with '-O0', for x86, a large basic block compilation takes 0.19s
while bpf target takes 2.46s. The top function which contributes
to the compile time is eliminateFrameIndex().

Such long compilation time without -g is caused by commit
  05de2e4 ("[bpf] error when BPF stack size exceeds 512 bytes")
The compiler tries to get some debug loc by iterating all insns
in the basic block which will be used when compiler warns
larger-than-512 stack size. Even without -g, such iterating also
happens which cause unnecessary compile time increase.

To fix the issue, let us move the related code when the compiler
is about to warn stack limit violation. This fixed the
compile time regression, and on my system, the compile time
is reduced from 2.46s to 0.35s.

  [1] bpftrace/bpftrace#3257
@yonghong-song yonghong-song requested review from eddyz87 and 4ast June 24, 2024 23:14
Copy link
Member

@4ast 4ast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Thanks for fixing my mess.

@yonghong-song yonghong-song merged commit fb07afe into llvm:main Jun 25, 2024
11 checks passed
AlexisPerry pushed a commit to llvm-project-tlp/llvm-project that referenced this pull request Jul 9, 2024
Alastair Robertson reported a huge compilation time increase without -g
for bpf target when comparing to x86 ([1]). In my setup, with '-O0', for
x86, a large basic block compilation takes 0.19s while bpf target takes
2.46s. The top function which contributes to the compile time is
eliminateFrameIndex().

Such long compilation time without -g is caused by commit
  05de2e4 ("[bpf] error when BPF stack size exceeds 512 bytes")
The compiler tries to get some debug loc by iterating all insns in the
basic block which will be used when compiler warns larger-than-512 stack
size. Even without -g, such iterating also happens which cause
unnecessary compile time increase.

To fix the issue, let us move the related code when the compiler is
about to warn stack limit violation. This fixed the compile time
regression, and on my system, the compile time is reduced from 2.46s to
0.35s.

  [1] bpftrace/bpftrace#3257

Co-authored-by: Yonghong Song <yonghong.song@linux.dev>
@yonghong-song yonghong-song deleted the debug-loc branch February 8, 2025 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants