Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][L0] Reenable native memcpy2d path for L0 #9973

Draft
wants to merge 6 commits into
base: sycl
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 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
1 change: 0 additions & 1 deletion sycl/doc/EnvironmentVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ variables in production code.</span>
| `SYCL_PI_LEVEL_ZERO_COMMANDLISTS_CLEANUP_THRESHOLD` | Integer | If non-negative then the threshold is set to this value. If negative, the threshold is set to INT_MAX. Whenever the number of command lists in a queue exceeds this threshold, an attempt is made to cleanup completed command lists for their subsequent reuse. The default is 20. |
| `SYCL_PI_LEVEL_ZERO_IMMEDIATE_COMMANDLISTS_EVENT_CLEANUP_THRESHOLD` | Integer | If non-negative then the threshold is set to this value. If negative, the threshold is set to INT_MAX. Whenever the number of events associated with an immediate command list exceeds this threshold, a check is made for signaled events and these events are recycled. Setting this threshold low causes events to be checked more often, which could result in unneeded events being recycled sooner. However, more frequent event status checks may cost time. The default is 1000. |
| `SYCL_PI_LEVEL_ZERO_USM_RESIDENT` | Integer | Bit-mask controls if/where to make USM allocations resident at the time of allocation. Input value is of the form 0xHSD, where 4-bits of D control device allocations, 4-bits of S control shared allocations, and 4-bits of H control host allocations. Each 4-bit componenet is holding one of the following values: "0" - then no special residency is forced, "1" - then allocation is made resident at the device of allocation, or "2" - then allocation is made resident on all devices in the context of allocation that have P2P access to the device of allocation. Default is 0x002, i.e. force full residency for device allocations only. |
| `SYCL_PI_LEVEL_ZERO_USE_NATIVE_USM_MEMCPY2D` | Integer | When set to a positive value enables the use of Level Zero USM 2D memory copy operations. Default is 0. |

## Debugging variables for CUDA Plugin

Expand Down
14 changes: 1 addition & 13 deletions sycl/plugins/unified_runtime/ur/adapters/level_zero/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextRelease(
return ContextReleaseHelper(Context);
}

// Due to a bug with 2D memory copy to and from non-USM pointers, this option is
// disabled by default.
static const bool UseMemcpy2DOperations = [] {
const char *UrRet = std::getenv("UR_L0_USE_NATIVE_USM_MEMCPY2D");
const char *PiRet = std::getenv("SYCL_PI_LEVEL_ZERO_USE_NATIVE_USM_MEMCPY2D");
const char *UseMemcpy2DOperationsFlag =
UrRet ? UrRet : (PiRet ? PiRet : nullptr);
if (!UseMemcpy2DOperationsFlag)
return false;
return std::atoi(UseMemcpy2DOperationsFlag) > 0;
}();

UR_APIEXPORT ur_result_t UR_APICALL urContextGetInfo(
ur_context_handle_t Context, ///< [in] handle of the context
ur_context_info_t ContextInfoType, ///< [in] type of the info to retrieve
Expand All @@ -106,7 +94,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextGetInfo(
return ReturnValue(uint32_t{Context->RefCount.load()});
case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT:
// 2D USM memcpy is supported.
return ReturnValue(uint32_t{UseMemcpy2DOperations});
return ReturnValue(uint32_t{true});
case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT:
// 2D USM fill is not supported.
return ReturnValue(uint32_t{false});
Expand Down