-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure UR will clear context on unloading
- Loading branch information
1 parent
70e4cdc
commit df47657
Showing
5 changed files
with
87 additions
and
1 deletion.
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,38 @@ | ||
//===--------- adapter_lib_init_linux.cpp - Level Zero Adapter ------------===// | ||
// | ||
// Copyright (C) 2023 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 "adapter.hpp" | ||
#include "ur_level_zero.hpp" | ||
|
||
#include <windows.h> | ||
|
||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module | ||
DWORD fdwReason, // reason for calling function | ||
LPVOID lpReserved) // reserved | ||
{ | ||
switch (fdwReason) { | ||
case DLL_PROCESS_ATTACH: | ||
break; | ||
case DLL_PROCESS_DETACH: { | ||
const auto *platforms = GlobalAdapter->PlatformCache->get_value(); | ||
for (const auto &p : *platforms) { | ||
while (!p->Contexts.empty()) { | ||
UR_CALL(urContextRelease(p->Contexts.front())); | ||
} | ||
} | ||
break; | ||
} | ||
case DLL_THREAD_ATTACH: | ||
break; | ||
case DLL_THREAD_DETACH: | ||
break; | ||
} | ||
return TRUE; | ||
} |
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