# `ExCubecl`
[🔗](https://github.com/ohhi-vn/ex_cubecl/blob/v0.1.0/lib/ex_cubecl.ex#L15)

ExCubecl - An Nx backend powered by CubeCL via Rust NIFs.

Provides tensor operations using a Rust NIF layer for compute.
Operations not yet implemented in the Nif fall back to Nx.BinaryBackend.

## Usage

    iex> t = Nx.tensor([1.0, 2.0, 3.0], backend: ExCubecl.Backend)
    iex> Nx.add(t, t)
    #Nx.Tensor<
      f32[3]
      [2.0, 4.0, 6.0]
    >

## Supported types

  * `{:f, 32}` - 32-bit float
  * `{:f, 64}` - 64-bit float
  * `{:s, 32}` - 32-bit signed integer
  * `{:s, 64}` - 64-bit signed integer
  * `{:u, 32}` - 32-bit unsigned integer
  * `{:u, 8}`  - 8-bit unsigned integer

## Mobile (iOS / Android) support

ExCubecl provides a C FFI layer (`ex_cubecl.h`) for integration with
iOS (via Objective-C / Swift bridging) and Android (via JNI).
See the header at `native/ex_cubecl_nif/include/ex_cubecl.h`.

# `available?`

```elixir
@spec available?() :: boolean()
```

Checks if the NIF library is loaded and available.

Returns `true` if the NIF can be loaded, `false` otherwise.
Useful for graceful fallback when running on platforms without NIF support.

# `byte_size`

```elixir
@spec byte_size(tuple(), tuple()) :: non_neg_integer()
```

Return the total byte size for a tensor of the given shape and type.

# `device_info`

```elixir
@spec device_info() :: map()
```

Returns information about the compute device/backend.

Currently returns CPU-based backend info. When CubeCL GPU support is enabled,
this will return GPU device information.

# `from_binary`

```elixir
@spec from_binary(binary(), tuple(), tuple()) :: Nx.Tensor.t()
```

Create a tensor from a binary with the given shape and type.

# `supported_types`

```elixir
@spec supported_types() :: [tuple()]
```

Returns the list of supported tensor types.

# `to_binary`

```elixir
@spec to_binary(Nx.Tensor.t()) :: binary()
```

Read a tensor's data into a binary.

# `type_size`

```elixir
@spec type_size(tuple()) :: pos_integer()
```

Return the size in bytes of a single element for the given Nx type.

# `version`

```elixir
@spec version() :: String.t()
```

Returns the version of ExCubecl.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
