Commit 1992bdd
authored
only register test device allocator once for multiple invoke (#19541)
Summary:
On AppleMac, the XCTest harness invokes RUN_ALL_TESTS() once per test
method within the same process, so DeviceAllocatorTest::SetUpTestSuite()
runs multiple times. The second invocation calls
register_device_allocator(&cuda_allocator()) for an already-registered
CUDA slot, hitting ET_CHECK_MSG(allocators_[index] == nullptr, ...) in
device_allocator.cpp:30 and aborting the process.
This diff made the registration in SetUpTestSuite() idempotent by
guarding it with get_device_allocator(DeviceType::CUDA) == nullptr.
Differential Revision: D1049552741 parent 52634f3 commit 1992bdd
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
151 | 153 | | |
152 | 154 | | |
153 | 155 | | |
| |||
0 commit comments