- 
                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
  28
  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.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            28 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      1e433ad
              
                [RELAX][PASS] Annotate Custom Scope layout pass for Adreno GPU
              
              
                srkreddy1238 b6a4243
              
                lint
              
              
                srkreddy1238 c8f89c6
              
                Optional attr addition in legalization
              
              
                srkreddy1238 9bf983f
              
                VDevice ptr equality.
              
              
                srkreddy1238 90083c7
              
                Rename pass - SpecializeTIRParams
              
              
                srkreddy1238 8aa6665
              
                Remote OptimizeBatchnorm pass. Redundant with DecomposeOpsForInference.
              
              
                srkreddy1238 bf26730
              
                review
              
              
                srkreddy1238 fa40cd2
              
                About to go for InferStructInfo query to set the scope
              
              
                srkreddy1238 8865f8e
              
                lint
              
              
                srkreddy1238 9cf72cb
              
                docs
              
              
                srkreddy1238 07a2c85
              
                Organize passes
              
              
                srkreddy1238 d5bcf8c
              
                tests
              
              
                srkreddy1238 8dd1df6
              
                new passes
              
              
                srkreddy1238 15bbd35
              
                Lint
              
              
                srkreddy1238 7301aa8
              
                Lint
              
              
                srkreddy1238 2599a24
              
                Update only VDevice.
              
              
                srkreddy1238 856af52
              
                Docs.
              
              
                srkreddy1238 31d80d1
              
                Test case rollback and fixes.
              
              
                srkreddy1238 ba5a6b0
              
                remove log prints
              
              
                srkreddy1238 0b326ec
              
                review comments
              
              
                srkreddy1238 3139dfb
              
                Review comments.
              
              
                srkreddy1238 1bc8e80
              
                Test case fix.
              
              
                srkreddy1238 74cf9b2
              
                Move adreno tests to specific folder
              
              
                srkreddy1238 85fcf2a
              
                Changes due to recent mainline ffi
              
              
                srkreddy1238 f969d99
              
                Remove VDevice from legalization. Let tir emit handle it.
              
              
                srkreddy1238 a303873
              
                Rebase
              
              
                srkreddy1238 f1d6847
              
                Rebase after reflection changes.
              
              
                srkreddy1238 88fe95f
              
                Cross compiler options to work with configure
              
              
                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.