Giter Club home page Giter Club logo

Comments (2)

dougbinks avatar dougbinks commented on June 18, 2024

TaskScheduler::WaitForTask will only run one task if 0/NULL/nullptr passed instead of an ICompletable, I will update the documentation on that shortly (I'm AFK a lot at the moment so responses and updates will be a little slow for a few days). So this seems like it would match your requirements.

Note that I am thinking of adding a more explicit user callable TryRunTasks function with some more control over what to run as there are a few circumstances where this would help, but it needs more thought.

One option for you might be to do the following:

  1. GPU work is issued by a task which has a pinned task on thread 0 (main thread/thread which initialized enkiTS) as a dependent task (or issues it after doing work).
  2. Thread 0 uses WaitForNewPinnedTasks to wait for any pinned tasks, then calls RunPinnedTasks which run the tasks and update any data structures needed by thread 0. Note that WaitForNewPinnedTasks can complete with no tasks available, but this should be handled by next step.
  3. Thread 0 Checks for data if needed, if it manages to get all data from operations back it goes to 2.
  4. With data not ready thread 0 performs a WaitForTask with nullptr and probably TASK_PRIORITY_HIGH or similar where all lengthy tasks are run on lower priorities.
  5. If WaitForTask did not take long then sleep (this is where enkiTS could help).
  6. Go back to 3.

The main thing enkiTS could add here is that the wait at 5 could be replaced by a WaitForTask with a timeout or similar, which instead of completing immediately would wait with an enkiTS spin then OS sleep but also wake if there were any new tasks/tasks completed using enkiTS internal signals.

It might be worth you first trying the above version (or similar) and then I can create an experimental branch with the above feature to test.

from enkits.

baldurk avatar baldurk commented on June 18, 2024

That's perfect, thanks. Indeed knowing that it only runs one task is the key. It would be nice to have a more flexible way of doing this with a timeout, but it's not critical and at least enables the organisation I want to have.

from enkits.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.