Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b69859e
feat(attention): add PR7 FlashInfer fused backend scaffold
inaniloquentee Aug 5, 2026
5289392
fix(attention): enforce FlashInfer Split-KV and CP merge contract
inaniloquentee Aug 12, 2026
2e25116
fix(attention): include deterministic CP reference for PR7
inaniloquentee Aug 12, 2026
740f7c9
Merge remote-tracking branch 'upstream/main' into codex/update-pr279
inaniloquentee Aug 12, 2026
025cfa4
fix(attention): align PR7 dispatch and replay metadata
inaniloquentee Aug 12, 2026
6e8848d
fix(attention): bind decode replay to cache execution identity
inaniloquentee Aug 12, 2026
23b518f
fix(attention): validate CP reference numeric inputs
inaniloquentee Aug 13, 2026
de673d2
fix(attention): bind backward gradient dtype and device
inaniloquentee Aug 13, 2026
5f85361
fix(attention): enforce FP32 CP merge state
inaniloquentee Aug 13, 2026
b83141e
fix(attention): fail closed on unverified FlashInfer execution
inaniloquentee Aug 13, 2026
a2b2cbd
test(attention): add two-rank P2P NCCL reference check
inaniloquentee Aug 13, 2026
75365a3
style(attention): satisfy full PR lint
inaniloquentee Aug 13, 2026
cee6da5
feat(attention): execute CP query AG and deterministic fallback
inaniloquentee Aug 16, 2026
0ed7b56
test(attention): accept CUDA unavailable fail-closed path
inaniloquentee Aug 16, 2026
3a65f4c
fix(ws2): record missing FlashInfer as unavailable
Aug 16, 2026
6e1b065
fix(ws2): run strict FlashInfer provenance on native FA2
Aug 16, 2026
0eecbfd
style(attention): satisfy PR7 pre-commit hooks
Aug 16, 2026
d35250a
fix(types): narrow attention plan values
Aug 16, 2026
0cc82b6
test(attention): cover TP2 CP2 P2P reference
Aug 17, 2026
8309b77
feat(attention): route strict CP through shared deterministic core
inaniloquentee Aug 17, 2026
7bea721
feat(attention): reuse WS1 PR315 deterministic operators
Aug 18, 2026
aecdf4d
fix(attention): route strict core through canonical schedule
inaniloquentee Aug 18, 2026
8e00bad
feat(attention): expose canonical strict schedule
inaniloquentee Aug 18, 2026
cc47649
Merge remote-tracking branch 'upstream/test' into codex/review-pr279-…
inaniloquentee Aug 18, 2026
b7f463b
fix(attention): enforce strict schedule provenance
inaniloquentee Aug 18, 2026
99d2eca
fix(attention): compare strict PR7 path to shared CUDA core
Aug 18, 2026
802f168
feat(attention): default strict runtime to decoupled ring schedule
Aug 19, 2026
4784c9b
style(attention): format PR7 validation script
inaniloquentee Aug 19, 2026
044f5b1
feat(attention): use strict FA4 production core
inaniloquentee Aug 20, 2026
3e04a63
Merge origin/test into PR #279
inaniloquentee Aug 24, 2026
e07f8b1
Merge test into PR #279
inaniloquentee Aug 24, 2026
28582d0
Merge latest test into PR #279
inaniloquentee Aug 24, 2026
4a60fe5
Merge latest test into PR #279
inaniloquentee Aug 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ci/run_gpu_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,17 @@ TORCH_INDEX_URL="${TORCH_INDEX_URL:-https://download.pytorch.org/whl/cu124}"
# --no-build-isolation: torch must be visible to setup.py, else the extension is silently skipped.
# --no-deps: keep the pinned torch; do not let the editable install re-resolve it.
"$PY" -m pip install --no-build-isolation --no-deps -e .
"$PY" -m pip install --no-cache-dir numpy tabulate accelerate "transformers==5.13.1" pytest triton
"$PY" -m pip install --no-cache-dir numpy tabulate accelerate "transformers==5.13.1" pytest triton "flashinfer-python>=0.6.0,<0.7"
nvidia-smi
# Fail fast if _C did not build or cannot launch, instead of silently using native fallbacks.
"$PY" scripts/ci_smoke.py
# Enforce _C in the pytest suite too (test_extension_smoke.py skips unless this is set).
export RL_KERNEL_REQUIRE_EXT=1
"$PY" -m pytest tests/test_flashinfer_pr7_attention.py -q
"$PY" scripts/ws2_pr7_flashinfer_attention_check.py --no-dry-run --device cuda --mode decode --split-kv-policy disabled --output artifacts/pr7-decode-disabled.json
"$PY" scripts/ws2_pr7_flashinfer_attention_check.py --no-dry-run --device cuda --mode decode --split-kv-policy fixed --fixed-split-size 4 --output artifacts/pr7-decode-fixed.json
"$PY" scripts/ws2_pr7_flashinfer_attention_check.py --no-dry-run --device cuda --mode prefill --query-len 4 --split-kv-policy disabled --output artifacts/pr7-prefill-disabled.json
"$PY" scripts/ws2_pr7_flashinfer_attention_check.py --no-dry-run --device cuda --mode prefill --query-len 4 --split-kv-policy fixed --fixed-split-size 4 --output artifacts/pr7-prefill-fixed.json
export WS1_C8_JSON=/tmp/ws1-c8-ci.json
export WS1_WEIGHTS_PATH="'"${WS1_WEIGHTS_PATH:-}"'"
if [ "$WS1_TEST_SUITE" = "ws1-chain" ]; then
Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile.cuda
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY pyproject.toml setup.py* requirements*.txt ./

RUN pip install --no-cache-dir -U pip \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir "flashinfer-python>=0.6.0,<0.7" \
&& pip install --no-cache-dir pytest

WORKDIR /workspace
405 changes: 405 additions & 0 deletions docs/design/ws2-attention-pr7-flashinfer-rope-splitk.md

Large diffs are not rendered by default.

52 changes: 0 additions & 52 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,52 +0,0 @@
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "RL-Kernel"
version = "0.1.0"
description = "High-performance RL training engine focused on kernel fusion and memory efficiency."
readme = "README.md"
requires-python = ">=3.10"
license = {text = "Apache-2.0"}
authors = [
{name = "RL-Kernel Contributors"}
]
dependencies = [
"torch>=2.4.1",
"tabulate",
"numpy",
"accelerate",
"transformers==5.13.1",
]

[project.optional-dependencies]
cuda = ["flashinfer-python>=0.1.6", "nvidia-ml-py"]
rocm = ["aiter"]
vllm = ["vllm>=0.6.0"]
drift-viewer = ["Pillow>=10", "PySide6>=6.6"]
dev = ["pytest", "black", "isort", "ruff", "mypy", "pre-commit"]

[tool.setuptools.packages.find]
where = ["."]
include = ["rl_engine*"]

[tool.ruff]
line-length = 100

[tool.ruff.lint]
select = ["E", "F", "B"]
ignore = []

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]

[tool.mypy]
ignore_missing_imports = true
follow_imports = "silent"

[tool.pytest.ini_options]
markers = [
"smoke_operator: temporary smoke-only operator plumbing tests",
"unit: CPU-safe unit tests",
]
14 changes: 11 additions & 3 deletions rl_engine/kernels/attention_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
_EnumT = TypeVar("_EnumT", bound=Enum)


# Stable identity shared by the training and rollout deterministic Attention
# core. Backend adapters may differ, but strict mode must report this ID.
STRICT_ATTENTION_CORE_ID = "rlkernel.attention.deterministic_core.v1"
# Stable identities for Attention arithmetic shared by training and rollout.
# The FA4 core is the strict production path. The materializing RL-Kernel core
# remains available as an explicit reference and capability-gap fallback.
STRICT_ATTENTION_PRODUCTION_CORE_ID = "rlkernel.attention.flash_attention4.num_splits1.v1"
STRICT_ATTENTION_REFERENCE_CORE_ID = "rlkernel.attention.deterministic_core.v1"
# Compatibility alias for callers that explicitly select the original core.
STRICT_ATTENTION_CORE_ID = STRICT_ATTENTION_REFERENCE_CORE_ID
STRICT_ATTENTION_FA4_SCHEDULE_ID = "single_batch_flash_attention4_num_splits1"
STRICT_ATTENTION_SCHEDULE_ID = "single_batch_single_query_global_kv_blocks"


Expand Down Expand Up @@ -1672,6 +1677,9 @@ class AttentionDispatchResult:
"SplitKVRuntimePlanSet",
"SplitKVSpec",
"STRICT_ATTENTION_CORE_ID",
"STRICT_ATTENTION_FA4_SCHEDULE_ID",
"STRICT_ATTENTION_PRODUCTION_CORE_ID",
"STRICT_ATTENTION_REFERENCE_CORE_ID",
"STRICT_ATTENTION_SCHEDULE_ID",
"validate_split_kv_alignment",
"validate_split_kv_plan_set_alignment",
Expand Down
12 changes: 10 additions & 2 deletions rl_engine/kernels/ops/cuda/attention/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from .deterministic_attn import DeterministicAttentionOp
from .flash_attn import FlashAttentionOp
from .flash_attn import FlashAttentionOp, StrictFlashAttention4Core, StrictFlashAttentionUnavailable
from .prefix_shared_attn import PrefixSharedAttentionOp

__all__ = ["DeterministicAttentionOp", "FlashAttentionOp", "PrefixSharedAttentionOp"]
__all__ = [
"DeterministicAttentionOp",
"FlashAttentionOp",
"PrefixSharedAttentionOp",
"StrictFlashAttention4Core",
"StrictFlashAttentionUnavailable",
]

# CP communication and FlashInfer are optional layers owned by later WS2 PRs.
# Keep the base Attention package importable while those PRs are developed or
Expand All @@ -14,6 +20,7 @@
AttentionCPCommunicationPlan,
AttentionCPCommunicationUnavailable,
AttentionCPMergedState,
AttentionCPOutputShard,
AttentionCPPartialState,
AttentionParallelSpec,
CPCommunicationBackend,
Expand All @@ -32,6 +39,7 @@
"AttentionCPCommunicationPlan",
"AttentionCPCommunicationUnavailable",
"AttentionCPMergedState",
"AttentionCPOutputShard",
"AttentionCPPartialState",
"AttentionParallelSpec",
"CPCommunicationBackend",
Expand Down
Loading
Loading