compile tests when passing PADDLE_WITH_CUSTOM_KERNEL macro#60
Open
youge325 wants to merge 18 commits intoPFCCLab:masterfrom
Open
compile tests when passing PADDLE_WITH_CUSTOM_KERNEL macro#60youge325 wants to merge 18 commits intoPFCCLab:masterfrom
youge325 wants to merge 18 commits intoPFCCLab:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a CMake switch to compile Paddle-side gtests with PADDLE_WITH_CUSTOM_KERNEL (without affecting Torch-side builds), and moves the previously external resize repro into the C++ gtest suite to reproduce the MaybeResetHolder-related behavior.
Changes:
- Add
ENABLE_PADDLE_CUSTOM_KERNEL_COMPAT_TESTSto optionally compile Paddle tests withPADDLE_WITH_CUSTOM_KERNEL. - Add a new
TensorTestcase to validate storagenbytes()growth behavior afterresize_(). - Remove the standalone
resize_reproPython/C++ extension repro scaffolding.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
CMakeLists.txt |
Adds an opt-in CMake option that appends PADDLE_WITH_CUSTOM_KERNEL only to Paddle test targets. |
test/ATen/core/TensorTest.cpp |
Adds ResizeGrowStorageNbytes gtest and includes <cstdint> for int32_t. |
README.md |
Documents how to build a separate directory enabling the Paddle custom-kernel compat define. |
.gitignore |
Removes Python-related ignore patterns. |
resize_repro/setup.py |
Deleted (previous standalone extension build script). |
resize_repro/run_test.py |
Deleted (previous standalone runner). |
resize_repro/resize_repro.cpp |
Deleted (previous standalone C++ repro extension). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+750
to
+759
| const size_t before_bytes = grow.storage().nbytes(); | ||
|
|
||
| grow.resize_({4}); | ||
|
|
||
| const size_t after_bytes = grow.storage().nbytes(); | ||
| const size_t expected_bytes = 4 * sizeof(int32_t); | ||
| const bool shape_ok = grow.numel() == 4; | ||
| const bool storage_ok = after_bytes >= expected_bytes; | ||
|
|
||
| file << std::to_string(before_bytes >= 2 * sizeof(int32_t) ? 1 : 0) << " "; |
Comment on lines
+214
to
+219
| if(ENABLE_PADDLE_CUSTOM_KERNEL_COMPAT_TESTS) | ||
| message( | ||
| STATUS | ||
| "Paddle compat tests enabled with PADDLE_WITH_CUSTOM_KERNEL definition.") | ||
| list(APPEND _paddle_cuda_defs "PADDLE_WITH_CUSTOM_KERNEL") | ||
| endif() |
…btorch In CPU-only libtorch builds, c10/cuda/CUDAStream.h includes cuda_runtime_api.h which is unavailable. Wrap CUDA-specific includes, has_cuda_runtime() helper, and CUDA-only test cases with #ifdef USE_CUDA. CMakeLists.txt now passes USE_CUDA to torch test targets only when TORCH_HAS_CUDA_SUPPORT is ON. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
在cpp层复现 MaybeResetHolder 的问题
最后一次修改,覆盖率报告如下:
