YiShape Math GPU (yishape-math-gpu) is the GPU compute bridge for YiShape Math. It provides GPU-accelerated numerical computation via wgpu shaders, called from Java through the FFM (Foreign Function & Memory) API.
Part of the four-tier fallback chain: GPU → HPC → SIMD → SISD.
GPU-accelerated ops include: add, sub, mul, div, neg, abs, sqrt, exp, log, pow, sin, cos, tanh, sigmoid, relu, gelu, dot, mean, sum, powSum, and more — covering the autodiff compute graph.
- Java 25+ (requires FFM API)
- Maven 3.6+
- JVM argument:
--enable-native-access=ALL-UNNAMED
<dependency>
<groupId>com.yishape.lab</groupId>
<artifactId>yishape-math-gpu</artifactId>
<version>0.5.0</version>
</dependency>Prebuilt JAR is also available in the yishape-math repo libs/ directory.
Configure github-gpu in ~/.m2/settings.xml (PAT with read:packages):
<repositories>
<repository>
<id>github-gpu</id>
<url>https://maven.pkg.github.com/ScaleFree-Tech/yishape-math-gpu</url>
</repository>
</repositories>No GitHub account required — just JDK 25. The libs/ directory contains prebuilt native libraries for all supported platforms; no Rust toolchain is needed:
git clone https://github.com/ScaleFree-Tech/yishape-math-gpu.git
cd yishape-math-gpu
./mvnw install -DskipTests -DskipNativeBuild=trueThe GPU backend is auto-detected at runtime. Control it via:
GpuSwitch.enable(); // Enable GPU
GpuSwitch.disable(); // Disable GPU (fall back to HPC/SIMD/SISD)Or via system property: -Dyishape.gpu=true|false
Apache License 2.0 — see LICENSE for details.