-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[RELAX][PASS] Annotate Custom Scope layout pass for Adreno GPU #17599
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
Open
srkreddy1238
wants to merge
31
commits into
apache:main
Choose a base branch
from
srkreddy1238:annotate_texture_scope
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,250
−62
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
d290815
Annotate Custom Scope layout pass for Adreno GPU
srkreddy1238 f8e0aae
lint
srkreddy1238 2605777
Optional attr addition in legalization
srkreddy1238 1d2c9af
VDevice ptr equality.
srkreddy1238 58285c9
Rename pass - SpecializeTIRParams
srkreddy1238 35adcca
Remote OptimizeBatchnorm pass. Redundant with DecomposeOpsForInference.
srkreddy1238 e1bd163
review
srkreddy1238 1d0aec4
About to go for InferStructInfo query to set the scope
srkreddy1238 3528df7
lint
srkreddy1238 007654a
docs
srkreddy1238 15adfcd
Organize passes
srkreddy1238 6634b80
tests
srkreddy1238 e6c0275
new passes
srkreddy1238 44eea5e
Lint
srkreddy1238 b9a228a
Lint
srkreddy1238 a518972
Update only VDevice.
srkreddy1238 709b508
Docs.
srkreddy1238 7161141
Test case rollback and fixes.
srkreddy1238 55c1ae1
remove log prints
srkreddy1238 45bf903
review comments
srkreddy1238 e60ac33
Review comments.
srkreddy1238 b951937
Test case fix.
srkreddy1238 a9ea6ba
Move adreno tests to specific folder
srkreddy1238 a021f58
Changes due to recent mainline ffi
srkreddy1238 5c3dd5f
Remove VDevice from legalization. Let tir emit handle it.
srkreddy1238 f7dfd2e
Rebase after reflection changes.
srkreddy1238 1f173a6
Cross compiler options to work with configure
srkreddy1238 49730ac
Rebase
srkreddy1238 b57491b
Lint
srkreddy1238 ddab6ab
ffi fix
srkreddy1238 ce3104c
remove unused test
srkreddy1238 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 hidden or 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 hidden or 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 hidden or 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,67 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| /*! | ||
| * \file tvm/relax/backend/adreno/transform.h | ||
| * \brief Adreno GPU specific transformation passes. | ||
| */ | ||
| #ifndef TVM_RELAX_BACKEND_ADRENO_TRANSFORM_H_ | ||
| #define TVM_RELAX_BACKEND_ADRENO_TRANSFORM_H_ | ||
|
|
||
| #include <tvm/relax/expr.h> | ||
| #include <tvm/relax/transform.h> | ||
| namespace tvm { | ||
| namespace relax { | ||
| namespace backend { | ||
| namespace adreno { | ||
| namespace transform { | ||
|
|
||
| using Pass = tvm::transform::Pass; | ||
| using PassInfo = tvm::transform::PassInfo; | ||
| using PassContext = tvm::transform::PassContext; | ||
| using Function = tvm::relax::Function; | ||
| using DataflowBlock = tvm::relax::DataflowBlock; | ||
| using tvm::relax::transform::CreateFunctionPass; | ||
| using tvm::transform::CreateModulePass; | ||
|
|
||
| /*! | ||
| * \brief This pass is designed to annotate the memory scope information via VDevice attribute. | ||
| * This pass need operator attrbutes which in general vanish aftre legalization. | ||
| * FuseOps and FuseTIR are modified to pass on the operator specific attributes and also | ||
| * op_pattern details as part of the PrimFunc. This pass is Adreno specific and annotates each | ||
| * BindingVar with appropriate HintInDevice. RealizeVDevice pass followed by handles these hints. | ||
| * Followed by this pass we also invoke SpecializePrimFuncBasedOnCallSite which updates the | ||
| * var_buffer_map based on this new VDevice information. | ||
| */ | ||
| TVM_DLL Pass AnnotateCustomMemoryScope(Target target); | ||
|
|
||
| /* | ||
| * \brief This is a texture specific pass that can optimize unnecessary to_device copies. | ||
| * Like texture_scope -> ToVDevice -> global scope. In this case the producer can directly | ||
| * store into global scope avoiding unnecessary device copy. | ||
| */ | ||
| TVM_DLL Pass FoldVDeviceScopeChange(); | ||
|
|
||
| } // namespace transform | ||
| } // namespace adreno | ||
| } // namespace backend | ||
| } // namespace relax | ||
| } // namespace tvm | ||
|
|
||
| #endif // TVM_RELAX_BACKEND_ADRENO_TRANSFORM_H_ |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,20 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| """ | ||
| Adreno schedule rules. | ||
| """ | ||
| from .convolution import Conv2d |
This file contains hidden or 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,41 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| """Base schedule rule for Adreno operators.""" | ||
|
|
||
| from tvm.target import Target | ||
|
|
||
| from ..base import ScheduleRule | ||
|
|
||
|
|
||
| class AdrenoScheduleRule(ScheduleRule): # pylint: disable=too-few-public-methods | ||
| """The Schedule Rule specific to Adreno targets, | ||
| will return None if the target is not Adreno.""" | ||
|
|
||
| def is_target_available(self, target: Target) -> bool: | ||
| """Check whether the target is available for Adreno rule. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| target : Target | ||
| The compilation target to check. | ||
|
|
||
| Returns | ||
| ------- | ||
| available : bool | ||
| Whether the target is available for this rule. | ||
| """ | ||
| return super().is_target_available(target) and "adreno" in target.keys |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.