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

Enable optimization on bpf2c generated code #3146

Merged
merged 3 commits into from
Jan 3, 2024

Conversation

Alan-Jowett
Copy link
Member

Description

Enable optimization flag when generating release versions of native binaries.

Testing

CI/CD

Documentation

No.

Installation

No.

Alan Jowett added 2 commits January 2, 2024 15:04
Copy link
Collaborator

@shpalani shpalani left a comment

Choose a reason for hiding this comment

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

Can you help clarify the significance of the below options?

@shpalani
Copy link
Collaborator

shpalani commented Jan 3, 2024

Can you help clarify the significance of the below options?

 <ClCompile>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
    </ClCompile>

This will also help to know why is BasicRuntimeChecks not used in the kernel mode. Thanks.

@Alan-Jowett
Copy link
Member Author

Can you help clarify the significance of the below options?

 <ClCompile>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
    </ClCompile>

This will also help to know why is BasicRuntimeChecks not used in the kernel mode. Thanks.

BasicRuntimeChecks are not supported in kernel mode.

The full list of options for this configuration node are here:
https://learn.microsoft.com/en-us/visualstudio/msbuild/cl-task?view=vs-2022

@Alan-Jowett Alan-Jowett added this pull request to the merge queue Jan 3, 2024
@shpalani
Copy link
Collaborator

shpalani commented Jan 3, 2024

Can you help clarify the significance of the below options?

 <ClCompile>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
    </ClCompile>

This will also help to know why is BasicRuntimeChecks not used in the kernel mode. Thanks.

BasicRuntimeChecks are not supported in kernel mode.

The full list of options for this configuration node are here: https://learn.microsoft.com/en-us/visualstudio/msbuild/cl-task?view=vs-2022

Thanks for sharing the link. Going through the list of options, I found the below to be useful too!
Optimization -- Full - /Ox
SmallerTypeCheck -- true
WholeProgramOptimization - true

Merged via the queue into microsoft:main with commit 3f5aa42 Jan 3, 2024
76 checks passed
@Alan-Jowett Alan-Jowett deleted the bpf2c_opt branch January 3, 2024 02:07
" Size\n"
" Section Type (bytes)\n"
"==================== ========= =======\n"
#if defined(NDEBUG)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This if tests whether the unit tests were compiled for Debug or Release, not whether bpf.sys was compiled for Debug or Release. As such, this test will fail in some manual cases. It would be better to accept both sizes, not only one size.

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.

5 participants