Skip to main content
SentryWard logo

Formal verification of warp-specialized GPU kernels

Reveal hidden bugs in GPU kernels.

License Python Target

Features · Results · Getting started · How it works

SentryWard is a static verifier for NVIDIA PTX kernels, built for the warp-specialized kernels of Blackwell GPUs. Given a kernel's PTX and a launch configuration, it proves that the kernel synchronizes correctly and is free of data races in every schedule within the configured input scope and model assumptions. Given a PyTorch reference as well, it also proves that the kernel computes the same function.

Features

  • Well-synchronization. Barriers and mbarriers, including TMA byte counts, behave the same way in every schedule. This also rules out deadlocks.
  • Race freedom. Every pair of conflicting accesses to global, shared or tensor memory is ordered. Footprints follow exact layouts, including swizzling, and an SMT solver decides overlap for symbolic addresses.
  • Resource lifetimes. Tensor memory and barriers are never used after they are freed or invalidated.
  • Equivalence to a reference. The kernel's outputs equal those of a PyTorch reference, in real arithmetic.
  • Witnesses. Every failed check comes with evidence, such as the two unordered accesses of a race. Inconclusive checks retain their specific result category and diagnostics; they are never reported as a pass.
  • Blackwell coverage. TMA, tcgen05 MMA and tensor memory, mbarriers, thread-block clusters and asynchronous copies.

Results

Results for every kernel in our benchmark, with diagnostics and evidence, are in Kernel verification results.

SentryWard has found synchronization bugs in popular kernel libraries, such as a signal sent before the asynchronous write it announces has completed, and a buffer reused while the tensor core is still reading it. We have reported some of them upstream.

Removing redundant synchronization

Because SentryWard checks every schedule, it can also show that a synchronization operation is unnecessary: if the kernel still verifies without it, the operation is redundant. We applied this test greedily, one operation at a time.

Per-kernel synchronization removal results include removable operation counts and B200 timings for both recorded and larger inputs. Experiments are saved in examples/results.json, with their sources, methodology, and limitations. These results hold for the tested input shapes; other shapes may require synchronization that was removable here.

Getting started

Install

pip install sentryward                # synchronization and memory checks
pip install "sentryward[reference]"   # adds PyTorch for reference equivalence

Wheels include the native verifier. Building from source needs CMake 3.27+, a C++20 compiler, OpenSSL, Boost headers and, optionally, Z3.

Verify a kernel

# Check synchronization and memory
sentryward kernel.ptx --input input.json > output.json

# Also check equivalence to a PyTorch reference
sentryward kernel.ptx \
  --input input.json \
  --reference reference.py \
  --reference-binding reference_binding.json \
  --timeout 500 \
  --memory-limit-mib 81920 > output.json

The same check from Python:

from sentryward import verify

result = verify(
    "kernel.ptx",
    input="input.json",
    reference="reference.py",                    # optional
    reference_binding="reference_binding.json",  # optional
    timeout_seconds=500,
    memory_limit_mib=None,                       # unlimited
)
print(result["result"], result["checks"])
CLI Python Description
--input input Required. The kernel's input configuration (JSON).
--reference reference Optional. A Python file that defines a reference(...) function.
--reference-binding reference_binding Optional. Maps the reference to the kernel's inputs and outputs. Defaults to reference_binding.json next to the reference, then in its parent directory.
--timeout timeout_seconds Total budget for the whole call, including reference capture. Default: 600 seconds.
--memory-limit-mib memory_limit_mib Memory budget as a positive integer in MiB, e.g. 81920 for 80 GiB. Default: unlimited.

The reference takes no separate input file. Its arguments are derived from the kernel's input configuration and the binding; anything that cannot be derived goes in the binding's reference section. The binding's optional provenance object supplies source metadata and recorded input scope; see the binding format.

Python paths accept strings or pathlib.Path. A reference binding requires a reference function. Timeout values must be positive and finite; explicit memory limits must be positive integers and apply to both capture and verification. The reference function executes as Python code during capture. The public Python package exports verify; the CLI accepts the PTX path directly, without a subcommand.

Read the result

The CLI prints a JSON result to stdout, and verify returns the same structure as a dictionary:

  • result is the overall verdict. race_free means the synchronization and memory checks passed and no reference was given; verified means equivalence to the reference was proved as well. Other values name a finding, such as potential_race, or the reason the analysis stopped, such as unsupported or timeout.
  • checks gives the status of each check: synchronization, memory and equivalence.
  • diagnostics and warnings hold the details, including witnesses.
  • equivalence holds the complete equivalence result.

CLI exit code 0 can also accompany findings or inconclusive checks; inspect result and checks instead of using the exit code as a correctness verdict. See output.json for the complete result format.

Build from source

Install a C++20 compiler, CMake 3.27+, Boost headers, OpenSSL and Z3 development libraries, then install from the repository root:

python -m pip install ".[reference]"

For a standalone native build, use make build-cpp. To rerun the saved examples:

make venv
build/venv/bin/python -m pip install ".[reference,dev]"
make rerun-examples

The default build contains the verifier only. Example reruns preserve previous outputs; make rerun-examples-performance includes historical timeout cases.

To select one example and set its total time budget:

make rerun-examples EXAMPLE_RUN_ARGS="--name pytorch__aten_MultiMarginLoss__sm_100a --timeout 500"

The runner reuses inputs unchanged and checks reference equivalence after verification prerequisites pass. Current results are saved in examples/<kernel>/output.json; previous outputs and run summaries are retained under build/artifacts/. Narrative reports are not included; use the generate-kernel-report skill to generate a report from the current output when needed.

How it works

How SentryWard verifies a kernel: specialization, the event and value views, the well-synchronization check, the race and lifecycle check, memory elimination, and the expression check

Limitations

  • Problem sizes and the launch configuration are fixed.
  • Branches and loop bounds may depend on the launch configuration, but not on tensor data unless explicit representative-control assumptions are enabled; see Representative branches, off by default.
  • Fences and the full PTX memory model are not modeled. The hardware model follows our reading of the PTX documentation, which does not specify every detail.
  • Equivalence treats floating-point values as real numbers, and the check is incomplete: finding no proof does not mean the kernel is wrong.

Documentation

Repository layout

cpp/                C++ frontend, verifier and equivalence engine
sentryward/         Python CLI and process interface
corpus/             Compiled Blackwell PTX kernels of the benchmark
examples/<kernel>/  input.json, output.json, and reference.py/reference_binding.json where available
examples/_reference/ Shared mathematical helpers used by example references
config/             Default and available analysis assumptions
skills/             Agent skills for preparing inputs and explaining results
tools/              Example regression tooling

License

Apache License 2.0; see LICENSE.

Metadata

Release files for sentryward 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sentryward 0.1.1
File Size Uploaded
sentryward-0.1.1.tar.gz 1.4 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for sentryward 0.1.1
File Interpreter ABI Platform
sentryward-0.1.1-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details
sentryward-0.1.1-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details
sentryward-0.1.1-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details

Total release size: 52.2 MB

Release files / sentryward-0.1.1.tar.gz

Download URL sentryward-0.1.1.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
91a21ac92fc0cdce45c340e3399a1155d7e134f87c891e321b96dbd48c3b4114
BLAKE2b-256 checksum
How to use checksums
9068d075bcaf176ad4a0c242bd28d800901c59617ce497983016ea6b03a1a604
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / sentryward-0.1.1-py3-none-manylinux_2_28_x86_64.whl

Download URL sentryward-0.1.1-py3-none-manylinux_2_28_x86_64.whl
Size 19.2 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a5701ad06aa0e67b45e53ce01bf6145aaadeaeda27e5e041b92b5f700907fe90
BLAKE2b-256 checksum
How to use checksums
1ee21b457f3c0c8f4df4095575edb17ad4f5305315a2520b42d685ef55988a37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / sentryward-0.1.1-py3-none-manylinux_2_28_aarch64.whl

Download URL sentryward-0.1.1-py3-none-manylinux_2_28_aarch64.whl
Size 17.6 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
e1f3a9cca49c8bd562f808bfecfc32c9697a14818e4f772d91911b4a128c170c
BLAKE2b-256 checksum
How to use checksums
75fc6f7b12dcdd549e2dd46e12da439278a2750edec178fc46c8b2c91cd00677
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / sentryward-0.1.1-py3-none-macosx_14_0_arm64.whl

Download URL sentryward-0.1.1-py3-none-macosx_14_0_arm64.whl
Size 14.0 MB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
fc86064531790fac1f07453f8072108d8cef02850a32bb5f6d0ca98a5956463e
BLAKE2b-256 checksum
How to use checksums
dd594446a1d87c166cced5f1c9220b83cf5f322a48e98d8398becd7ab386e955
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

4 release files

0.1.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page