-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#0: added api for generating corerangeset from given subcoregrid
- Loading branch information
Showing
6 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
..._eager/python_api_testing/unit_testing/misc/test_numcores_to_corerangeset_subcoregrids.py
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,91 @@ | ||
# SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import ttnn | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"start_core, num_cores, subcoregrids, row_wise, expected_core_range_set", | ||
[ | ||
# Test Case 1: Basic row-wise scenario with enough cores in subcoregrids | ||
( | ||
ttnn.CoreCoord(1, 0), | ||
32, | ||
ttnn.CoreRangeSet( | ||
[ | ||
ttnn.CoreRange(ttnn.CoreCoord(1, 0), ttnn.CoreCoord(3, 9)), | ||
ttnn.CoreRange(ttnn.CoreCoord(5, 0), ttnn.CoreCoord(6, 9)), | ||
] | ||
), | ||
True, | ||
ttnn.CoreRangeSet( | ||
[ | ||
ttnn.CoreRange(ttnn.CoreCoord(1, 0), ttnn.CoreCoord(3, 9)), | ||
ttnn.CoreRange(ttnn.CoreCoord(5, 0), ttnn.CoreCoord(6, 0)), | ||
] | ||
), | ||
), | ||
# Test Case 2: Basic Column-wise processing | ||
( | ||
ttnn.CoreCoord(1, 0), | ||
32, | ||
ttnn.CoreRangeSet( | ||
[ | ||
ttnn.CoreRange(ttnn.CoreCoord(1, 0), ttnn.CoreCoord(3, 9)), | ||
ttnn.CoreRange(ttnn.CoreCoord(5, 0), ttnn.CoreCoord(6, 9)), | ||
] | ||
), | ||
False, | ||
ttnn.CoreRangeSet( | ||
[ | ||
ttnn.CoreRange(ttnn.CoreCoord(1, 0), ttnn.CoreCoord(3, 9)), | ||
ttnn.CoreRange(ttnn.CoreCoord(5, 0), ttnn.CoreCoord(5, 1)), | ||
] | ||
), | ||
), | ||
# Test Case 3: row-wise scenario with small target cores and start offset | ||
( | ||
ttnn.CoreCoord(3, 2), | ||
8, | ||
ttnn.CoreRangeSet( | ||
[ | ||
ttnn.CoreRange(ttnn.CoreCoord(1, 0), ttnn.CoreCoord(3, 9)), | ||
ttnn.CoreRange(ttnn.CoreCoord(5, 0), ttnn.CoreCoord(6, 9)), | ||
] | ||
), | ||
True, | ||
ttnn.CoreRangeSet( | ||
[ | ||
ttnn.CoreRange(ttnn.CoreCoord(3, 2), ttnn.CoreCoord(3, 2)), | ||
ttnn.CoreRange(ttnn.CoreCoord(1, 3), ttnn.CoreCoord(3, 4)), | ||
ttnn.CoreRange(ttnn.CoreCoord(1, 5), ttnn.CoreCoord(1, 5)), | ||
] | ||
), | ||
), | ||
# Test Case 4: col-wise scenario with small target cores and start offset | ||
( | ||
ttnn.CoreCoord(1, 8), | ||
8, | ||
ttnn.CoreRangeSet( | ||
[ | ||
ttnn.CoreRange(ttnn.CoreCoord(1, 0), ttnn.CoreCoord(3, 9)), | ||
ttnn.CoreRange(ttnn.CoreCoord(5, 0), ttnn.CoreCoord(6, 9)), | ||
] | ||
), | ||
False, | ||
ttnn.CoreRangeSet( | ||
[ | ||
ttnn.CoreRange(ttnn.CoreCoord(1, 8), ttnn.CoreCoord(1, 9)), | ||
ttnn.CoreRange(ttnn.CoreCoord(2, 0), ttnn.CoreCoord(2, 5)), | ||
] | ||
), | ||
), | ||
], | ||
) | ||
def test_numcores_to_corerangeset(start_core, num_cores, subcoregrids, row_wise, expected_core_range_set): | ||
output_corerangeset = ttnn.num_cores_to_corerangeset_in_subcoregrids( | ||
start_core, num_cores, subcoregrids, row_wise=row_wise | ||
) | ||
assert output_corerangeset.to_json() == expected_core_range_set.to_json() |
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