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

Remove GraphicsAPI generic for WgpuRuntime #1888

Merged
merged 4 commits into from
Jun 17, 2024

Conversation

ArthurBrussee
Copy link
Contributor

Checklist

  • Confirmed that run-checks all script has been executed.
  • Made sure the book is up to date with changes in this PR.

Changes

Slightly cheeky PR so bear with me :)

Ran into some annoying trait bounds while trying to do some stuff and rather than just grumble, felt like I could remove this entirely! A WgpuRuntime is a WgpuRuntime - irregardless of what the graphics API is. This is particularly evident with runtime::init_existing_device() - it's possible to register a DX12 device, and yet run it on a BurnRuntime which just seems wrong!

I understand it's used to manually pick a graphics API, but, you can already do this with

runtime::init_sync<Vulkan>();

This could also be in RuntimeOptions perhaps, for consistency.

All that said, this is a bit of miscellaneous design change in a PR so thanks for bearing with me :)

@ArthurBrussee ArthurBrussee changed the title Remove G for WgpuRuntime Remove GraphicsAPI generic for WgpuRuntime Jun 13, 2024
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 86.07%. Comparing base (5e58ae1) to head (2922f83).
Report is 4 commits behind head on main.

Files Patch % Lines
crates/burn-wgpu/src/runtime.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1888      +/-   ##
==========================================
- Coverage   86.14%   86.07%   -0.07%     
==========================================
  Files         778      781       +3     
  Lines       90827    91615     +788     
==========================================
+ Hits        78245    78862     +617     
- Misses      12582    12753     +171     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +49 to +50
let (adapter, device_wgpu, queue) =
pollster::block_on(create_wgpu_setup::<AutoGraphicsApi>(device));
Copy link
Member

Choose a reason for hiding this comment

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

So if I understand it well, this is where the default runtime is actually created for a device type. It uses the AutoGraphicsApi to select the most appropriate adaptor for the device. If you want to specify manually the graphics API for a device type, you have to use init_sync or init_async!

I don't think this is a bad thing, now the WgpuBackend only has typical backend generics, and runtime options can be changed using the init functions! Before merging I would add a bit more documentation on the WgpuRuntime and WgpuBackend pointing to the right direction to specify backend and runtime options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep that's right! Seemed coherent to me to have one "advanced initialize" place, glad you agree :)

Have added some docs now, and a random code cleanup, lmk how this looks!

@nathanielsimard nathanielsimard merged commit ac9f942 into tracel-ai:main Jun 17, 2024
14 checks passed
@ArthurBrussee ArthurBrussee deleted the remove-g branch July 2, 2024 16:50
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.

2 participants