MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CheckRedzoneHost

Function CheckRedzoneHost

tensorflow/stream_executor/cuda/redzone_allocator.cc:179–208  ·  view source on GitHub ↗

Check that redzones weren't overwritten on a host. Slower, but gives a more useful error message.

Source from the content-addressed store, hash-verified

177//
178// Slower, but gives a more useful error message.
179static port::StatusOr<RedzoneCheckStatus> CheckRedzoneHost(
180 DeviceMemoryBase redzone, DeviceMemoryBase user_allocation,
181 absl::string_view name, Stream* stream, uint8 redzone_pattern) {
182 uint64 size = redzone.size();
183 auto redzone_data = absl::make_unique<uint8[]>(size);
184 TF_RETURN_IF_ERROR(stream->ThenMemcpy(redzone_data.get(), redzone, size)
185 .BlockHostUntilDone());
186
187 std::array<uint8, sizeof(uint64)> pattern_arr;
188 pattern_arr.fill(redzone_pattern);
189 uint64 pattern64;
190 std::memcpy(&pattern64, pattern_arr.data(), sizeof(uint64));
191
192 int64 i;
193 for (i = 0; i + 7 < size; i += sizeof(uint64)) {
194 uint64 rz_value = *reinterpret_cast<uint64*>(&redzone_data[i]);
195 if (rz_value != pattern64) {
196 return RedzoneCheckStatus(name, user_allocation.opaque(), i, pattern64,
197 rz_value);
198 }
199 }
200 for (; i < size; ++i) {
201 uint8 rz_value = redzone_data[i];
202 if (rz_value != redzone_pattern) {
203 return RedzoneCheckStatus(name, user_allocation.opaque(), i,
204 redzone_pattern, rz_value);
205 }
206 }
207 return RedzoneCheckStatus::OK();
208}
209
210// Run the redzone checker on the provided buffer redzone.
211//

Callers

nothing calls this directly

Calls 7

RedzoneCheckStatusClass · 0.85
fillMethod · 0.80
opaqueMethod · 0.80
sizeMethod · 0.45
BlockHostUntilDoneMethod · 0.45
getMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected