Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class EnqueuedPool {

EnqueuedPool(event_release_callback_t EventReleaseFn,
memory_free_callback_t MemFreeFn)
: EventReleaseFn(EventReleaseFn), MemFreeFn(MemFreeFn) {}
: EventReleaseFn(std::move(EventReleaseFn)),
MemFreeFn(std::move(MemFreeFn)) {}

~EnqueuedPool();
std::optional<Allocation> getBestFit(size_t Size, size_t Alignment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,9 @@ ur_result_t MsanShadowMemoryCPU::Setup() {
uptr End = kMemoryLayout[i].end;
uptr Size = End - Start;
MappingDesc::Type Type = kMemoryLayout[i].type;
bool InitOrigins = true;

bool IsMap = Type == MappingDesc::SHADOW ||
(InitOrigins && Type == MappingDesc::ORIGIN);
bool IsProtect = Type == MappingDesc::INVALID ||
(!InitOrigins && Type == MappingDesc::ORIGIN);
bool IsMap = Type == MappingDesc::SHADOW || Type == MappingDesc::ORIGIN;
bool IsProtect = Type == MappingDesc::INVALID;

if (IsMap) {
if (MmapFixedNoReserve(Start, Size) == 0) {
Expand Down Expand Up @@ -124,9 +121,7 @@ ur_result_t MsanShadowMemoryCPU::Destory() {
uptr End = kMemoryLayout[i].end;
uptr Size = End - Start;
MappingDesc::Type Type = kMemoryLayout[i].type;
bool InitOrigins = true;
bool IsMap = Type == MappingDesc::SHADOW ||
(InitOrigins && Type == MappingDesc::ORIGIN);
bool IsMap = Type == MappingDesc::SHADOW || Type == MappingDesc::ORIGIN;
if (IsMap) {
if (Munmap(Start, Size)) {
return UR_RESULT_ERROR_UNKNOWN;
Expand Down
13 changes: 9 additions & 4 deletions unified-runtime/source/loader/ur_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,15 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
[&](ur_device_handle_t urDeviceHandle) {
// obtain and record device type from platform (squash
// errors)
ur_device_type_t hardwareType = ::UR_DEVICE_TYPE_DEFAULT;
urDeviceGetInfo(urDeviceHandle, UR_DEVICE_INFO_TYPE,
sizeof(ur_device_type_t), &hardwareType,
0);
ur_device_type_t hardwareType;
ur_result_t res = urDeviceGetInfo(
urDeviceHandle, UR_DEVICE_INFO_TYPE,
sizeof(ur_device_type_t), &hardwareType, 0);
// ignore failures and just assume the default hw type
if (res != UR_RESULT_SUCCESS) {
hardwareType = ::UR_DEVICE_TYPE_DEFAULT;
}

return DeviceSpec{DevicePartLevel::ROOT, hardwareType,
deviceCount++, DeviceIdTypeALL,
DeviceIdTypeALL, urDeviceHandle};
Expand Down
Loading