reproduce some mismatch points#58
Merged
BingooYang merged 32 commits intoPFCCLab:masterfrom Apr 3, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 旨在把历史上因为 rebase / 自动修复而“消失”的差异点重新纳入可复现的回归体系:一方面将原 unmatch_ 测试迁移/重写为常规回归测试,另一方面统一测试工程的 include 路径、构建收集规则,并补齐/整理兼容性文档。
Changes:
- 将部分
unmatch_*.cpp用例迁移为常规回归(新增test/ATen/UtilsTest.cpp、test/ATen/cuda/CUDAContextTest.cpp、test/c10/cuda/CUDATest2.cpp、test/c10/core/{DeviceTest,EventCompatTest}.cpp等)。 - 全面把测试中的
file_manager.h引用改为#include "src/file_manager.h",并调整 CMake 递归收集测试源文件+按规则排除unmatch_。 - 新增/整理大量 compat 对齐文档(c10/typeid、stream、cuda 工具类、ATen 差异记录等)。
Reviewed changes
Copilot reviewed 106 out of 125 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/unmatch_UtilsTest.cpp | 删除旧 unmatch Utils 测试 |
| test/unmatch_CUDAContextTest.cpp | 删除旧 unmatch CUDAContext 测试 |
| test/unmatch_AllocatorTest.cpp | 删除旧 unmatch Allocator 测试 |
| test/torch/LibraryTest.cpp | 统一 include 路径;移除分叉注释 |
| test/torch/csrc/api/include/torch/unmatch_PythonTest.cpp | include 调整;异常输出改动 |
| test/torch/csrc/api/include/torch/TorchCudaTest.cpp | include 路径调整 |
| test/torch/csrc/api/include/torch/PythonCompatTest.cpp | include 路径调整 |
| test/result_cmp.sh | set 选项注释调整 |
| test/DeviceTest.cpp | 删除旧 Device 测试 |
| test/CUDATest2.cpp | 删除旧 CUDATest2 |
| test/c10/util/OptionalArrayRefTest.cpp | 增加输出字段/遍历 |
| test/c10/util/HalfBFloat16Test.cpp | include 路径调整 |
| test/c10/util/ExceptionTest.cpp | 统一异常捕获与消息匹配 |
| test/c10/util/ArrayRefTest.cpp | include 路径调整 |
| test/c10/cuda/StreamTest.cpp | include 路径调整;异常输出细化 |
| test/c10/cuda/RecordStreamTest.cpp | include 路径调整 |
| test/c10/cuda/CUDATest2.cpp | 新增 CUDA 工具类回归测试 |
| test/c10/core/unmatch_EventTest.cpp | include 路径调整 |
| test/c10/core/TensorOptionsTest.cpp | include 路径调整;注释更新 |
| test/c10/core/StorageTest.cpp | include 路径调整 |
| test/c10/core/ScalarTypeTest.cpp | include 路径调整 |
| test/c10/core/ScalarTypeFunctionsTest.cpp | include 路径调整 |
| test/c10/core/ScalarTest.cpp | include 路径调整 |
| test/c10/core/ListTest.cpp | include 路径调整 |
| test/c10/core/LayoutMemoryFormatTest.cpp | include 路径调整 |
| test/c10/core/EventCompatTest.cpp | 新增 c10::Event 回归测试 |
| test/c10/core/DeviceTest.cpp | 新增 c10::Device 回归测试 |
| test/c10/core/DefaultDtypeTest.cpp | 兼容 set_default_dtype 调用差异 |
| test/c10/core/AllocatorCompatTest.cpp | 扩展 DataPtr/Allocator 覆盖 |
| test/ATen/UtilsTest.cpp | 新增 ATen Utils 常规回归 |
| test/ATen/ops/ViewTest.cpp | include 路径调整 |
| test/ATen/ops/ViewAsTest.cpp | include 路径调整 |
| test/ATen/ops/UnsqueezeTest.cpp | include 路径调整 |
| test/ATen/ops/TViewAsTest.cpp | include 路径调整 |
| test/ATen/ops/TTest.cpp | include 路径调整 |
| test/ATen/ops/TransposeTest.cpp | include 路径调整 |
| test/ATen/ops/ToTest.cpp | include 路径调整 |
| test/ATen/ops/TensorPtrTest.cpp | include 路径调整 |
| test/ATen/ops/TensorFactoryTest.cpp | include 路径调整 |
| test/ATen/ops/SumTest.cpp | include 路径调整 |
| test/ATen/ops/StdTest.cpp | include 路径调整;异常输出改动 |
| test/ATen/ops/SqueezeTest.cpp | include 路径调整 |
| test/ATen/ops/SplitTest.cpp | include 路径调整 |
| test/ATen/ops/SparseTensorTest.cpp | include 路径调整 |
| test/ATen/ops/SparseTensorExtraTest.cpp | include 路径调整 |
| test/ATen/ops/SliceTest.cpp | include 路径调整 |
| test/ATen/ops/SelectTest.cpp | include 路径调整;异常输出改动 |
| test/ATen/ops/ReshapeTest.cpp | include 路径调整 |
| test/ATen/ops/ReciprocalTest.cpp | include 路径调整;异常输出改动 |
| test/ATen/ops/PermuteTest.cpp | include 路径调整 |
| test/ATen/ops/NarrowTest.cpp | include 路径调整 |
| test/ATen/ops/MiscTensorTest.cpp | include 路径调整 |
| test/ATen/ops/ItemTest.cpp | include 路径调整 |
| test/ATen/ops/IndexTest.cpp | include 路径调整 |
| test/ATen/ops/IndexPutTest.cpp | include 路径调整 |
| test/ATen/ops/FromBlobTest.cpp | include 路径调整 |
| test/ATen/ops/FlattenTest.cpp | include 路径调整 |
| test/ATen/ops/EyeTest.cpp | include 路径调整 |
| test/ATen/ops/EqualTest.cpp | include 路径调整;异常输出改动 |
| test/ATen/ops/EmptyStridedTest.cpp | include 路径调整 |
| test/ATen/ops/EmptyOpsTest.cpp | include 路径调整 |
| test/ATen/ops/DetachTest.cpp | include 路径调整 |
| test/ATen/ops/CreationOpsTest.cpp | include 路径调整 |
| test/ATen/ops/ConnectionOpsTest.cpp | include 路径调整 |
| test/ATen/ops/CoalesceTest.cpp | include 路径调整 |
| test/ATen/ops/ArangeTest.cpp | include 路径调整;补充 dtype 推断用例 |
| test/ATen/ops/AllAndAllCloseTest.cpp | include 路径调整 |
| test/ATen/ops/AbsTest.cpp | 序列化逻辑改动 |
| test/ATen/native/RangeUtilsTest.cpp | include 路径调整 |
| test/ATen/IndexingTest.cpp | include 路径调整;注释更新 |
| test/ATen/DeviceGuardTest.cpp | include 路径调整 |
| test/ATen/cuda/GeneratorTest.cpp | include 路径调整 |
| test/ATen/cuda/CUDADataTypeTest.cpp | Bool/EmptyCUDA 分支输出调整 |
| test/ATen/cuda/CUDAContextTest.cpp | 新增 CUDAContext 常规回归 |
| test/ATen/cuda/CUDABlasTest.cpp | include 路径调整 |
| test/ATen/core/TensorUtilTest.cpp | include 路径调整 |
| test/ATen/core/TensorTest.cpp | resize_ 行为回归输出调整 |
| test/ATen/core/TensorTest_compare.cpp | include 路径调整 |
| test/ATen/core/TensorAccessorTest.cpp | include 路径调整 |
| test/ATen/core/LayoutTest.cpp | include 路径调整 |
| test/ATen/core/IValueTest.cpp | tagKind 输出覆盖增强 |
| test/ATen/AccumulateTypeTest.cpp | include 路径调整 |
| README.md | 修正测试文件路径示例 |
| doc/philox.md | 删除旧文档(迁移/替代) |
| doc/cuda_stream.md | 删除旧文档(迁移/替代) |
| doc/c10/util/typeid/uninitialized.md | 新增 typeid 子文档 |
| doc/c10/util/typeid/type_meta.md | 更新对齐状态与统计 |
| doc/c10/util/typeid/type_meta_data.md | 新增 typeid 子文档 |
| doc/c10/util/typeid/type_identifier.md | 新增 typeid 子文档 |
| doc/c10/util/typeid/README.md | 新增 typeid 文档索引 |
| doc/c10/util/typeid/is_paddle_fundamental.md | 新增 typeid traits 文档 |
| doc/c10/util/typeid/guard_long_unique_dummy.md | 新增 typeid guard 文档 |
| doc/c10/util/type_index.md | 新增 type_index 兼容文档 |
| doc/c10/util/mismatch_api_record.md | 新增 mismatch 记录汇总 |
| doc/c10/util/intrusive_ptr.md | 新增 intrusive_ptr 兼容文档 |
| doc/c10/cuda/mismatch_api_record.md | 新增 CUDA 工具类对齐记录 |
| doc/c10/cuda/cuda_stream.md | 新增 CUDAStream 兼容文档 |
| doc/c10/cuda/cuda_functions.md | 新增 CUDAFunctions 兼容文档 |
| doc/c10/core/stream.md | 新增 Stream 兼容文档 |
| doc/c10/core/stream_compat_arch.md | 更新向后兼容接口说明 |
| doc/c10/core/storage.md | 更新测试文件路径引用 |
| doc/c10/core/layout.md | 新增 Layout 兼容文档 |
| doc/c10/core/event.md | 新增 Event 兼容文档 |
| doc/c10/core/dispatch_key_set.md | 新增 DispatchKeySet 文档 |
| doc/c10/core/device.md | 新增 Device 兼容文档 |
| doc/c10/core/device_type.md | 新增 DeviceType 兼容文档 |
| doc/c10/core/allocator.md | 更新 Allocator 对齐状态 |
| doc/ATen/op_math_type.md | 新增 OpMathType 文档 |
| doc/ATen/mismatch_api_record.md | 新增 ATen mismatch 记录 |
| doc/ATen/cuda/philox.md | 新增 ATen Philox 文档 |
| doc/ATen/cuda/mismatch_api_record.md | 新增 ATen/cuda mismatch 记录 |
| doc/ATen/cuda/cuda_context_light.md | 新增 CUDAContextLight 文档 |
| doc/ATen/cuda/cuda_blas.md | 新增 CUDABlas 文档 |
| doc/ATen/core/tensor_body.md | 更新 resize_ 对齐状态 |
| doc/ATen/core/tensor_accessor.md | 新增 TensorAccessor 文档 |
| doc/ATen/core/mismatch_api_record.md | 新增 ATen/core mismatch 记录 |
| doc/ATen/core/generator.md | 更新测试路径引用 |
| .github/skills/compat-doc-authoring/SKILL.md | 更新文档模板规范 |
| CMakeLists.txt | 递归收集 tests;排除 unmatch_;CUDA 链接补充 |
| .gitignore | 忽略 .codex 相关文件 |
Comments suppressed due to low confidence (9)
test/torch/csrc/api/include/torch/unmatch_PythonTest.cpp:64
catch (...)does not bind an exception object, soe.what()is undefined here and this file will not compile. Catchconst std::exception& e(orconst c10::Error& e) if you want to print the message; otherwise print a stable token withoutwhat().
test/torch/csrc/api/include/torch/unmatch_PythonTest.cpp:84- Same issue: this
catch (...)block usese.what()but noeis in scope, causing a compile error. Switch tocatch (const std::exception& e)(or remove the message printing).
test/torch/csrc/api/include/torch/unmatch_PythonTest.cpp:136 - Same compile issue:
catch (...)cannot accesse.what(). Catch an exception type that provideswhat()if you need the message.
test/torch/csrc/api/include/torch/unmatch_PythonTest.cpp:158 - Same compile issue:
catch (...)usese.what()but no exception variable is declared. Usecatch (const std::exception& e)or avoid printingwhat()here.
test/c10/util/OptionalArrayRefTest.cpp:111 - This constructs
std::optional<ArrayRef>from a temporarystd::vector, leavingopt_arr(and thusarr) holding a dangling pointer. Accessingarr->front()is undefined behavior and will produce flaky/mismatched outputs. Keep the backingstd::vectoralive for the duration of the test (or avoid dereferencing entirely).
test/c10/util/OptionalArrayRefTest.cpp:296 - The comment above says emplace(initializer_list) leaves a dangling pointer and element iteration is unstable, but the test now iterates
*arranyway. This reintroduces undefined behavior/flaky outputs; use a persistent backing container (e.g.,std::vectorwith stable lifetime) or remove the element iteration.
test/c10/util/OptionalArrayRefTest.cpp:456 - This test constructs
OptionalArrayReffrom a temporarystd::vector, so the internalArrayRefis dangling after the full-expression. Iterating*arrhere is undefined behavior; use a namedstd::vectorvariable to keep storage alive (or only assert onhas_value/size).
test/ATen/ops/AbsTest.cpp:35 write_abs_result_to_filenow reads directly fromresult.data_ptr<T>()without normalizing to contiguous layout. This breaks theNonContiguousTensortest: ifat::abs(transposed)preserves strides, the serialization will read storage order rather than logical order (and can diverge between implementations). Serialize a contiguous CPU view (e.g.,result.contiguous().cpu()) before iterating over values.
test/c10/cuda/StreamTest.cpp:212- In the non-"not_supported" exception path, the output omits a trailing delimiter after the exception message (
file << "exception: " << msg;). This can make result files harder to parse consistently compared to other branches that emit space-delimited tokens. Consider appending a trailing space or emitting a stable token instead of rawwhat()text for result_cmp stability.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
1
to
3
| #!/bin/bash | ||
| set -u | ||
| set -u # -u 出错时继续,-e 出错时退出 | ||
|
|
There was a problem hiding this comment.
The inline comment describing set -u / set -e is incorrect: -u treats unset variables as an error (it doesn't mean “continue on error”), while -e exits on command failure in many cases. Please update the comment to reflect the actual bash options to avoid misleading future edits.
…onsistent across different environments, and it may cause test failure due to mismatch of expected and actual output. We can add the stack info back later when we have a more stable way to handle it.
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.
复现所有因 rebase 或 Agent 自动修复而消除的差异点