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

[vcpkg_execute_*_process] Add support for build profiling #22676

Merged
merged 1 commit into from
Jun 10, 2022
Merged

[vcpkg_execute_*_process] Add support for build profiling #22676

merged 1 commit into from
Jun 10, 2022

Conversation

mkhon
Copy link
Contributor

@mkhon mkhon commented Jan 21, 2022

Describe the pull request

Use --x-cmake-args=-DX_PORT_PROFILE=TRUE to enable profiling

  • What does your PR fix?

  • Which triplets are supported/not supported? Have you updated the CI baseline?

all

Yes

  • If you have added/updated a port: Have you run ./vcpkg x-add-version --all and committed the result?

Yes

If you are still working on the PR, open it as a Draft: https://github.blog/2019-02-14-introducing-draft-pull-requests/

@JackBoosY JackBoosY self-assigned this Jan 21, 2022
@JackBoosY JackBoosY added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label Jan 21, 2022
@JackBoosY JackBoosY requested a review from BillyONeal January 21, 2022 07:50
@Neumann-A
Copy link
Contributor

i don't see why this should be an env variable. You cann simply pass --x-cmake-args=<value> to vcpkg (this deactivates binary caching but the env approach suggest also changes the hash of binary caching which is undesired unless the variable is added to UNTRACKED )

@mkhon
Copy link
Contributor Author

mkhon commented Jan 21, 2022

i don't see why this should be an env variable. You cann simply pass --x-cmake-args=<value> to vcpkg (this deactivates binary caching but the env approach suggest also changes the hash of binary caching which is undesired unless the variable is added to UNTRACKED )

I updated the patch so that it now uses a plain variable

z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/time-1.9-2-x86_64.pkg.tar.zst"
SHA512 923607127f3a9c644136a3e6cc76885ddcd75e7f964e4732d6897af72ca334af5c8bd69debde19985c8e785979006da41d0df34a230b6bdebd5b6ca2ab29774b
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really needed? There is cmake -E time <cmd>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

vcpkg also logs elapsed time required to build a package.
This change allows to measure configure/build stages separately.

I used it to measure libtool-related optimization fix (cuts off about 2x from gettext[tools] build time) and just submitted it because I thought it might be generally useful.

Copy link
Contributor

@dg0yt dg0yt Jan 23, 2022

Choose a reason for hiding this comment

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

I know what you are trying to achieve. I'm proposing you shouldn't use the time command which doesn't exist on Windows but the portable alternative offered by CMake.

list(GET arg_COMMAND 0 command)
if(NOT command MATCHES [[/msys2/]])
message(STATUS "Using MSYS2_ARG_CONV_EXCL=*")
set(ENV{MSYS2_ARG_CONV_EXCL} "*")
Copy link
Contributor

Choose a reason for hiding this comment

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

This changes msys2 behaviour for all commands. This may create unexpected problems. Same for the other scripts where this pattern is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May be I am missing something, but on the contrary - this chunk is to not change anything for msys2 and non-msys2 (do not convert arguments) commands

Copy link
Contributor

@dg0yt dg0yt Jan 23, 2022

Choose a reason for hiding this comment

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

This environment variable affects conversions deeper down below the initial command:

  • With PORT_PROFILE false: Default or user-defined msys argument conversion behaviour.
  • With PORT_PROFILE true: No msys argument conversion at all.

We don't know how often the flow of control crosses between msys (e.g. make) and windows (e.g. cmake) environments. If it works now (no PORT_PROFILE), it can break with PORT_PROFILE evaluating to true.
So it is a ticking bomb IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dg0yt I re-implemented the change using "cmake -E time"

@JackBoosY
Copy link
Contributor

@BillyONeal Any suggestions here?

@JackBoosY JackBoosY added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Jan 27, 2022
Copy link
Contributor

@ras0219-msft ras0219-msft left a comment

Choose a reason for hiding this comment

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

This LGTM, except that we'd like to first introduce this as an experimental flag (X_....).

I would also suggest reversing the flag name to be X_PROFILE_PORT, but that's a looser suggestion.

Thanks!

@mkhon
Copy link
Contributor Author

mkhon commented Jan 29, 2022

This LGTM, except that we'd like to first introduce this as an experimental flag (X_....).

I would also suggest reversing the flag name to be X_PROFILE_PORT, but that's a looser suggestion.

Thanks!

I was just following the "convention" of PORT_DEBUG flag

@mkhon
Copy link
Contributor Author

mkhon commented Jan 29, 2022

This LGTM, except that we'd like to first introduce this as an experimental flag (X_....).

I would also suggest reversing the flag name to be X_PROFILE_PORT, but that's a looser suggestion.

Thanks!

I updated the PR to use X_PORT_PROFILE

@JackBoosY JackBoosY changed the title Add support for build profiling [vcpkg_execute_*_process]Add support for build profiling Feb 6, 2022
@JackBoosY JackBoosY changed the title [vcpkg_execute_*_process]Add support for build profiling [vcpkg_execute_*_process] Add support for build profiling Feb 6, 2022
@JackBoosY
Copy link
Contributor

FAILED: test/integration/INTEGRATION_locale_fix.exe 
cmd.exe /C "cd . && D:\downloads\tools\cmake-3.21.1-windows\cmake-3.21.1-windows-i386\bin\cmake.exe -E vs_link_exe --intdir=test\integration\CMakeFiles\INTEGRATION_locale_fix.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe  test\integration\CMakeFiles\INTEGRATION_locale_fix.dir\locale_fix.cc.obj test\integration\CMakeFiles\INTEGRATION_locale_fix.dir\__\__\src\win\tinyxml\tinystr.cpp.obj test\integration\CMakeFiles\INTEGRATION_locale_fix.dir\__\__\src\win\tinyxml\tinyxmlerror.cpp.obj test\integration\CMakeFiles\INTEGRATION_locale_fix.dir\__\__\src\win\tinyxml\tinyxml.cpp.obj test\integration\CMakeFiles\INTEGRATION_locale_fix.dir\__\__\src\win\tinyxml\tinyxmlparser.cpp.obj  /out:test\integration\INTEGRATION_locale_fix.exe /implib:test\integration\INTEGRATION_locale_fix.lib /pdb:test\integration\INTEGRATION_locale_fix.pdb /version:0.0 /nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF   /subsystem:console -LIBPATH:D:\buildtrees\sdformat6\x64-windows-rel\src   -LIBPATH:D:\buildtrees\sdformat6\x64-windows-rel\test gtest.lib  gtest_main.lib  sdformat.lib  D:\installed\x64-windows\lib\ignition-math4.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D D:\buildtrees\sdformat6\x64-windows-rel\test\integration && D:\downloads\tools\cmake-3.21.1-windows\cmake-3.21.1-windows-i386\bin\cmake.exe -E copy_if_different D:/buildtrees/sdformat6/x64-windows-rel/src/sdformat.dll D:/buildtrees/sdformat6/x64-windows-rel/test/integration""
Error copying file (if different) from "D:/buildtrees/sdformat6/x64-windows-rel/src/sdformat.dll" to "D:/buildtrees/sdformat6/x64-windows-rel/test/integration".

Not related to this changes.

@JackBoosY JackBoosY added depends:different-pr This PR or Issue depends on a PR which has been filed and removed requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. labels Feb 6, 2022
@JackBoosY JackBoosY removed the depends:different-pr This PR or Issue depends on a PR which has been filed label Feb 8, 2022
@JackBoosY
Copy link
Contributor

Ping @ras0219-msft for review this again.

@JackBoosY
Copy link
Contributor

Can you please merge this branch to master so I can review again?

Thanks!

@JackBoosY
Copy link
Contributor

Depends on #24542.

@JackBoosY JackBoosY added depends:different-pr This PR or Issue depends on a PR which has been filed and removed requires:author-response depends:different-pr This PR or Issue depends on a PR which has been filed labels May 5, 2022
@BillyONeal
Copy link
Member

I killed the job attempting to "recheck" here because it wouldn't have gotten the merge of the dependent PR. We need a merge with master to pick up #24542 now that it has been merged.

@JackBoosY
Copy link
Contributor

Please merge this branch to master, we don't have the permission to push any changes.

@mkhon
Copy link
Contributor Author

mkhon commented May 7, 2022

Please merge this branch to master, we don't have the permission to push any changes.

Done

@JackBoosY
Copy link
Contributor

When building mesa[core,default-features,gles1,gles2,llvm,opengl]:x64-windows:

../src/esa-21.2.5-2df234d2b1.clean/src/compiler/glsl/glcpp/glcpp-lex.l(624): error C2059: syntax error: 'constant'
../src/esa-21.2.5-2df234d2b1.clean/src/compiler/glsl/glcpp/glcpp-lex.l(624): error C2059: syntax error: 'bad suffix on number'
../src/esa-21.2.5-2df234d2b1.clean/src/compiler/glsl/glcpp/glcpp-lex.l(624): error C2001: newline in constant
../src/esa-21.2.5-2df234d2b1.clean/src/compiler/glsl/glcpp/glcpp-lex.l(647): error C2059: syntax error: 'break'
../src/esa-21.2.5-2df234d2b1.clean/src/compiler/glsl/glcpp/glcpp-lex.l(647): error C2059: syntax error: ']'
../src/esa-21.2.5-2df234d2b1.clean/src/compiler/glsl/glcpp/glcpp-lex.l(649): error C2059: syntax error: 'while'
../src/esa-21.2.5-2df234d2b1.clean/src/compiler/glsl/glsl_lexer.ll(339): error C2059: syntax error: '['
../src/esa-21.2.5-2df234d2b1.clean/src/compiler/glsl/glsl_lexer.ll(343): error C2059: syntax error: 'break'

But file glcpp-lex.l only have 622 lines.
@Neumann-A @cenit Any ideas?

@JackBoosY
Copy link
Contributor

@BillyONeal I think we can review this again.

@BillyONeal
Copy link
Member

BillyONeal commented May 16, 2022

Is there a reason we shouldn't just always do this instead of requiring use of a flag?

@JackBoosY
Copy link
Contributor

Ping @mkhon

@mkhon
Copy link
Contributor Author

mkhon commented May 31, 2022

I removed X_PORT_PROFILE in the new version

@mkhon
Copy link
Contributor Author

mkhon commented Jun 2, 2022

The failures I see are caused by individual port build errors and are not related to the change I suggest

@JackBoosY
Copy link
Contributor

Can you please merge this branch to master since I have no permission to push to this branch?

Use --x-cmake-args=-DX_PORT_PROFILE=TRUE to enable port build profiling
@mkhon
Copy link
Contributor Author

mkhon commented Jun 6, 2022

Can you please merge this branch to master since I have no permission to push to this branch?

Done

@JackBoosY
Copy link
Contributor

air-ctl regression is fixing in #25113.

@JackBoosY JackBoosY added the info:reviewed Pull Request changes follow basic guidelines label Jun 10, 2022
@ras0219-msft ras0219-msft merged commit 2e4c6df into microsoft:master Jun 10, 2022
@ras0219-msft
Copy link
Contributor

I think we might consider turning this on be default in the future, but this is at least a nice feature to have experimentally. Thanks for your contribution!

@mkhon mkhon deleted the feature/build-profiling branch June 10, 2022 18:03
@dg0yt
Copy link
Contributor

dg0yt commented Jun 10, 2022

Thanks for this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants