-
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
8 changed files
with
186 additions
and
10 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,34 @@ | ||
// SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//===----------------------------------------------------------------------===// | ||
/// | ||
/// \file | ||
/// Defines the numba-dpex native representation for a dpctl.SyclEvent | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include "_eventstruct.h" | ||
#include "_dbg_printer.h" | ||
|
||
void NRT_MemInfo_EventRef_Delete(void *data); | ||
|
||
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");); | ||
} | ||
|
||
NRT_MemInfo *DPEXRT_sycl_event_meminfo(NRT_api_functions *nrt, | ||
DPCTLSyclEventRef eref) | ||
{ | ||
// manage_memory sets ref count to 1. | ||
nrt->manage_memory(eref, NRT_MemInfo_EventRef_Delete); | ||
} |
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 |