# ComputeProgramBinding

`import { ComputeProgramBinding } from "destack:compute/binding";`

Compute program binding family.

```ds title="ComputeProgramBinding"
export interface ComputeProgramBinding {
    device(program: &'a readonly Program): Device;
    compile(device: &'a readonly Device, source: ProgramSource, options?: ProgramOptions | undefined): Result<Program, ComputeError>;
    build(device: &'a readonly Device, source: ProgramSource, options?: ProgramOptions | undefined): ProgramReport;
    kernel(program: &'a readonly Program, name: string): Result<Kernel, ComputeError>;
    argumentValue<T>(value: T): KernelArgument;
    argumentBuffer<T>(buffer: Buffer<T>): KernelArgument;
    argumentBytes(bytes: [uint8]): KernelArgument;
    kernelProgram(kernel: &'a readonly Kernel): Program;
    kernelName(kernel: &'a readonly Kernel): &readonly string;
    signature(kernel: &'a readonly Kernel): KernelSignature;
    dispatch(kernel: &'a readonly Kernel, arguments: [KernelArgument], workgroups: WorkgroupCount, workgroupSize?: WorkgroupSize | undefined, stream?: &'b Stream | undefined): Event;
}
```

[language/library/src/compute/binding/program.ds:19:117](https://github.com/destack-sh/destack/blob/main/language/library/src/compute/binding/program.ds#L19-L117)

## Members

### `device(program: &'a readonly Program): Device`

Return the device that owns `program`.

### `compile(device: &'a readonly Device, source: ProgramSource, options?: ProgramOptions | undefined): Result<Program, ComputeError>`

Compile `source` for `device`.

### `build(device: &'a readonly Device, source: ProgramSource, options?: ProgramOptions | undefined): ProgramReport`

Compile `source` for `device` and return diagnostics.

### `kernel(program: &'a readonly Program, name: string): Result<Kernel, ComputeError>`

Return a kernel entry point by name.

### `argumentValue<T>(value: T): KernelArgument`

Encode `value` as one kernel argument.

### `argumentBuffer<T>(buffer: Buffer<T>): KernelArgument`

Encode `buffer` as one kernel argument.

### `argumentBytes(bytes: [uint8]): KernelArgument`

Encode raw argument bytes.

### `kernelProgram(kernel: &'a readonly Kernel): Program`

Return the program that owns `kernel`.

### `kernelName(kernel: &'a readonly Kernel): &readonly string`

Return the kernel entry point name.

### `signature(kernel: &'a readonly Kernel): KernelSignature`

Return kernel signature metadata.

### `dispatch(kernel: &'a readonly Kernel, arguments: [KernelArgument], workgroups: WorkgroupCount, workgroupSize?: WorkgroupSize | undefined, stream?: &'b Stream | undefined): Event`

Dispatch `kernel` on `stream`.
