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

Need better control for parallelism #5

Open
kvark opened this issue May 29, 2023 · 1 comment
Open

Need better control for parallelism #5

kvark opened this issue May 29, 2023 · 1 comment

Comments

@kvark
Copy link

kvark commented May 29, 2023

It appears that, currently, if I want to contol the parallel compressions of multiple textures, the choice is either enable rayon or reimplement fn compress() myself. I think it could be done better. For example, compress could be implemented on top of a helper like this:

fn compress_block_iter() ->impl Iterator<Item = BlockIndex>;

This way, if I want rayon, I will just convert the regular iterator into sequential with something like into_par_iter().

The advantage here is the following:

  1. no dependency on Rayon needed
  2. can support other ways of parallel execution, such as Choir, without too much boilerplate on the user side
@jansol
Copy link
Owner

jansol commented May 29, 2023

The rayon solution is mostly meant as an "easy" API, but it did occur to me that the rayon-specific code might really belong into the cli rather than the library itself.

I would also like to make the API more ergonomic to use in a massively parallel manner (OpenCL / compute shaders). Not sure how well iterators specifically lend themselves to that directly but as long as there is a "compress 1 block" API, producing an iterator over all blocks should be a zero-cost operation so I think that is a safe way to approach it.

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

2 participants