optirs-gpu 0.3.2

OptiRS GPU acceleration and multi-GPU optimization
Documentation
[package]
name = "optirs-gpu"
version.workspace = true
edition.workspace = true
authors.workspace = true
description = "OptiRS GPU acceleration and multi-GPU optimization"
readme = "README.md"
license.workspace = true
repository.workspace = true
keywords = ["gpu", "wgpu", "metal", "opencl", "optimization"]
categories = ["science", "algorithms", "hardware-support"]

[lints]
workspace = true

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

[dependencies]
# Core dependencies
#
# NOTE: `optirs-core` is a *dev*-dependency, not a runtime one: nothing in this
# crate's library code references it. It is used by the GPU/CPU parity tests,
# which check that the WGSL optimizer kernels reproduce the reference CPU
# optimizers bit-for-bit within tolerance.
#
# `gpu` is always on: every type in this crate's public API is expressed in
# terms of `scirs2_core::gpu`, so the module must exist in every feature
# configuration (including `--no-default-features`). Backend *runtimes* stay
# optional and are forwarded by the features below.
scirs2-core = { workspace = true, features = ["gpu", "random"] }  # Required for SciRS2 policy compliance

# ❌ FORBIDDEN DEPENDENCIES REMOVED - Use SciRS2-Core abstractions instead
# ndarray - Use scirs2_core::ndarray
# num-traits - Use scirs2_core::numeric
#
# GPU runtime crates (wgpu / pollster / metal / objc2 / opencl3 / cudarc) are NOT
# direct dependencies: every GPU access in this crate goes through
# `scirs2_core::gpu`, and the backend runtimes are pulled in by the
# `scirs2-core/<backend>` features forwarded below.

thiserror = { workspace = true }
serde = { workspace = true, features = ["derive"] }
log = { workspace = true }

# On macOS the native Metal backend is enabled unconditionally, because it is
# the backend that currently reaches the GPU there: scirs2-core 0.6.5's runtime
# device probe (`gpu::backends::detect_gpu_backends`) never enumerates wgpu
# adapters, so `GpuContext::new(GpuBackend::Wgpu)` always reports
# "no devices detected at runtime". The `metal` deps are themselves
# macOS-gated inside scirs2-core, so this adds nothing on other platforms.
[target.'cfg(target_os = "macos")'.dependencies]
scirs2-core = { workspace = true, features = ["metal"] }

[dev-dependencies]
approx = { workspace = true }
# optirs-core = { workspace = true }  # TEMP disabled while optirs-core is mid-refactor

[features]
# Default enables the WebGPU backend, which is the only backend with a complete
# compute path in scirs2-core 0.6.x (Vulkan / Metal / DX12 via wgpu).
default = ["wgpu"]

# Real GPU compute path: forwards to scirs2-core's wgpu backend.
wgpu = ["scirs2-core/wgpu"]

# Native Metal backend. Enabled automatically on macOS (see the target-specific
# dependency above); listing it here lets it be requested explicitly too.
metal = ["scirs2-core/metal"]

# OpenCL context creation only — this crate ships no OpenCL C kernel sources,
# so `SUPPORTED_BACKENDS` does not include it. See README for the full matrix.
opencl = ["scirs2-core/opencl"]

# NOTE: scirs2-core removed its CUDA backend in 0.6.x (moved to the oxicuda-*
# crates). This feature therefore forwards nothing GPU-real; it only gates the
# CUDA-specific *reporting* code paths, all of which return explicit errors.
cuda = []