[FIX][TEST] Add device attr to FakeTensor for OOB report#302
Merged
Conversation
…r OOB FakeTensor was missing a `device` attribute, causing the sanitizer OOB report to crash with AttributeError when virtual_memory mode is enabled. Add the attribute and an end-to-end test that verifies the full OOB report completes without error.
Sanitizer Performance Benchmark
Iterations: 1 warmup + 40 measured |
The virtual_memory/FakeTensor path does not require a real CUDA device, so drop the explicit device arg to allow the test to run on CPU-only CI machines.
Member
|
Can we just use pytorch's https://docs.pytorch.org/docs/stable/user_guide/torch_compiler/torch.compiler_fake_tensor.html? |
Collaborator
Author
Yes, I'm trying to refactor fake tensor in #303. This test only add a string attribute to the existing fake tensor class to avoid a crash in OOB report. |
Collaborator
Author
@Jokeren BTW the current FakeTensor implementation is the same lightweight as PyTorch's Fake Tensor. |
Jokeren
approved these changes
Mar 3, 2026
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.
Summary
FakeTensorwas missing adeviceattribute, causing the sanitizer OOB report (print_oob_record_pdb_style) to crash withAttributeErrorwhenSANITIZER_ENABLE_FAKE_TENSOR=1(virtual memory mode) is enabled.device = "fake_tensor"toFakeTensor.test_oob_with_fake_tensor) that enables virtual memory mode, runs an OOB kernel, and verifies the sanitizer produces a full report without crashing.Test plan
uv run pytest tests/end_to_end/test_sanitizer.py::test_oob_with_fake_tensor -x -vpasses