-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
200 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "_eventstruct.h" | ||
#include "_dbg_printer.h" | ||
|
||
/*! | ||
* @brief A destructor that is called from NRT on object destruction. Deletes | ||
* dpctl event reference. | ||
* | ||
* @param data A dpctl event reference. | ||
* @return {return} Nothing. | ||
*/ | ||
void NRT_MemInfo_EventRef_Delete(void *data) | ||
{ | ||
DPCTLSyclEventRef eref = data; | ||
|
||
DPCTLEvent_Delete(eref); | ||
|
||
DPEXRT_DEBUG( | ||
drt_debug_print("DPEXRT-DEBUG: deleting dpctl event reference.\n");); | ||
} |
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,42 @@ | ||
# SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
""" | ||
Tests for boxing for dpnp.ndarray | ||
""" | ||
|
||
import sys | ||
|
||
from dpctl import SyclEvent | ||
|
||
from numba_dpex import dpjit | ||
|
||
|
||
def test_dpjit_constructor(): | ||
"""Test event delete that does not have parent""" | ||
|
||
@dpjit | ||
def func() -> SyclEvent: | ||
SyclEvent() | ||
return None | ||
|
||
# We just want to make sure execution did not crush. There are currently | ||
# no way to check if event wast destroyed, except manual run with debug | ||
# logs on. | ||
func() | ||
|
||
|
||
def test_boxing_without_parent(): | ||
"""Test unboxing of the event that does not have parent""" | ||
|
||
@dpjit | ||
def func() -> SyclEvent: | ||
event = SyclEvent() | ||
return event | ||
|
||
e: SyclEvent = func() | ||
ref_cnt = sys.getrefcount(e) | ||
|
||
assert isinstance(e, SyclEvent) | ||
assert ref_cnt == 2 |