-
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.
Unit tests for flattened_member_count data model property.
- Loading branch information
Diptorup Deb
committed
Oct 12, 2023
1 parent
6e74aea
commit c4d2f40
Showing
3 changed files
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# SPDX-FileCopyrightText: 2023 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from numba.core.registry import cpu_target | ||
|
||
from numba_dpex.core.descriptor import dpex_kernel_target | ||
from numba_dpex.core.types.usm_ndarray_type import USMNdArray | ||
|
||
|
||
def test_flattened_member_count(): | ||
"""Test that the number of flattened member count matches the number of | ||
flattened args generated by the CpuTarget's ArgPacker. | ||
""" | ||
|
||
cputargetctx = cpu_target.target_context | ||
kerneltargetctx = dpex_kernel_target.target_context | ||
dpex_dmm = kerneltargetctx.data_model_manager | ||
|
||
for ndim in range(4): | ||
dty = USMNdArray(ndim) | ||
argty_tuple = tuple([dty]) | ||
datamodel = dpex_dmm.lookup(dty) | ||
num_flattened_args = datamodel.flattened_field_count | ||
ap = cputargetctx.get_arg_packer(argty_tuple) | ||
|
||
assert num_flattened_args == len(ap._be_args) |
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