Asynchronous GPU Operations #
Provides async GPU compute using Lean 4's Task system.
Features #
- Non-blocking shader execution
- Async buffer operations
- Task-based parallel GPU operations
- Future/promise pattern for GPU results
Usage Example #
-- Launch async compute
let task ← asyncCompute shader inputBuffers
-- Do other work...
doOtherWork
-- Wait for result
let result ← task.get
Result of an async GPU operation
- value : α
The computed result
- executionTimeMs : Float
Execution time in milliseconds
Instances For
Equations
Instances For
instance
Hesper.Async.instInhabitedAsyncResult
{a✝ : Type}
[Inhabited a✝]
:
Inhabited (AsyncResult a✝)
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
@[reducible, inline]
Async GPU compute task
Equations
Instances For
Helper to launch async task
Equations
- One or more equations did not get rendered due to their size.
Instances For
Launch async buffer read and return a Task
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Hesper.Async.asyncBufferWrite
(_buffer : WebGPU.Buffer)
(_data : Array Float)
[Inhabited Unit]
:
Launch async buffer write and return a Task
Equations
- One or more equations did not get rendered due to their size.
Instances For
Wait for all tasks to complete
Equations
- One or more equations did not get rendered due to their size.
Instances For
Map a function over an async task result
Equations
- Hesper.Async.mapTask f task = Task.map (fun (result : Hesper.Async.AsyncResult α) => { value := f result.value, executionTimeMs := result.executionTimeMs }) task
Instances For
Create a pipeline from a single async operation
Equations
- Hesper.Async.AsyncPipeline.fromTask task = { run := task }
Instances For
def
Hesper.Async.AsyncPipeline.andThen
{α β : Type}
[Inhabited α]
[Inhabited β]
(p1 : AsyncPipeline α)
(f : α → IO (AsyncTask β))
:
Chain two pipeline stages
Instances For
Map over pipeline result
Equations
- Hesper.Async.AsyncPipeline.map f p = { run := do let task ← p.run pure (Hesper.Async.mapTask f task) }
Instances For
Execute the pipeline and wait for result
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Launch async compute operation
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute operations in batches with concurrency limit
Equations
- One or more equations did not get rendered due to their size.
Instances For
Priority for async tasks (currently just documentation in Lean 4)
- low : TaskPriority
- normal : TaskPriority
- high : TaskPriority
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.