-
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
[TOPHUB] use keys as a keyword for searching of existing statistics #13874
Merged
+26
−0
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e4ff001
[TOPHUB] use keys as a keyword for searching of existing statistics
elvin-n 3fde8b3
Add test on target not having arm_cpu device
elvin-n 8b84b43
minor fix, add comment
elvin-n 4a7345c
Fix pylint
elvin-n 812c36c
Fix comment
elvin-n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Any chance this comment can be made clearer? :) I read it several times and I don't get it.
might have information
What information?
about it
About what?
keys container
I guess that is Target.keys? Maybe make that more explicit
in other case
What case? When keys container is empty or when -device is not defined?
irrelative stat
What is irrelative stat?
Also, is it one or multiple sentences? Capital letters and punctuation would be helpful :)
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.
:) tried to include logic of matching statistics without detailed description in this place.
kind
. it can be llvm/opencl/cuda/...device
specified, but not required. It might be "arm_cpu", or "adreno" for examplemodel
specified, but not required. It might be "riscv32-unknown-linux-gnu" or "kirin970" for examplekeys
field is not specified in the Target string but is filled after analysis of the Target automatically by devices. It is done for hierarchical search in thetopi
implementations and do fallback to lower/parents layers. As a result it might be ["arm_cpu", "cpu"]Before this change, dedicated tophub file was searched only by
device
and second bykind
As you remember,
device
is not mandatory in the Target. At the same time TVM understands that target belongs to arm_cpu, it treat it as arm_cpu, but before my change, the target likellvm -model=snapdragon835 -mtriple=arm64-linux-android -mattr=+neon
was matched only tollvm
stat file. I cannot even imagine on which devicellvm
stat was collected, but definitely not on ARM. I.e. statistics was irrelevant.Adding keys to the priority before
kind
we increase the probability of searching proper statistics.Do I need to comment line by line your answer?
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.
Thanks for the detailed explanation :) No need to respond line by line, I understand what it is doing and I think it is a really good change. However, would you mind updating that comment in your PR? Otherwise the next person reading it will be confused again. Reading that comment, I think it has the logic inverted, I suppose you meant "For cases when we do NOT have explicitly defined -device in the target"? In my opinion something along the lines "If we don't have explicitly defined -device in the target, check target.keys for device." would be enough. Or even better, explicitly list the order which we use to determine the device:
In general, it is indeed pretty worrying that we can silently apply completely irrelevant parameters from the tophub. I suppose in the ideal world (out of scope for this PR) we'd have something like "Using tuning parameters determined by tuning for < specific core or architecture >" printed to the console during compilation, at least for tvmc, to warn the user about the possibly bad choice of params.
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.
ok, will modify 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.
As for applying of the statistics, I am not even sure that taking statistics from another model of the same device is a good idea. Fortunately it more or less works for ARM CPU currently but if we take intel graphics, the previous models of Iris had different limitation of group worksize. Statistics which collected on newer graphics cannot be applied on previous one. I.e. we risk not to have bad performance but have just not working kernels.
I.e. I agree that we need to do something with tophub and search algorithm, but do not have idea how we need to do this.
And probably it is not so important assuming that Metaschedule should be the tuner #1. On the other hand MS is not a solution for default compilation without tuning.
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 I agree that applying same tuning statistics across different implementations of the same architecture is quite sketchy, especially if it happens in this non-transparent way it currently does. I'm also not sure how often the database gets updated with new stats. I haven't seen compilation crashing because of unsuitable tuning records from tophub myself, but if it happens, that's really bad, since it makes tuning compulsory for being able to compile a network with TVM. Also, sounds like a really difficult thing to debug. But I suppose as long as AutoTVM is the default tuner (as it is for tvmc) and therefore the one new potential users will use to evaluate TVM, it should be kept in a state where its behaviour is representative of TVM's capabilities. In my opinion it would be good if we didn't have 3 tuners to maintain in parallel, but I suppose that's where the community is at the moment.