---
title: "CPU oracle, a category in the TypeShade API reference"
description: "CPU oracle in the TypeShade API reference. The CPU backend that runs a module in f64 and gives the reference values to compare against."
url: https://typeshade.dev/api/cpu-oracle/
language: en
---

# CPU oracle

10 members

The CPU backend that runs a module in `f64` and gives the reference values to compare against.

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

**[`compileModule`](https://typeshade.dev/api/compilemodule/) Function**

Compile a module for the CPU: a tree-walk interpreter over the same IR the GPU backends receive, returning a CpuModule whose fns are ordinary JavaScript functions.

**[`compileModuleJs`](https://typeshade.dev/api/compilemodulejs/) Function**

Compile a module for the CPU by generating JavaScript, returning the same CpuModule shape compileModule returns and the same results bit for bit.

**[`CpuModule`](https://typeshade.dev/api/cpumodule/) Interface**

The shape both CPU backends return, so a caller can compile with compileModuleJs and fall back to compileModule without touching call sites.

**[`CpuPrecision`](https://typeshade.dev/api/cpuprecision/) Type**

How the CPU backends evaluate `f32` arithmetic.

**[`CpuStruct`](https://typeshade.dev/api/cpustruct/) Interface**

A struct value on the CPU: a plain object keyed by field name, holding one CpuValue per field.

**[`CpuValue`](https://typeshade.dev/api/cpuvalue/) Type**

A value as the CPU backends (compileModule and compileModuleJs) represent it: a plain JavaScript value, never a typed array or a GPU buffer.

**[`DispatchReport`](https://typeshade.dev/api/dispatchreport/) Interface**

What a CpuModule.dispatch ran: the workgroups, the invocations across them, and how many barrier phases the invocations of each workgroup went through in total.

**[`ORACLE_BUILTIN_NAMES`](https://typeshade.dev/api/oraclebuiltinnames/) Constant**

The names of every builtin function the CPU backends (compileModule, compileModuleJs) evaluate with real arithmetic, as a read-only set.

**[`ORACLE_GPU_STUB_NAMES`](https://typeshade.dev/api/oraclegpustubnames/) Constant**

The names of every GPU-only intrinsic the CPU backends cannot genuinely evaluate, as a read-only set: `textureSample`, `textureSampleLevel`, `textureSampleBias`, `textureSampleGrad`, `textureLoad`, their 2d-array forms, the depth comparisons, `textureDimensions`, `textureNumLayers`, and the derivatives fwidth, dpdx and dpdy.

**[`WorkgroupCount`](https://typeshade.dev/api/workgroupcount/) Type**

The shape of workgroups a dispatch takes: one number for a 1-D grid, or the three counts.
