File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed 
kernels/portable/cpu/util Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -823,11 +823,15 @@ template <typename Func>
823823    executorch::aten::optional<int64_t > dim,
824824    const  Tensor& out,
825825    const  Func& func) {
826+ #ifdef  ET_USE_THREADPOOL
826827  const  ssize_t  reduction_size = get_reduced_dim_product (in, dim);
827828  const  auto  grain_size = std::max (
828829      static_cast <ssize_t >(1 ),
829830      static_cast <ssize_t >(executorch::extension::internal::GRAIN_SIZE) /
830831          reduction_size);
832+ #else  //  ET_USE_THREADPOOL
833+   const  auto  grain_size = 1 ;
834+ #endif  //  ET_USE_THREADPOOL
831835  return  executorch::extension::parallel_for (0 , out.numel (), grain_size, func);
832836}
833837
@@ -842,11 +846,15 @@ template <typename Func>
842846    optional<ArrayRef<int64_t >> dim_list,
843847    const  Tensor& out,
844848    const  Func& func) {
849+ #ifdef  ET_UE_THREADPOOL
845850  const  ssize_t  reduction_size = get_reduced_dim_product (in, dim_list);
846851  const  auto  grain_size = std::max (
847852      static_cast <ssize_t >(1 ),
848853      static_cast <ssize_t >(executorch::extension::internal::GRAIN_SIZE) /
849854          reduction_size);
855+ #else  //  ET_USE_THREADPOOL
856+   const  auto  grain_size = 1 ;
857+ #endif  //  ET_USE_THREADPOOL
850858  return  executorch::extension::parallel_for (0 , out.numel (), grain_size, func);
851859}
852860
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments