Tensor Comprehensions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tc Namespace Reference

Namespaces

 autotune
 
 callbacks
 
 code
 
 detail
 
 dlutils
 
 halide2isl
 
 parser
 
 python
 

Classes

class  ATenCompilationUnit
 
class  Cache
 
class  CacheEntrySameKeyDifferentValue
 
class  CudaCache
 
class  OptionsCache
 
class  ManualCudaCache
 
struct  WithDevice
 
class  ExecutionEngine
 
class  ValueAccessor
 
class  CudaDimView
 
class  CudaDim
 
class  Block
 Specializing CudaDim to differentiate between Block and Grid sizes. More...
 
class  Grid
 Specializing CudaDim to differentiate between Block and Grid sizes. More...
 
class  TilingView
 
class  Tiling
 "Materialized" TilingView. More...
 
class  SchedulerOptionsView
 
class  SchedulerOptions
 "Materialized" SchedulerOptionsView. More...
 
class  MappingOptions
 
class  MappingOptionsAsCpp
 
class  MappingOptionsCppPrinter
 
class  Jit
 
class  CudaRTCFunction
 
class  ScopeGuard
 
class  TcExecutor
 
class  CudaGPUInfo
 
struct  function_traits
 
struct  function_traits< R(ClassType::*)(Args...) const >
 
struct  function_traits< R(*)(Args...)>
 
struct  TemplArgsAll
 
struct  TemplArgsAll< ConditionType, T >
 
struct  TemplArgsAll< ConditionType, void >
 

Typedefs

using Duration = std::chrono::high_resolution_clock::duration
 

Functions

std::pair< std::vector
< DLTensor * >, std::vector
< DLManagedTensor * > > 
toDlpackTensors (const std::vector< at::Tensor > &tensors)
 
std::pair< std::vector< const
DLTensor * >, std::vector
< DLManagedTensor * > > 
toConstDlpackTensors (const std::vector< at::Tensor > &tensors)
 
void deleteDlmTensors (std::vector< DLManagedTensor * > &tensors)
 
void removeFromCudaCacheEntriesNotInOptionsCache (CudaCache &cc, const OptionsCache &oc)
 
bool operator== (const std::vector< const DLTensor * > &inputsTensor, const std::vector< detail::TensorInfo > &inputsInfo)
 
std::string makeOptionsFilename (const std::string &filename)
 
std::string makeCudaFilename (const std::string &filename)
 
size_t querySharedMemorySize ()
 
 DECLARE_bool (debug_lang)
 
 DECLARE_bool (debug_halide)
 
 DECLARE_bool (debug_tc_mapper)
 
 DECLARE_bool (debug_cuda)
 
 DECLARE_bool (debug_tuner)
 
 DECLARE_bool (dump_cuda)
 
 DECLARE_bool (llvm_dump_ir)
 
 DECLARE_uint32 (benchmark_warmup)
 
 DECLARE_uint32 (benchmark_iterations)
 
 DECLARE_uint32 (tuner_gen_pop_size)
 
 DECLARE_uint32 (tuner_gen_crossover_rate)
 
 DECLARE_uint32 (tuner_gen_mutation_rate)
 
 DECLARE_uint32 (tuner_gen_generations)
 
 DECLARE_uint32 (tuner_gen_number_elites)
 
 DECLARE_uint32 (tuner_threads)
 
 DECLARE_string (tuner_gpus)
 
 DECLARE_bool (tuner_print_best)
 
 DECLARE_string (tuner_proto)
 
 DECLARE_string (tuner_rng_restore)
 
 DECLARE_bool (tuner_gen_restore_from_proto)
 
 DECLARE_uint32 (tuner_gen_restore_number)
 
 DECLARE_bool (tuner_gen_log_generations)
 
 DECLARE_uint64 (tuner_min_launch_total_threads)
 
 DECLARE_int64 (random_seed)
 
 DECLARE_bool (schedule_tree_verbose_validation)
 
uint64_t initRandomSeed ()
 
const uint64_t & randomSeed ()
 
std::map< std::string, int > computeParamValueMap (const tc2halide::HalideComponents &components, const std::vector< const DLTensor * > &inputsDLT)
 
std::vector
< dlutils::DLTensorUPtr
inferOutputTensorInfo (const tc2halide::HalideComponents &halide, const std::vector< const DLTensor * > &inputsDLT)
 
std::string halideCodegenC (const Halide::Internal::Stmt &s)
 Just generates a C function body from a Halide stmt. Exposed for testing. More...
 
std::ostream & operator<< (std::ostream &out, const MappingOptionsAsCpp &mo)
 
template<typename V >
V::value_type median (V v)
 
template<typename T , typename... Args>
std::unique_ptr< T > make_unique (Args &&...args)
 
template<typename Arg >
std::vector< Arg > vectorFromArgs ()
 
template<typename Arg , typename... Args>
std::vector< typename
std::remove_reference< Arg >
::type > 
vectorFromArgs (Arg arg, Args...args)
 The type of the vector is deduced from the first argument type. More...
 
template<typename Arg , typename... Args>
std::vector< typename
std::remove_reference< Arg >
::type > 
vectorFromCastedArgs (Args...args)
 
std::string replaceString (std::string str, const std::string &search, const std::string &replace)
 
std::string makeConvolution2DTc (int strideH, int strideW)
 
std::string makeConvolution2DGradTc (int strideH, int strideW)
 
std::string setInputDims (std::string tcStr, int numDims, std::string paramPrefix)
 
std::string makeCopyTc (int numDims)
 
std::string makeCopyGradTc (int numDims)
 
std::string makeGroupConvolution2DTc (int strideH, int strideW)
 
std::string makeGroupConvolution2DGradTc (int strideH, int strideW)
 
std::string makeMatmulTc (bool transposeFirst=false, bool transposeSecond=false)
 

Variables

std::mutex nvrtc_mutex
 

Detailed Description

Copyright (c) 2017-present, Facebook, Inc.

Licensed 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.

Copyright (c) 2018, Facebook, Inc.

Licensed 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.

Typedef Documentation

using tc::Duration = typedef std::chrono::high_resolution_clock::duration

Function Documentation

std::map<std::string, int> tc::computeParamValueMap ( const tc2halide::HalideComponents components,
const std::vector< const DLTensor * > &  inputsDLT 
)

Given the result of translating TC language to Halide as components and the (metadata of) input tensors with specific shapes, compute a map between TC parametric tensor sizes, represented as strings, and their numerical values with given input sizes.

tc::DECLARE_bool ( debug_lang  )
tc::DECLARE_bool ( debug_halide  )
tc::DECLARE_bool ( debug_tc_mapper  )
tc::DECLARE_bool ( debug_cuda  )
tc::DECLARE_bool ( debug_tuner  )
tc::DECLARE_bool ( dump_cuda  )
tc::DECLARE_bool ( llvm_dump_ir  )
tc::DECLARE_bool ( tuner_print_best  )
tc::DECLARE_bool ( tuner_gen_restore_from_proto  )
tc::DECLARE_bool ( tuner_gen_log_generations  )
tc::DECLARE_bool ( schedule_tree_verbose_validation  )
tc::DECLARE_int64 ( random_seed  )
tc::DECLARE_string ( tuner_gpus  )
tc::DECLARE_string ( tuner_proto  )
tc::DECLARE_string ( tuner_rng_restore  )
tc::DECLARE_uint32 ( benchmark_warmup  )
tc::DECLARE_uint32 ( benchmark_iterations  )
tc::DECLARE_uint32 ( tuner_gen_pop_size  )
tc::DECLARE_uint32 ( tuner_gen_crossover_rate  )
tc::DECLARE_uint32 ( tuner_gen_mutation_rate  )
tc::DECLARE_uint32 ( tuner_gen_generations  )
tc::DECLARE_uint32 ( tuner_gen_number_elites  )
tc::DECLARE_uint32 ( tuner_threads  )
tc::DECLARE_uint32 ( tuner_gen_restore_number  )
tc::DECLARE_uint64 ( tuner_min_launch_total_threads  )
void tc::deleteDlmTensors ( std::vector< DLManagedTensor * > &  tensors)
std::string tc::halideCodegenC ( const Halide::Internal::Stmt &  s)

Just generates a C function body from a Halide stmt. Exposed for testing.

std::vector<dlutils::DLTensorUPtr> tc::inferOutputTensorInfo ( const tc2halide::HalideComponents halide,
const std::vector< const DLTensor * > &  inputsDLT 
)

Infer the numerical sizes of the output tensors in the TC definition translated into Halide using the provided map between symbolic parameter names and their values ("pvm").

Returns
metadata of the output tensors, with ownership transfer via unique_ptr, data pointers of the underlying DLTensors are null/
uint64_t tc::initRandomSeed ( )
template<typename T , typename... Args>
std::unique_ptr<T> tc::make_unique ( Args &&...  args)
std::string tc::makeConvolution2DGradTc ( int  strideH,
int  strideW 
)
std::string tc::makeConvolution2DTc ( int  strideH,
int  strideW 
)
std::string tc::makeCopyGradTc ( int  numDims)
std::string tc::makeCopyTc ( int  numDims)
std::string tc::makeCudaFilename ( const std::string &  filename)
std::string tc::makeGroupConvolution2DGradTc ( int  strideH,
int  strideW 
)
std::string tc::makeGroupConvolution2DTc ( int  strideH,
int  strideW 
)
std::string tc::makeMatmulTc ( bool  transposeFirst = false,
bool  transposeSecond = false 
)
std::string tc::makeOptionsFilename ( const std::string &  filename)
template<typename V >
V::value_type tc::median ( v)
std::ostream& tc::operator<< ( std::ostream &  out,
const MappingOptionsAsCpp &  mo 
)
inline
bool tc::operator== ( const std::vector< const DLTensor * > &  inputsTensor,
const std::vector< detail::TensorInfo > &  inputsInfo 
)
size_t tc::querySharedMemorySize ( )
const uint64_t& tc::randomSeed ( )
void tc::removeFromCudaCacheEntriesNotInOptionsCache ( CudaCache &  cc,
const OptionsCache &  oc 
)
std::string tc::replaceString ( std::string  str,
const std::string &  search,
const std::string &  replace 
)
std::string tc::setInputDims ( std::string  tcStr,
int  numDims,
std::string  paramPrefix 
)
std::pair<std::vector<const DLTensor*>, std::vector<DLManagedTensor*> > tc::toConstDlpackTensors ( const std::vector< at::Tensor > &  tensors)
std::pair<std::vector<DLTensor*>, std::vector<DLManagedTensor*> > tc::toDlpackTensors ( const std::vector< at::Tensor > &  tensors)
template<typename Arg >
std::vector<Arg> tc::vectorFromArgs ( )

Empty list of arguments gives an empty vector. The function call has to be fully specialized.

template<typename Arg , typename... Args>
std::vector<typename std::remove_reference<Arg>::type> tc::vectorFromArgs ( Arg  arg,
Args...  args 
)

The type of the vector is deduced from the first argument type.

template<typename Arg , typename... Args>
std::vector<typename std::remove_reference<Arg>::type> tc::vectorFromCastedArgs ( Args...  args)

Variable Documentation

std::mutex tc::nvrtc_mutex