Add unit tests for CustomSchedule.py and refactors for scale out of schedules#2554
Add unit tests for CustomSchedule.py and refactors for scale out of schedules#2554talumbau wants to merge 5 commits into
Conversation
from the returned value in matrixInstructionToMIParameters but this test was never updated. Removing from the test allows the test to pass again.
- Functions are a scalable way to organize custom schedule implementations. Takes all existing schedule implementations and puts each in its own function. Over time, we can factor out the functions to a separate module, if desired.
|
Separating the tiles in custom schedule is a good idea, but can we use existing tox testing framework for CMS kernels? We will add CI tests on this branch soon. We can just add parameters (e.g., tiles, sizes, etc.) in this file: tensilelite/Tensile/Tests/common/gemm/gfx950/custom_mainloop_scheduling.yaml. If it becomes too large, we can have a directory and add the tests in separate files as well. |
|
Here is the command to run tox tests locally: |
|
Thanks Majed. I think the custom_mainloop_scheduling.yaml file is essential in order to be able to commit the code. In that file, we can force the code generation of a particular MT size and then put First, sorry for my ignorance but I don't understand how the testing can work as-is when the tox.ini specifies a py35 and py36 environment, but rocisa requires at least 3.8. So I added an appropriate Python 3.9 environment for tox to use. Then I was ready to run tox and ran as follows based on the README (focusing just on the CMS testing yaml): The result was: So it was 13 minutes to codegen everything and verify we are good. The Python unit test takes about 3 or 4 seconds. I think the unit tests are complementary to the more comprehensive testing with tox. The unit test allows us to refactor Python code and make sure we have a basic "sanity check" that we can execute quickly as we make changes. The tox tests would be a final "I think I've got this right. Let's make sure codegen passes and get the PR up for review". Do you see what I mean? |
We can have different yaml files for each tiles under gfx950/cms/ and run only that yaml files for development. I am wondering if we have different tests in different places, it may complicate the testing for developers. What do you think? |
- Using the tox environment "unit", you can quickly call unit tests once you have a build of tensile-client already available. - Add documentation to the README advertising this fact.
I definitely understand! I agree we should reduce the possibility of confusion where we can. I updated the tox.ini to add an additional target for just unit testing and I added a line to README to describe how it works. So the user can call: and then follow that up with if they are interested in that testing path. PTAL! |
| return module, numCodePath | ||
|
|
||
|
|
||
| def _get_schedule_256x256x64_16bit(kernel, isNN, isNT, isTT, isTN, useLDSTr, TLDS): |
There was a problem hiding this comment.
I would prefer not to have parameters for each of isNN, ..., isTN and just infer them from kernel via
transA = kernel["ProblemType"]["TransposeA"]
transB = kernel["ProblemType"]["TransposeB"]
isNN = transA == False and transB == False
isNT = transA == False and transB == True
isTT = transA == True and transB == True
isTN = transA == True and transB == False
or we could have a shared helper function which returns these values if we want to avoid duplicating code.
There was a problem hiding this comment.
yes good call. I added the helpers and used them to make a consistent calling convention. PTAL.
- use helpers for _get_schedule... functions to make a consistent calling convention.
`#include <bit>` led a building failure on RHEL8. `<bit>` is C++20 header file. It is not supported on RHEL8. [ROCm/composable_kernel commit: 1d89415]
Motivation
We are about to land a significant number of custom schedules for various tile sizes and transpose orientations. By using the convention "a schedule is described in a function" we can reasonably scale the code out, instead of a chain of if/elif blocks that spans hundreds or thousands of lines. Initially we keep the existing schedules in functions inside CustomSchedule.py, but we can refactor as needed.
Technical Details
Adds basic unit tests that follow pytest conventions.
Test Plan
py.test Tests/unit/test_CustomSchedule.py
Test Result
pass
Submission Checklist