Skip to content

Commit 8a435d4

Browse files
[SYCL] Change graph cleanup environment variable name (#8720)
Now that there's only one regular graph cleanup mechanism, there's no need for two environment variables. Change it to SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP and deprecate SYCL_DISABLE_POST_ENQUEUE_CLEANUP.
1 parent afebb25 commit 8a435d4

File tree

7 files changed

+30
-19
lines changed

7 files changed

+30
-19
lines changed

sycl/doc/EnvironmentVariables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ variables in production code.</span>
195195
| `SYCL_QUEUE_THREAD_POOL_SIZE` | Positive integer | Number of threads in thread pool of queue. |
196196
| `SYCL_DEVICELIB_NO_FALLBACK` | Any(\*) | Disable loading and linking of device library images |
197197
| `SYCL_PRINT_EXECUTION_GRAPH` | Described [below](#sycl_print_execution_graph-options) | Print execution graph to DOT text file. |
198-
| `SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP` | Any(\*) | Disable cleanup of finished command nodes at host-device synchronization points. |
199-
| `SYCL_DISABLE_POST_ENQUEUE_CLEANUP` | Any(\*) | Disable cleanup of enqueued command nodes during submission. |
198+
| `SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP` | Any(\*) | Disable regular cleanup of enqueued (or finished, in case of host tasks) non-leaf command nodes. If disabled, command nodes will be cleaned up only during the destruction of the last remaining memory object used by them. |
199+
| `SYCL_DISABLE_POST_ENQUEUE_CLEANUP` (deprecated) | Any(\*) | Use `SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP` instead. |
200200
| `SYCL_DEVICELIB_INHIBIT_NATIVE` | String of device library extensions (separated by a whitespace) | Do not rely on device native support for devicelib extensions listed in this option. |
201201
| `SYCL_PROGRAM_COMPILE_OPTIONS` | String of valid OpenCL compile options | Override compile options for all programs. |
202202
| `SYCL_PROGRAM_LINK_OPTIONS` | String of valid OpenCL link options | Override link options for all programs. |

sycl/source/detail/scheduler/commands.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,7 @@ bool Command::enqueue(EnqueueResultT &EnqueueResult, BlockingT Blocking,
859859
// PI_SUCCESS
860860
MEnqueueStatus = EnqueueResultT::SyclEnqueueSuccess;
861861
if (MLeafCounter == 0 && supportsPostEnqueueCleanup() &&
862+
!SYCLConfig<SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP>::get() &&
862863
!SYCLConfig<SYCL_DISABLE_POST_ENQUEUE_CLEANUP>::get()) {
863864
assert(!MMarkedForCleanup);
864865
MMarkedForCleanup = true;

sycl/source/detail/scheduler/graph_builder.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,19 @@ void Scheduler::GraphBuilder::cleanupCommandsForRecord(MemObjRecord *Record) {
12181218

12191219
void Scheduler::GraphBuilder::cleanupCommand(Command *Cmd,
12201220
bool AllowUnsubmitted) {
1221-
if (SYCLConfig<SYCL_DISABLE_POST_ENQUEUE_CLEANUP>::get())
1221+
if (SYCLConfig<SYCL_DISABLE_POST_ENQUEUE_CLEANUP>::get()) {
1222+
static bool DeprWarningPrinted = false;
1223+
if (!DeprWarningPrinted) {
1224+
std::cerr << "WARNING: The enviroment variable "
1225+
"SYCL_DISABLE_POST_ENQUEUE_CLEANUP is deprecated. Please "
1226+
"use SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP instead.\n";
1227+
DeprWarningPrinted = true;
1228+
}
1229+
return;
1230+
}
1231+
if (SYCLConfig<SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP>::get())
12221232
return;
1233+
12231234
assert(Cmd->MLeafCounter == 0 &&
12241235
(Cmd->isSuccessfullyEnqueued() || AllowUnsubmitted));
12251236
Command::CommandType CmdT = Cmd->getType();

sycl/unittests/scheduler/EnqueueWithDependsOnDeps.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
using namespace sycl;
2121
using EventImplPtr = std::shared_ptr<detail::event_impl>;
2222

23-
constexpr auto DisablePostEnqueueCleanupName =
24-
"SYCL_DISABLE_POST_ENQUEUE_CLEANUP";
23+
constexpr auto DisableCleanupName = "SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP";
2524

2625
std::vector<std::pair<pi_uint32, const pi_event *>> PassedNumEvents;
2726

@@ -153,8 +152,8 @@ class DependsOnTests : public ::testing::Test {
153152

154153
unittest::PiMock Mock;
155154
unittest::ScopedEnvVar DisabledCleanup{
156-
DisablePostEnqueueCleanupName, "1",
157-
detail::SYCLConfig<detail::SYCL_DISABLE_POST_ENQUEUE_CLEANUP>::reset};
155+
DisableCleanupName, "1",
156+
detail::SYCLConfig<detail::SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP>::reset};
158157
MockScheduler MS;
159158

160159
detail::QueueImplPtr QueueDevImpl;

sycl/unittests/scheduler/LeafLimit.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
using namespace sycl;
2323

24-
inline constexpr auto DisablePostEnqueueCleanupName =
25-
"SYCL_DISABLE_POST_ENQUEUE_CLEANUP";
24+
inline constexpr auto DisableCleanupName =
25+
"SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP";
2626

2727
// Checks that scheduler's (or graph-builder's) addNodeToLeaves method works
2828
// correctly with dependency tracking when leaf-limit for generic commands is
@@ -34,8 +34,8 @@ TEST_F(SchedulerTest, LeafLimit) {
3434
// All of the mock commands are owned on the test side, prevent post enqueue
3535
// cleanup from deleting some of them.
3636
unittest::ScopedEnvVar DisabledCleanup{
37-
DisablePostEnqueueCleanupName, "1",
38-
detail::SYCLConfig<detail::SYCL_DISABLE_POST_ENQUEUE_CLEANUP>::reset};
37+
DisableCleanupName, "1",
38+
detail::SYCLConfig<detail::SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP>::reset};
3939
sycl::queue HQueue(detail::createSyclObjFromImpl<device>(
4040
detail::device_impl::getHostDeviceImpl()));
4141
MockScheduler MS;

sycl/unittests/scheduler/LeafLimitDiffContexts.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
using namespace sycl;
2222

23-
inline constexpr auto DisablePostEnqueueCleanupName =
24-
"SYCL_DISABLE_POST_ENQUEUE_CLEANUP";
23+
inline constexpr auto DisableCleanupName =
24+
"SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP";
2525

2626
// Checks that scheduler's (or graph-builder's) addNodeToLeaves method works
2727
// correctly with dependency tracking when leaf-limit for generic commands is
@@ -33,8 +33,8 @@ TEST_F(SchedulerTest, LeafLimitDiffContexts) {
3333
// All of the mock commands are owned on the test side, prevent post enqueue
3434
// cleanup from deleting some of them.
3535
unittest::ScopedEnvVar DisabledCleanup{
36-
DisablePostEnqueueCleanupName, "1",
37-
detail::SYCLConfig<detail::SYCL_DISABLE_POST_ENQUEUE_CLEANUP>::reset};
36+
DisableCleanupName, "1",
37+
detail::SYCLConfig<detail::SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP>::reset};
3838

3939
// Ensure the mock plugin has been initialized prior to selecting a device.
4040
unittest::PiMock::EnsureMockPluginInitialized();

sycl/unittests/scheduler/StreamInitDependencyOnHost.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
using namespace sycl;
1717

18-
inline constexpr auto DisablePostEnqueueCleanupName =
19-
"SYCL_DISABLE_POST_ENQUEUE_CLEANUP";
18+
inline constexpr auto DisableCleanupName =
19+
"SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP";
2020

2121
class MockHandlerStreamInit : public MockHandler {
2222
public:
@@ -77,8 +77,8 @@ TEST_F(SchedulerTest, StreamInitDependencyOnHost) {
7777
// Disable post enqueue cleanup so that it doesn't interfere with dependency
7878
// checks.
7979
unittest::ScopedEnvVar DisabledCleanup{
80-
DisablePostEnqueueCleanupName, "1",
81-
detail::SYCLConfig<detail::SYCL_DISABLE_POST_ENQUEUE_CLEANUP>::reset};
80+
DisableCleanupName, "1",
81+
detail::SYCLConfig<detail::SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP>::reset};
8282
std::shared_ptr<detail::queue_impl> HQueueImpl(new detail::queue_impl(
8383
detail::device_impl::getHostDeviceImpl(), /*AsyncHandler=*/{},
8484
/*PropList=*/{}));

0 commit comments

Comments
 (0)