# Introspection

> USearch for Swift

```swift
let description = try index.describe()
print(description.metadata.dimensions, description.metadata.connectivity)
print(description.size, description.capacity, description.memoryUsage, description.cpuClass, description.shardsCount)
print(try index.count(key: 42), try index.contains(key: 42))

let reachability = try index.on(executor).health()
print(reachability.reachable, "of", reachability.audited, "entries reachable after", reachability.sweeps, "sweeps")

print(version(), capabilitiesCompiled(), capabilitiesAvailable())
```

`health` audits how much of the graph a search reaches from its landmarks; entries it misses stay unfound until a `refine` re-links them.

`import USearch`

## CPUClass

A CPU family USearch ships tuned variants for; dispatch reports its pick in this vocabulary, and a RAM or NVMe placement or executor may pin one.

```swift
struct CPUClass
```

Conforms to: `Hashable`, `Sendable`, `CustomStringConvertible`, `Equatable`

## serial

The portable floor, with no SIMD assumptions.

```swift
static let serial: CPUClass
```

## intelHaswell

Haswell-class x86: AVX2 and FMA.

```swift
static let intelHaswell: CPUClass
```

## intelSierra

Sierra Forest-class x86: AVX-VNNI without AVX-512.

```swift
static let intelSierra: CPUClass
```

## intelSkylake

Skylake-class x86: the AVX-512 foundation.

```swift
static let intelSkylake: CPUClass
```

## intelIcelake

Icelake-class x86: AVX-512 VNNI and VPOPCNT.

```swift
static let intelIcelake: CPUClass
```

## amdGenoa

Genoa-class x86: native bf16 dot products over AVX-512.

```swift
static let amdGenoa: CPUClass
```

## intelSapphire

Sapphire Rapids-class x86: AVX-512 FP16 and the AMX tiles.

```swift
static let intelSapphire: CPUClass
```

## intelGranite

Granite Rapids-class x86: the AMX-FP16 tiles.

```swift
static let intelGranite: CPUClass
```

## intelDiamond

Diamond Rapids-class x86: AVX10.2's FP8 conversions.

```swift
static let intelDiamond: CPUClass
```

## awsG2

Graviton2-class Arm: the bare NEON floor.

```swift
static let awsG2: CPUClass
```

## appleM2

Armv8.6 NEON with dot products and bf16.

```swift
static let appleM2: CPUClass
```

## appleM4

Apple M4-class Arm: the SME outer-product tiles.

```swift
static let appleM4: CPUClass
```

## awsG5

Graviton5-class Arm: Armv9.2.

```swift
static let awsG5: CPUClass
```

## nvidiaVera

Vera-class Arm: FP8 dot products.

```swift
static let nvidiaVera: CPUClass
```

## alibabaC930

Alibaba C930-class RISC-V: RVA23 vectors.

```swift
static let alibabaC930: CPUClass
```

## wasm32V128

WebAssembly with fixed-width simd128.

```swift
static let wasm32V128: CPUClass
```

## wasm64Extended

WebAssembly with relaxed SIMD, threads and 64-bit addressing.

```swift
static let wasm64Extended: CPUClass
```

## monoversioned

The one class of a monoversioned build.

```swift
static let monoversioned: CPUClass
```

## description

The class as the library spells it.

```swift
var description: String { get }
```

## init

Reads a spelling back, and nil for one no class carries.

```swift
init?(name: String)
```

## GPUClass

A GPU family USearch ships tuned variants for; a VRAM placement or executor may pin one.

```swift
struct GPUClass
```

Conforms to: `Hashable`, `Sendable`, `CustomStringConvertible`, `Equatable`

## nvidiaAmpere

Ampere-class NVIDIA, and every NVIDIA GPU without a class of its own.

```swift
static let nvidiaAmpere: GPUClass
```

## nvidiaAda

Ada-class NVIDIA: the fp8 conversions.

```swift
static let nvidiaAda: GPUClass
```

## nvidiaHopper

Hopper-class NVIDIA.

```swift
static let nvidiaHopper: GPUClass
```

## nvidiaBlackwell

Blackwell-class NVIDIA.

```swift
static let nvidiaBlackwell: GPUClass
```

## nvidiaBlackwellRTX

Consumer Blackwell NVIDIA.

```swift
static let nvidiaBlackwellRTX: GPUClass
```

## nvidiaRubin

Rubin-class NVIDIA.

```swift
static let nvidiaRubin: GPUClass
```

## amdCDNA3

CDNA3 AMD: gfx942.

```swift
static let amdCDNA3: GPUClass
```

## amdCDNA4

CDNA4 AMD: gfx950.

```swift
static let amdCDNA4: GPUClass
```

## amdCDNA5

CDNA5 AMD: gfx1250.

```swift
static let amdCDNA5: GPUClass
```

## appleMetal7

Apple7-family GPUs, and every Apple GPU without a class of its own.

```swift
static let appleMetal7: GPUClass
```

## appleMetal9

Apple9-family GPUs.

```swift
static let appleMetal9: GPUClass
```

## appleMetal10

Apple10-family GPUs.

```swift
static let appleMetal10: GPUClass
```

## description

The class as the library spells it.

```swift
var description: String { get }
```

## init

Reads a spelling back, and nil for one no class carries.

```swift
init?(name: String)
```

## DenseIndexDescription

A live index's frozen metadata and current counters, each read once, so under concurrent insertions they may come from slightly different moments.

```swift
struct DenseIndexDescription
```

Conforms to: `Sendable`

## metadata

The frozen metric, quantization, dimensions and connectivity, as a checkpoint reports them.

```swift
var metadata: DenseMetadata
```

## size

The stored entries.

```swift
var size: Int
```

## capacity

The entries hosted without growing again.

```swift
var capacity: Int
```

## memoryUsage

The bytes the handle holds; traversal scratch is the executor's.

```swift
var memoryUsage: Int
```

## cpuClass

The CPU class whose kits the index dispatched to on RAM and NVMe; nil on VRAM.

```swift
var cpuClass: CPUClass?
```

## gpuClass

The GPU class whose kernels the index dispatched to on VRAM; nil on RAM and NVMe.

```swift
var gpuClass: GPUClass?
```

## shardsCount

The live shards, each a graph of its own.

```swift
var shardsCount: Int
```

## DenseReachability

One reachability audit: the population it judged, and how much of it a search reaches.

```swift
struct DenseReachability
```

Conforms to: `Equatable`, `Sendable`

## audited

The entries published when the audit started; compare [`reachable`](#reachable) against this, never a later size.

```swift
var audited: Int
```

## reachable

Of those, the entries a search reaches from the landmarks; the rest no search finds until a refinement re-links them.

```swift
var reachable: Int
```

## sweeps

The levels the sweep took to converge.

```swift
var sweeps: Int
```

## backSweeps

The levels the sweep back toward the entry point took, where an audit sweeps both ways.

```swift
var backSweeps: Int
```

## version

The version of the linked library, like `3.0.0`.

```swift
func version() -> String
```

## capabilitiesCompiled

The hardware capabilities the linked binary was compiled with, comma separated.

```swift
func capabilitiesCompiled() -> String
```

## capabilitiesAvailable

The hardware capabilities the current machine offers at runtime, comma separated.

```swift
func capabilitiesAvailable() -> String
```

