# computeBufferResource

A compute buffer resource record carrying id, deviceId, memoryClass, sizeBytes, alignmentBytes, and related state.

Last updated: 2026-09-09

Package: compute.buffer | Status: source-declared

Tags: buffer, compute, compute.buffer, cpu, method, source-example, thing, yeho

Describe compute buffer layouts, ownership, transfers, and validation.

```yh
external thing computeBufferResource
```

- text id: Stores id as text.
- text deviceId: Stores device id as text.
- text memoryClass: Stores memory class as text.
- int sizeBytes: Stores size bytes as int.
- int alignmentBytes: Stores alignment bytes as int.
- bool ownsStorage: Stores owns storage as bool.
- bool isMutable: Stores is mutable as bool.
- bool live: Stores live as bool.
- bool mapped: Stores mapped as bool.
- int generation: Stores generation as int.
- text state: Stores state as text.
- text externalIdentity: Stores external identity as text.
- computeBufferResource(text id, text deviceId, text memoryClass, int byteSize, int alignmentBytes, bool ownsStorage, bool isMutable, bool live, bool mapped, int generation, text state, text externalIdentity): Compute buffer resource.
- ValidationIssue() returns text: Validation issue.
- ValidationDecision() returns computeResourceDecision: Validation decision.
- Describe() returns text: Describe.

## Use computeBufferResource

A complete small caller. Values are illustrative; check the returned result and package requirements before connecting live resources.

Verification: type checked

```yh
using compute.buffer

// Describe compute buffer layouts, ownership, transfers, and validation.
computeBufferResource sample = computeBufferResource("id", "device Id", "memory Class", 4, 4, true, true, true, true, 1, "state", "external Identity")
Console.Log(Text.From(sample.id))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_buffer__computebufferresource"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.buffer"
version = "0.1.0"
path = "../../../yeho/packages/compute/buffer"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.buffer--computeBufferResource/usage --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## computeBufferResource.ValidationIssue

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.buffer

// Validation issue.
computeBufferResource instance = computeBufferResource("id", "device Id", "memory Class", 4, 4, true, true, true, true, 1, "state", "external Identity")
text result = instance.ValidationIssue()
Console.Log(Text.From(result))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_buffer__computebufferresource"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.buffer"
version = "0.1.0"
path = "../../../yeho/packages/compute/buffer"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.buffer--computeBufferResource/method-ValidationIssue-13 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## computeBufferResource.ValidationDecision

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.buffer

// Validation decision.
computeBufferResource instance = computeBufferResource("id", "device Id", "memory Class", 4, 4, true, true, true, true, 1, "state", "external Identity")
computeResourceDecision result = instance.ValidationDecision()
Console.Log("Inspect result in your debugger")

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_buffer__computebufferresource"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.buffer"
version = "0.1.0"
path = "../../../yeho/packages/compute/buffer"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.buffer--computeBufferResource/method-ValidationDecision-14 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## computeBufferResource.Describe

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.buffer

// Describe.
computeBufferResource instance = computeBufferResource("id", "device Id", "memory Class", 4, 4, true, true, true, true, 1, "state", "external Identity")
text result = instance.Describe()
Console.Log(Text.From(result))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_buffer__computebufferresource"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.buffer"
version = "0.1.0"
path = "../../../yeho/packages/compute/buffer"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.buffer--computeBufferResource/method-Describe-15 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Package presence and a declaration do not establish support on every host. Host services need their platform and lifecycle setup.

Source: yeho/packages/compute/buffer/contracts.yh

AI training permission: https://demonhunterlabs.com/ai-use
