-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Hexagon] Add E2E test demonstrating how to apply blocked layout schedule to conv2d via metaschedule #13180
[Hexagon] Add E2E test demonstrating how to apply blocked layout schedule to conv2d via metaschedule #13180
Conversation
converting input and output activation to Hexagon's blocked layout.
See TODO, this may also disable auto scheduling for non-convolution ops.
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment. Generated by tvm-bot |
@tvm-bot rerun |
tests/python/contrib/test_hexagon/metaschedule_e2e/test_resnet50_int8.py
Outdated
Show resolved
Hide resolved
strategy="replay-trace", | ||
builder=get_hexagon_local_builder(), | ||
runner=get_hexagon_rpc_runner(hexagon_launcher, number=20), | ||
# TODO(csullivan): Configrm the below is accurate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @zxybazh so by using ScheduleFn
here, MS won't be looking at non conv2d blocks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By using ScheduleFn
here, the search space is solely generated by the schedule function over the whole workload. In this case, if you're using _schedule_packed_8x8x32_conv2d
's schedule_fn
to construct the ScheduleFn
space generator, it will only look at conv2d blocks because the function doesn't transform any of the non-conv2d blocks right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's my understanding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@csullivan so shall we remove the TODO comment (which also has a typo lol)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:) Yes, but one more question, if one utilizes a ScheduleFn
to define a search space, but also sets custom sch_rules
to be applied per block as,
space=ms.space_generator.ScheduleFn(
schedule_conv2d_for_tune,
sch_rules=[some set of rules] , # <<<<
postprocs=[],
mutator_probs={},
),
what will be the interaction between the scheduling function and the rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ScheduleFn
I don't think there will be any interaction between the scheduling function and the rules, they will only be used for PostOrderApply
space generator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@csullivan can you remove the TODO comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo the confirmation on TODO
def schedule_fn(sch, conv2d_block: Optional[BlockRV] = None) -> bool: | ||
if conv2d_block == None: | ||
try: | ||
conv2d_block = sch.get_block("conv2d_NCHWc_int8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My PR #13206 has has_block(sch, block_name)
utility, which can remove this hack. I'll update this code after it is merged.
Thanks for patience, let us hold off on merging this one for a bit as there are a few issues that arise at the end of a tuning run with this test:
|
Hi Chris, regarding (2) does the worker hang when the search space that has only one sample, and will not terminate by itself even after 5 iterations? |
Thanks @zxybazh for following the thread closely. Looks like (2) was a red herring and is not reproducible for me any longer. Furthermore, (1) is coming in a follow up PR and this test is skipped so no harm merging this now. |
…dule to conv2d via metaschedule (apache#13180) Demonstrates the use of a custom search space generation from a manual written schedule. In this there are no degrees of freedom so tuning will not improve the schedule currently, but the test demonstrates the schedule-time layout transformation of the conv2d primfunc to the 8x8x32 packed layout for convolution ops. * Add test that demonstrates applying a custom TIR schedule to E2E model. * Add example scheduling that demonstrates converting input and output activation to Hexagon's blocked layout. * PR feedback: Remove latency measurement and profiling report. * Update comment to reflect PR discussion summary, remove TODO. * Use ScheduleFn space generator to disable any autotuning.
…dule to conv2d via metaschedule (apache#13180) Demonstrates the use of a custom search space generation from a manual written schedule. In this there are no degrees of freedom so tuning will not improve the schedule currently, but the test demonstrates the schedule-time layout transformation of the conv2d primfunc to the 8x8x32 packed layout for convolution ops. * Add test that demonstrates applying a custom TIR schedule to E2E model. * Add example scheduling that demonstrates converting input and output activation to Hexagon's blocked layout. * PR feedback: Remove latency measurement and profiling report. * Update comment to reflect PR discussion summary, remove TODO. * Use ScheduleFn space generator to disable any autotuning.
Demonstrates the use of a custom search space generation from a manual written schedule. In this there are no degrees of freedom so tuning will not improve the schedule currently, but the test demonstrates the schedule-time layout transformation of the conv2d primfunc to the 8x8x32 packed layout for convolution ops.