[package]
authors = [
    "laggui <lagrange.guillaume.1@gmail.com>",
    "nathanielsimard <nathaniel.simard.42@gmail.com>",
]
categories = ["science"]
description = "Backend dispatch for the Burn framework"
edition.workspace = true
keywords = ["deep-learning", "machine-learning", "data"]
license.workspace = true
name = "burn-dispatch"
readme.workspace = true
repository = "https://github.com/tracel-ai/burn/tree/main/crates/burn-dispatch"
documentation = "https://docs.rs/burn-dispatch"
version.workspace = true

[lints]
workspace = true

[features]
default = [
    "std",
    "burn-autodiff?/default",
    "burn-cpu?/default",
    "burn-cuda?/default",
    "burn-flex?/default",
    "burn-ndarray/default",
    "burn-rocm?/default",
    "burn-tch?/default",
    "burn-wgpu?/default",
]
doc = ["default"]
std = [
    "burn-backend/std",
    "burn-autodiff?/std",
    "burn-cpu?/std",
    "burn-cuda?/std",
    "burn-flex?/std",
    "burn-ndarray/std",
    "burn-rocm?/std",
    "burn-tch?/std",
    "burn-wgpu?/std",
]
tracing = [
    "burn-autodiff?/tracing",
    "burn-cpu?/tracing",
    "burn-cuda?/tracing",
    "burn-flex?/tracing",
    "burn-ndarray/tracing",
    "burn-rocm?/tracing",
    "burn-tch?/tracing",
    "burn-wgpu?/tracing",
]
distributed = [
    "std",
    "burn-backend/distributed",
    "burn-autodiff?/distributed",
    "burn-cuda?/distributed",
]

# Backends
cuda = ["burn-cuda"]
flex = ["burn-flex"]
rocm = ["burn-rocm"]
ndarray = [] # default
tch = ["burn-tch"]
vulkan = ["wgpu", "burn-wgpu/vulkan"]
webgpu = ["wgpu", "burn-wgpu/webgpu"]
metal = ["wgpu", "burn-wgpu/metal"]
wgpu = ["burn-wgpu"]
cpu = ["burn-cpu"]
autodiff = ["burn-autodiff"]
remote = ["std", "burn-remote"]
remote-server = ["remote", "burn-remote/server"]

# Backend features
autotune = [
    "burn-wgpu?/autotune",
    "burn-cuda?/autotune",
    "burn-rocm?/autotune",
    "burn-cpu?/autotune",
]
autotune-checks = [
    "burn-wgpu?/autotune-checks",
    "burn-cuda?/autotune-checks",
    "burn-rocm?/autotune-checks",
    "burn-cpu?/autotune-checks",
]
fusion = [
    "burn-wgpu?/fusion",
    "burn-cuda?/fusion",
    "burn-rocm?/fusion",
    "burn-cpu?/fusion",
]

[dependencies]
burn-backend = { workspace = true }

# Backends
burn-autodiff = { workspace = true, optional = true }
burn-cpu = { workspace = true, optional = true }
burn-cuda = { workspace = true, optional = true }
burn-flex = { workspace = true, optional = true }
# TODO: switch to flex but it's not supported on targets without atomic CAS unless `critical_section` is enabled
burn-ndarray = { workspace = true }
burn-tch = { workspace = true, optional = true }
burn-rocm = { workspace = true, optional = true }
burn-wgpu = { workspace = true, optional = true }

burn-remote = { workspace = true, optional = true, features = ["client"] }

# Op macros with `.as_$inner_kind()`
paste = { workspace = true }

[package.metadata.docs.rs]
features = ["doc"]
rustdoc-args = ["--cfg", "docsrs"]
