-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'llvm' into review/yang/dsan_nullpointer
- Loading branch information
Showing
64 changed files
with
1,783 additions
and
1,106 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
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
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
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
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
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,33 @@ | ||
//===--------- memory_helpers.cpp - Level Zero Adapter -------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "memory_helpers.hpp" | ||
#include "../common.hpp" | ||
|
||
ze_memory_type_t getMemoryType(ze_context_handle_t hContext, void *ptr) { | ||
// TODO: use UMF once | ||
// https://github.com/oneapi-src/unified-memory-framework/issues/687 is | ||
// implemented | ||
ZeStruct<ze_memory_allocation_properties_t> zeMemoryAllocationProperties; | ||
ZE2UR_CALL_THROWS(zeMemGetAllocProperties, | ||
(hContext, ptr, &zeMemoryAllocationProperties, nullptr)); | ||
return zeMemoryAllocationProperties.type; | ||
} | ||
|
||
bool maybeImportUSM(ze_driver_handle_t hTranslatedDriver, | ||
ze_context_handle_t hContext, void *ptr, size_t size) { | ||
if (ZeUSMImport.Enabled && ptr != nullptr && | ||
getMemoryType(hContext, ptr) == ZE_MEMORY_TYPE_UNKNOWN) { | ||
// Promote the host ptr to USM host memory | ||
ZeUSMImport.doZeUSMImport(hTranslatedDriver, ptr, size); | ||
return true; | ||
} | ||
return false; | ||
} |
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,23 @@ | ||
//===--------- memory_helpers.hpp - Level Zero Adapter -------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#pragma once | ||
|
||
#include <ur_api.h> | ||
#include <ze_api.h> | ||
|
||
// If USM Import feature is enabled and hostptr is supplied, | ||
// import the hostptr if not already imported into USM. | ||
// Data transfer rate is maximized when both source and destination | ||
// are USM pointers. Promotion of the host pointer to USM thus | ||
// optimizes data transfer performance. | ||
bool maybeImportUSM(ze_driver_handle_t hTranslatedDriver, | ||
ze_context_handle_t hContext, void *ptr, size_t size); | ||
|
||
ze_memory_type_t getMemoryType(ze_context_handle_t hContext, void *ptr); |
Oops, something went wrong.