Skip to content

feat(pjrt): add program execution to LoadedExecutable#70

Closed
dndungu wants to merge 4 commits intomainfrom
p3-execute
Closed

feat(pjrt): add program execution to LoadedExecutable#70
dndungu wants to merge 4 commits intomainfrom
p3-execute

Conversation

@dndungu
Copy link
Copy Markdown
Contributor

@dndungu dndungu commented Apr 4, 2026

Phase 3 PJRT pipeline: execution support.

dndungu added 4 commits April 2, 2026 15:14
…fecycle)

T60.2.1: BufferFromHost wraps PJRT_Client_BufferFromHostBuffer with
Go type to PJRT element type mapping (F32, F64, F16, BF16, F8E4M3,
S32, S64, etc.), shape validation, and buffer donation support.

T60.2.2: ToHost/ToHostSlice wraps PJRT_Buffer_ToHostBuffer with
async readback and PJRT_Event_Await synchronization.

T60.2.3: Buffer metadata (Dtype, Shape, OnDeviceSizeInBytes, ReadyEvent)
and lifecycle (Close, Delete) with double-close no-op for finalizer safety.
Add ccall, dlopenPath, and dlsym forwarding functions in pjrt.go
so that buffer.go, client.go, and device.go do not import
internal/cuda directly. Only pjrt.go holds the cuda dependency.
Implement LoadedExecutable.Execute(inputs []*Buffer, opts ...ExecOption)
which wraps PJRT_LoadedExecutable_Execute. Builds input/output buffer
handle arrays, calls the C API for single-device execution, synchronizes
via PJRT_Event_Await, and wraps output handles in Buffer structs.

Execution options support device ordinal selection and per-input buffer
donation hints via the ExecOption functional pattern.

Also migrates remaining cuda.Ccall references to the centralized ccall
wrapper in pjrt.go.
@dndungu
Copy link
Copy Markdown
Contributor Author

dndungu commented Apr 4, 2026

Content already in main

@dndungu dndungu closed this Apr 4, 2026
@dndungu dndungu deleted the p3-execute branch April 4, 2026 01:26
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.

1 participant