Skip to contents

Constructs the quickr backend, which stores array data as plain R arrays and compiles jitted functions to R code via the quickr package.

Usage

AnvlBackendQuickr()

Value

An AnvlBackend object with subclass "AnvlBackendQuickr".

Details

To use it, the "quickr" package needs to be installed.

Registered automatically under the name "quickr" when the package is loaded; call local_backend("quickr") or with_backend("quickr", ...) to use it. Requires the quickr package to be installed.

Data representation

An AnvlArray with backend = "quickr" is, under the hood, a plain R vector or array (numeric, integer, or logical) stored in the $data field. as_array() returns the underlying vector/array directly without copying, and nv_array() simply wraps an R vector/array. As a consequence, there is no separate notion of a device: data always lives in R's memory and computation always runs on the CPU.

Status

This backend is experimental and has a number of limitations:

  • Compilation (tracing + quickr lowering) is somewhat slow, so it is best suited to long-running or repeatedly-called functions where the one-time compilation cost is amortized.

  • Only a subset of the primitives that the XLA backend supports are currently lowered to quickr code. See vignette("primitives") for an overview.

  • Only the data types f64, i32, and bool are supported.

  • Only CPU execution is supported.

Quickr JIT arguments

  • unwrap (logical(1), default FALSE): if TRUE, the compiled function returns plain R arrays instead of AnvlArrays. Useful when the jitted function's output is consumed by non-anvl R code and the extra wrapping would only get stripped again.