-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1402 from AllanZyne/user-after-free
[DeviceSanitizer] Checking "sycl::free" related errors
- Loading branch information
Showing
20 changed files
with
1,641 additions
and
796 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
* See LICENSE.TXT | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
* | ||
* @file asan_allocator.cpp | ||
* | ||
*/ | ||
|
||
#include "asan_allocator.hpp" | ||
#include "ur_sanitizer_layer.hpp" | ||
|
||
namespace ur_sanitizer_layer { | ||
|
||
void AllocInfo::print() { | ||
context.logger.info( | ||
"AllocInfo(Alloc=[{}-{}), User=[{}-{}), AllocSize={}, Type={})", | ||
(void *)AllocBegin, (void *)(AllocBegin + AllocSize), (void *)UserBegin, | ||
(void *)(UserEnd), AllocSize, ToString(Type)); | ||
} | ||
|
||
} // namespace ur_sanitizer_layer |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
* See LICENSE.TXT | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
* | ||
* @file asan_allocator.hpp | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "common.hpp" | ||
#include "stacktrace.hpp" | ||
|
||
#include <map> | ||
#include <memory> | ||
|
||
namespace ur_sanitizer_layer { | ||
|
||
enum class AllocType : uint32_t { | ||
UNKNOWN, | ||
DEVICE_USM, | ||
SHARED_USM, | ||
HOST_USM, | ||
MEM_BUFFER, | ||
DEVICE_GLOBAL | ||
}; | ||
|
||
struct AllocInfo { | ||
uptr AllocBegin = 0; | ||
uptr UserBegin = 0; | ||
uptr UserEnd = 0; | ||
size_t AllocSize = 0; | ||
|
||
AllocType Type = AllocType::UNKNOWN; | ||
bool IsReleased = false; | ||
|
||
ur_context_handle_t Context = nullptr; | ||
ur_device_handle_t Device = nullptr; | ||
|
||
StackTrace AllocStack; | ||
StackTrace ReleaseStack; | ||
|
||
void print(); | ||
}; | ||
|
||
using AllocationMap = std::map<uptr, std::shared_ptr<AllocInfo>>; | ||
using AllocationIterator = AllocationMap::iterator; | ||
|
||
inline const char *ToString(AllocType Type) { | ||
switch (Type) { | ||
case AllocType::DEVICE_USM: | ||
return "Device USM"; | ||
case AllocType::HOST_USM: | ||
return "Host USM"; | ||
case AllocType::SHARED_USM: | ||
return "Shared USM"; | ||
case AllocType::MEM_BUFFER: | ||
return "Memory Buffer"; | ||
case AllocType::DEVICE_GLOBAL: | ||
return "Device Global"; | ||
default: | ||
return "Unknown Type"; | ||
} | ||
} | ||
|
||
} // namespace ur_sanitizer_layer |
Oops, something went wrong.