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

WebGPU issues #8192

Open
2 of 3 tasks
brokedRobot opened this issue Jun 15, 2024 · 2 comments
Open
2 of 3 tasks

WebGPU issues #8192

brokedRobot opened this issue Jun 15, 2024 · 2 comments
Labels

Comments

@brokedRobot
Copy link

Issue Type

Before opening an issue, please search and see if it has already been raised.

  • Bug Report
  • Feature Request
  • Successfully reproduced against the latest version of NW.js?

Please use our mailing list or Gitter chatroom to ask questions. The issue tracker is only for bugs and feature requests, in English only. Please note that issues without a repro or code snippet are less likely to be resolved.

Current/Missing Behavior

WebGPU examples don't run

Expected/Proposed Behavior

WebGPU functions with parity to other Chromium based applications like Electron, MS Edge, and Chrome

Additional Info

Included below

  • Operating System: Windows 10 x64
  • NW.js Version: 0.88.0
  • Repro Link: https://chat.webllm.ai/
  • Code snippet: N/A
  • Crash report: N/A

Hi,

I hope I'm posting this in the correct area. I'm not sure if it is a bug/issue or not, but I've encountered a lot of issues viewing any demos that use WebGPU on nwjs. In specific, the webllm demo loads like it normally would on Electron, Chrome, and MS Edge, however, instead of saying "Loaded onto gpu - nvidia" when it completes, like in the aforementioned Chromium-based browsers, in nwjs it instead prints "Loaded onto gpu - google" (and the same thing goes for the web stable diffusion wasm example.) Update: I found more info and it's apparently a fallback adapter.

It then runs extremely slow compared to the other browsers, which, utilizing WebGPU, allow a realtime conversation with the LLM model that you choose. When I say slow, I mean it runs 100% of the cpu (in the Windows Task Manager) and 0% of the gpu, and it takes about 5 minutes per token and is buggy and prone to just stopping output completely. Or maybe I just didn't wait long enough for the next token. That seems very slow even compared to other inference setups that run on the cpu alone.

The rest of the WebGPU examples, like HelloTriangle, etc. don't work either. They usually print an error to the console. Also, inspecting the WebGPU features in nwjs differs from the features listed in the other browsers. Most of them are the same, but not all of them, and nwjs doesn't list support for the f16 feature yet either. All of the browsers are running Chromium 125, except Electron which is running 124. Is this expected or am I doing something incorrectly? I also tried it with several flags in the Chromium-args but they didn't seem to make much difference. I tried --enable-unsafe-webgpu --enable-features=Vulkan --enable-dawn-features=disable_robustness

Here is a link to the demo: https://chat.webllm.ai/ if you want to test it yourself.

I load the demo by opening the devtools in nwjs and just setting 'location.href = 'https://chat.webllm.ai/';'

The model loads fine, and the shaders load but I don't think it's running on the gpu at all. It seems to be just maxing out the cpu instead. I'm confused because I thought the gpu performance would be part of Chromium, and the version of Chromium is the same in all of them, but I also don't know if nwjs rebuilds part of the renderer. It appears to be using a fallback adapter instead. Is there something I'm doing incorrectly? Is it just me with this issue? Are you planning on parity with other WebGPU browsers? I'm just really excited and interested in this feature so I was really hoping to test it out soon. I know it is nascent/new, so I'm sorry if I'm jumping the gun.

When I get time I will try testing again on other platforms.

Currently, I'm running/testing on Windows 10 x64 with the nwjs sdk x64 version. Let me know if you need any other information.

adapter info:

architecture  swiftshader  
description  
device        
vendor        google  

flags:

isCompatibilityMode  false  
isFallbackAdapter    true

I can print out the WebGPU features list from both Chrome/Edge/Electron and from nwjs if you want as well. Or if you need my actual adapter info, I can provide that as well.

Also, one other thing I've noticed, is that in the more recent version (v0.88.0) a little red square shows up in the Windows sys-tray sometimes (only sometimes...maybe when I reopen it too quickly after closing it?) that allows the app to "run in the background" but I don't think I've enabled that anywhere. When the red square shows up, I have to manually right click it to exit the app before I can restart it. As far as I know, the earlier versions I used didn't have that behavior. However, it could be that I've added some JS code that is causing it to run the systray icon...I just don't recall doing that and I don't understand why it would only be sometimes, if it were being executed by me. If my code was doing it, it should probably show up on every launch but it doesn't. It shows up about 30-40% of the time when launched.

Thanks for all of your hard work. I hope some of this information will be useful. I plan on digging into the nwjs code myself soon. I just need more time to do it and set up the build process.

@ayushmanchhabra
Copy link
Contributor

ayushmanchhabra commented Jul 20, 2024

From what I understand, NW.js (Chromium) should have hardware acceleration enabled by default. But when running https://chat.webllm.ai in NW.js, the CPU is utilisied by default.

@ayushmanchhabra
Copy link
Contributor

https://peter.sh/experiments/chromium-command-line-switches/
@brokedRobot There are a lot of hardware acceleration related chromium switches to go through but what you're saying sounds like a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants