[SOT] Add C++ compiled guard lookup#79036
Draft
SigureMo wants to merge 6 commits into
Draft
Conversation
Add a C++ compiled guard implementation and trie-based lookup for SOT cache entries. Wire it into the executor cache without Python guard fallback, and keep strict guard checking as a mirror path that validates compiled hits against the original guard semantics. Add focused correctness tests plus a ResNet guard benchmark comparing Paddle compiled guard lookup with Torch Dynamo guard behavior. Co-authored-by: Codex <noreply@openai.com>
|
你的PR提交成功,感谢你对开源项目的贡献! |
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Performance Optimization
PR Types
Performance
Description
本 PR 为 SOT guard 增加 C++ compiled guard 与跨 guard 的 trie lookup,用于降低热启动 cache 命中链路中的 guard 开销。
主要改动:
CompiledGuard,覆盖 type/id/value/length/tensor meta/layer hook 等 SOT guard 场景。CompiledGuardLookup,按 guard op key 构建 trie,在多 cache entry 场景下复用公共前缀并直接返回 cache index。test/sot/test_compiled_guard.py覆盖 hit/miss、layer hook、constructor error、3 miss + 4th hit lookup 等 correctness case。test/sot/benchmark_compiled_guard.py便于本地和 nightly 对比 Paddle/Torch guard 性能。本地验证:
prekninja -C build_312 python/paddle/base/libpaddle.sopython -m py_compile ...python test/sot/test_compiled_guard.pySOT_ENABLE_STRICT_GUARD_CHECK=True python test/sot/test_sot_resnet.pypython -m unittest test.sot.test_guard_tree test.sot.test_sot_cachepython test/sot/test_guard_fastpath_strategy.pypython test/sot/benchmark_compiled_guard.py --case resnet18 --resnet-image-size 64 --iterations 10000 --hot-iterations 20 --rounds 7 --compare-torch --multi-cache-count 4 --max-torch-guard-ratio 1.1 --max-torch-multi-lookup-ratio 1.1ResNet guard benchmark result:
是否引起精度变化
否。该改动只影响 SOT guard/cache 命中判断路径,不改变算子计算或模型数值逻辑;strict guard check 下会校验 compiled guard 与原 guard 结果一致。