AB
AiBoss
project

ForgeStencil - Wallfacer's Stencil fully automated research deployment system

ForgeStencil is the world's first AI optimization system supporting automated Stencil research and deployment, jointly developed by Wallfacer Intelligence and the OpenBMB open-source community. It is based on a dual-agent closed-loop architecture consisting of a Kernel Agent and an App Agent...

What is ForgeStencil?

ForgeStencil, developed by Wallfacer in collaboration with the OpenBMB open-source community, is the world's first AI optimization system supporting automated Stencil research and deployment. Based on a closed-loop dual-agent architecture of Kernel Agent and App Agent, it achieves zero human intervention throughout the entire process, from optimization strategy discovery to integration into real-world production software. Within a week, the system completed end-to-end optimization of over 100 industrial and scientific computing software applications, achieving a median speedup of 1.41x, covering eight major industrial sectors, including oil and gas exploration, electromagnetic simulation, and medical imaging, as well as five major scientific fields.

Main functions of ForgeStencil

  • Dual Agent Closed-Loop OptimizationThe Kernel Agent independently researches and synthesizes a high-performance CUDA Kernel, while the App Agent completes hotspot localization, operator forging, correctness verification, and application integration.
  • Automatic policy discoveryThe agent autonomously explores optimization strategies such as segmentation, fusion, layout, occupancy, and host reconstruction, rather than searching within a fixed space.
  • Real application deployment: Directly optimized for production-grade software, using the application's own GPU code as a baseline for end-to-end verification, not a simplified benchmark.
  • Auditable Measurement ProtocolBy using a single environment switch to alternate between the original and optimized paths, and by using built-in checks and timers, the speedup ratio is ensured to be realistic and reliable.
  • Cross-generation GPU adaptationSupports A100/H100/B200 runtime architecture distribution, and automatically selects the optimal Kernel path according to the architecture within the same codebase.

The technical principle of ForgeStencil

  • Dual Agent Collaborative ArchitectureThe system consists of a closed loop comprised of a Kernel Agent and an App Agent. The Kernel Agent is responsible for theoretical discovery, autonomously researching and synthesizing Stencil operators that approximate the physical limits of the hardware through a Plan→Code→Profile loop. The App Agent is responsible for engineering implementation, identifying application performance hotspots, establishing GPU baselines, calling the operator matrix knowledge base built by the Kernel Agent to forge application-specific optimizations, and completing correctness verification and integration with the original application.
  • Operator matrices and knowledge base evolutionDuring the optimization process, the Kernel Agent continuously builds a dedicated operator matrix as a knowledge base, which can be reused by the App Agent. Multiple parallel agents share this knowledge base, enabling real-time sharing of experience and collective synchronous evolution, thus overcoming the bottleneck of the difficulty in scalable transmission of human expert experience.
  • Auditable end-to-end protocolMeasurements use the application's own production-grade GPU implementation as the sole baseline; the original path and optimized path are compared only through a single... USE_OURS The switches are distinguished, and the original path is consistent with the upstream bytes; the program uses built-in correctness checks and timers to take the median after multiple rounds of interleaved operation, and finally reports the geometric mean speedup of all standard use cases, eliminating the space for fraud at the system level.
  • Patch mode bundled with zero source codeIt does not bundle any third-party source code; each application only provides upstream source records, script acquisition, and integration patches. vendor.sh Automatically pulls upstream code for a specified version, ensuring clean licenses and reproducible results.

Follow us on WeChat and reply with "open source",join inAI open source project discussion group

How to use ForgeStencil

  • Environmental preparationClone the repository and ensure that it has an NVIDIA GPU (A100 verified), CUDA 12.x, C++17 compiler, and Python 3.9+ environment.
  • Quickly experience the operator:run python tools/run.py --stencil star_1 --shape 256 --gpu 0 The performance of a single operator can be measured and compared with the Halide baseline within 1 minute.
  • End-to-end reproduction: Enter the target application directory and execute ./vendor.sh Pull the upstream source code, apply the integrated patch, and run. python ../../harness/run_e2e.py --app <name> --gpu auto Complete real-world application verification.
  • Drive Agent to work:refer to agents/README.md Configure and start the autonomous optimization loop of Kernel Agent and App Agent.
  • Registry search results:pass results/integration_registry.json View the audit speedup data for 100 verified applications.

ForgeStencil's core advantages

  • Zero human interventionThe entire process, from application analysis and hotspot identification to kernel forging and integration verification, is automated without the need for HPC experts to participate in decision-making.
  • Real-world scenario orientationDirectly optimizes production-grade industrial software; 42% of the software is real industrial production software, and the baseline is the application's own GPU code.
  • Leap in R&D efficiencyThe optimization time for a single application has been reduced from several months to within a day, and 100+ applications can be completed in a week, which is equivalent to saving about 20-30 person-years of R&D investment.
  • Strong performanceEnd-to-end median speedup of 1.41x, 43% of applications ≥1.5x, operator-level geometric mean 2.16x outperforms the best open-source baseline.
  • Cross-architecture sustainabilitySupports runtime distribution for multiple generations of NVIDIA GPUs, and can automatically reforge the kernel to capture new hardware features when the architecture is upgraded.

ForgeStencil's project address

  • GitHub repository:https://github.com/OpenBMB/ForgeStencil

Comparison of ForgeStencil with similar products

Dimension ForgeStencil Halide
Optimization strategy source The agent autonomously discovers new strategies, conducting non-fixed-space searches. Humans design DSLs and scheduling strategies, while automation is limited by preset rules.
Deployment Scope Supports end-to-end integration and verification of real-world applications. Primarily geared towards single-operator/image processing pipelines, lacking application-level automated deployment.
Baseline comparison Based on the application's own GPU code Typically based on a simplified reference implementation or CPU version.
Correctness verification The program's built-in checks and interleaved measurements ensure reliability. It relies on the framework's built-in testing and lacks a system-level anti-fraud protocol.
Knowledge accumulation Multiple agents share an operator matrix knowledge base, allowing for the reuse of experience. Optimization experience is scattered among various experts, making it difficult to disseminate at a large scale.

Application scenarios of ForgeStencil

  • Oil and gas seismic exploration: Optimize core algorithms such as RTM reverse time migration and Total mini-app to accelerate the oil exploration data processing workflow.
  • Electromagnetic simulation designImprove the efficiency of solving Maxwell equations using Yee meshes such as gprMax/FDTD, serving electromagnetic analysis of radar and chips.
  • Medical Image ReconstructionAccelerate computational workloads in medical imaging, such as non-Cartesian MRI reconstruction and digital breast tomography back projection.
  • Climate and AstrophysicsOptimize Stencil-intensive scientific computing applications such as atmospheric dynamics and cosmological simulation.
  • Quantitative Financial CalculationProvides automatic Stencil hotspot optimization for pricing libraries of financial institutions such as QuantLib, reducing transaction computation latency.