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

Source Generators based Toolchain #1770

Open
adamsitnik opened this issue Aug 11, 2021 · 12 comments
Open

Source Generators based Toolchain #1770

adamsitnik opened this issue Aug 11, 2021 · 12 comments
Milestone

Comments

@adamsitnik
Copy link
Member

adamsitnik commented Aug 11, 2021

From the .NET Team perspective we quite often hit some build-related issues that require us to change BDN source code and update to latest version. This is especially painful with the WASM toolchain which needs to catch up with a very quickly envolving WASM project build requirements. (cc @naricc @radekdoulik @Lxiamail) It's also a problem for early .NET adopters like ASP.NET Team (cc @halter73 @sebastienros @davidfowl) and projects that use a lot of custom MSBuild settings like ML.NET (@eerhardt).

BDN also lacks the possibility to build the benchmarks on one machine, copy it to a different machine that has no .NET SDK installed and run them there (cc @billwert @DrewScoggins @ig-sinicyn).

I'be been thinking about it for a while and I believe that we could solve both problems by implementing a toolchain that takes advantage of C# Source Generators. The idea I have is following:

  1. Use source generators to generate the boilerplate code (in theory all custom MSBuild setting works OOTB)
  2. The host process starts new benchmarks by using it's own exe path, but with a different set of arguments that are recognized and translated to "find selected benchmark in the assembly and run it".
  3. Users should be allowed to specify the runner exe path and args without modifying BDN. Example: V8 for WASM, CoreRun for dotnet/runtime builds.

It would defnitely not become the default toolchain (at least for now) because of the following limitations:

  • no F# support (me and @AndreyAkinshin care about F#)
  • no ability to run benchmarks for a different runtime (no --runtimes support)

I am also not sure what would be the performance of C# Source Generators in case of dotnet/performance Microbenchmarks.csproj that contains 3.5k benchmarks (the boilerplate generated with the existing toolchains in dotnet/performance is more than one million lines of source code and Roslyn fails with OOTM for x86 when we try to run all the benchmarks).

cc @jeffhandley @danmoseley

@adamsitnik adamsitnik added this to the v0.13.x milestone Aug 11, 2021
@DavidFowler
Copy link

DavidFowler commented Aug 11, 2021 via email

@danmoseley
Copy link
Member

@davidfowl

@naricc
Copy link
Member

naricc commented Aug 11, 2021

Almost all the trouble I've had around wasm has been around SDK changes or changes to the all the build infrastructure around wasm apps (like, how to use the AOT compiler, how to bundle a wasm app, etc). So I am not sure I understand how source generators help?

@adamsitnik
Copy link
Member Author

So I am not sure I understand how source generators help?

Instead of applying the fix in BDN logic that generates project files you would fix the project file in dotnet/performance.

@naricc
Copy link
Member

naricc commented Jan 18, 2022

@adamsitnik So I am planning to start work on this soon, and am thinking about the design now. I've never done anything with source generators before and want to make sure I understand the idea.

We want to have a tool chain in BDN that calls into generated code, right? With the generated code eventually produced by clients (like the Microbenchmark harness in dotnet/performance).

I am also not sure what you meant in point 2. above:

The host process starts new benchmarks by using it's own exe path, but with a different set of arguments that are recognized and translated to "find selected benchmark in the assembly and run it.

Is that only for remote runs?

@DavidFowler
Copy link

DavidFowler commented Jan 18, 2022 via email

@danmoseley
Copy link
Member

Sorry @DavidFowler (but welcome to our project 😉)

@davidfowl was intended

@danmoseley
Copy link
Member

@DavidFowler as you probably know, you can hit unsubscribe, either on this page on the right side, or using the link in the email you may have gotten.

@radekdoulik
Copy link
Member

Adding @radical to the discussion. He is working on the wasm host app prototype, which might provide some of the functionality you are looking for?

@timcassell
Copy link
Collaborator

The host process starts new benchmarks by using it's own exe path, but with a different set of arguments that are recognized and translated to "find selected benchmark in the assembly and run it".

I think we should have an in-process option for that, too.

@xoofx
Copy link
Member

xoofx commented May 14, 2023

Hey, I recently fought quite a bit with custom toolchain and runtime, and I'm also very supportive of a source generator approach! 😊

@adamsitnik one question I was wondering when also looking around about a related issue like #1403: as I understand it, a source generator approach could avoid entirely to generate separate csprojs (and the complication of replicating the build to a different folder as it is suggested in 1403), is that what you had in mind?

@adamsitnik
Copy link
Member Author

is that what you had in mind?

Exactly!

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

No branches or pull requests

7 participants