Skip to content

Conversation

raphlinus
Copy link
Contributor

This is a draft of the current Android support, just to be reproduceable. There will be a proper PR later.

Don't run extensions unless they're available. This includes querying
for descriptor indexing, and running one of two versions of kernel4
depending on whether it's enabled.

Part of the support needed for #78
Adds an example binary that can be run with `cargo apk`.

One thing that will still need manual tuning (for now) is the size of
the canvas. A good followup is to sense that from the window size.
@raphlinus raphlinus marked this pull request as ready for review April 20, 2021 15:34
@raphlinus
Copy link
Contributor Author

I uploaded this as a draft PR, but I think it should be possible to merge (I've been keeping it up to date). There are a few things to keep in mind. One is that the default setting of CHUNK is 8, which is one subgroup per workgroup for a subgroup size of 32. On GPUs with a subgroup size of 64 (which includes Pixel 4), CHUNK should be set to 4 at most.

Also, the default size of the render context doesn't match the screen. The right solution of course is to query the window size and set up the renderer to match that, but in the meantime, I've been patching piet-gpu/src/lib.rs with this:

const WIDTH_IN_TILES: usize = 68;
const HEIGHT_IN_TILES: usize = 143;

Clearly, there's a bunch more work to make it performant, but for the most part that's being tracked. There's also lots of potential for cleanup of the duplication between android.rs and winit.rs, among other things. But I think this would be useful to have in tree for experimentation.

@eliasnaur
Copy link
Collaborator

eliasnaur commented Apr 20, 2021

I uploaded this as a draft PR, but I think it should be possible to merge (I've been keeping it up to date). There are a few things to keep in mind. One is that the default setting of CHUNK is 8, which is one subgroup per workgroup for a subgroup size of 32. On GPUs with a subgroup size of 64 (which includes Pixel 4), CHUNK should be set to 4 at most.

FWIW, the current CHUNK_X/Y seems like the sweet spot for Pixel 1. X = 2, Y = 2 makes kitchen.apk go from ~15ms to ~22ms in k4, and X = 4, Y = 4 degenerates to ~47ms.

EDIT: but then again, I have TILE_WIDTH_PX, TILE_HEIGHT_PX set to 32 because the maximum workgroup size is 128.

@raphlinus
Copy link
Contributor Author

Interesting. I don't have a good bead on the subgroup size of the Adreno 530. I thought it was architecturally pretty similar to the 640 that's in the Pixel 4, but gpuinfo reports 32. That said, without the subgroup size extension (missing from pixel 1), I've found the reported subgroup not very reliable. It certainly is possible to do other experiments though.

Tuning tile and subgroup sizes is definitely one of the things we should be doing later in the game, but I'm personally not planning on spending too much time on it until the overall architecture looks a bit more solid.

@raphlinus raphlinus changed the title Android2 Add example Android apk Apr 20, 2021
@raphlinus raphlinus merged commit f6c2558 into master Apr 27, 2021
@raphlinus raphlinus deleted the android2 branch April 27, 2021 15:35
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