- 09 Nov, 2019 1 commit
-
-
* Add Auto TensorCore TensorCore Unit Test * Rebase to tvm master branch & Add auto tensor core * Code Refine * Add tensor core switch by pragma * Add pragma in tensor core example code * Get real tile size to replace hard coded 16 * support more than 2 dimensions (e.g. batchmatmul) for buffer bind scope * support batch matmul * Move cuda env check to tensor_core.cc * Coderefine for tensor_core.cc * Refine comments * Some refinements of code and comment * Update TensorCore UT to pass the CPU test * remove redundant code * matmul's storage align for different layout * Add support for differenct position of type cast * Add formal tutorial for auto tensorcore codegen * move tensorcore check up to tutorial code * code and doc refine * comment out tune_and_evaluate in tutorial * fix cpplint error
Minmin Sun (孙敏敏) committed
-
- 01 Nov, 2019 2 commits
-
-
* [NODE][REFACTOR] Rename IRFunctor->NodeFunctor, use function pointer for dispatching. Previously we used std::function for the functor dispatching. It introduces additional overhead and problems during dll destruction(of std::function). This PR changes the std::function to function pointers. This change a bit restrictions around the set_dispatch that we can get around, but will improve the general efficiency by reducing one level of indirection in the std::function. We also no longer need special marcos to register functions to the Functor.
Tianqi Chen committed -
Sergei Grechanik committed
-
- 24 Oct, 2019 2 commits
-
-
* add tensor core support * avoid memory bank conflict * fix thread sync & better performance * better performance * add schedule test for conv2d * extend into BatchMatMul * support config fragment shape and layout using intrinsic * add TensorCore tutorial * add int support and fix lint * address comment * add 32*16*8 TensorCore test * fix wmma include logic
Siyuan Feng committed -
* support conv2d HWCN in AutoTVM and Relay * fix lint * fix comments and unit tests
Cody Hao Yu committed
-
- 21 Oct, 2019 1 commit
-
-
* [REFACTOR][NODE][RUNTIME] Move Node to the new Object protocol. This PR removes the original node system, and make node as a subclass of Object. This is a major refactor towards a better unified runtime object system. List of changes in the refactor: - We now hide data_ field, use Downcast explicitly to get a sub-class object. - Removed the node system FFI in python. - Removed the node C API, instead use PackedFunc for list and get attrs. - Change relay::Op::set_attr_type_key(attr_key_name) to relay::Op::set_attr_type<AttrType>(). - This change was necessary because of the new Object registration mechanism. - Subsequent changes to the op registrations - The change revealed a few previous problems that is now fixed. - Patched up a few missing node type registration. - Now we will raise an error if we register object that is not registered. - The original node.h and container.h are kept in the same location. - Calling convention: kObjectHandle now equals the old kNodeHandle, kNodeHandle is removed. - IRFunctor now dispatches on ObjectRef. - Update to the new type checking API: is_type, derived_from are replaced by IsInstance. - Removed .hash member function, instead use C++ convention hasher functors. * Address review comments
Tianqi Chen committed
-
- 18 Oct, 2019 2 commits
- 15 Oct, 2019 1 commit
-
-
Sergei Grechanik committed
-
- 11 Oct, 2019 1 commit
-
-
* [tvm][any] broadcast with values other than 1 * Add test for incompatible runtime values * Remove hybrid script compact buffer binding * retrigger ci
Zhi committed
-
- 02 Oct, 2019 1 commit
-
-
Umang Yadav committed
-
- 30 Sep, 2019 1 commit
-
-
Tianqi Chen committed
-
- 28 Sep, 2019 1 commit
-
-
Tianqi Chen committed
-
- 27 Sep, 2019 1 commit
-
-
Tianqi Chen committed
-
- 25 Sep, 2019 2 commits
-
-
* [ARITH] Use explicit div/mod functions instead of operators. * fix pooling case
Tianqi Chen committed -
* Changes to make tensorize work. These changes also fix the previously broken test. Summary: Tensorize was breaking for a few reasons. 1) Assert at: src/op/tensorize.cc:234 CHECK(is_one(e.region[j]->extent)) In some cases this cannot be proven, e.g.: expected shape=[16, 4], given region=[range(min=((ax1.outer*16)/16), ext=(((((ax1.outer*16) + 15)/16) + 1) - ax1.outer)), range(min=((k.outer*4)/4), ext=(((((k.outer*4) + 3)/4) + 1) - k.outer)), range(min=0, ext=16), range(min=0, ext=4)] The unprovable one is: ext=(((((ax1.outer*16) + 15)/16) + 1) - ax1.outer)). This can be simplified but it is not because to simplify divide, it must prove ax1.outer > 0 and since it is var it cannot. The fix for this to just find all the vars in expr in relace them with some const value. 2) Equivalence between tensorized expr and one being asked to tensorize. For example, the error would be. TVMError: Check failed: Equal(lhs, rhs): Failed to match the compute with TensorIntrin tensor_intrin's declaration provided= reduce(combiner=comm_reducer(result=[(x + y)], lhs=[x], rhs=[y], identity_element=[(int16)0]), source=[(int16(data(k))*int16(kernel(((((((((k.outer.outer*64) + (k.outer.inner*2)) + k)/2)*128) + i) - (k.outer.inner*128)) - (k.outer.outer*4096)), ((((k.outer.outer*64) + (k.outer.inner*2)) + k) % 2))))], axis=[iter_var(k, range(min=0, ext=2))], where=(bool)1, value_index=0), intrin= reduce(combiner=comm_reducer(result=[(x + y)], lhs=[x], rhs=[y], identity_element=[(int16)0]), source=[(int16(data(k))*int16(kernel(i, k)))], axis=[iter_var(k, range(min=0, ext=2))], where=(bool)1, value_index=0) Difference is mainly in the source part: source=[(int16(data(k))*int16(kernel(((((((((k.outer.outer*64) + (k.outer.inner*2)) + k)/2)*128) + i) - (k.outer.inner*128)) - (k.outer.outer*4096)), ((((k.outer.outer*64) + (k.outer.inner*2)) + k) % 2))))] source=[(int16(data(k))*int16(kernel(i, k)))], axis=[iter_var(k, range(min=0, ext=2))] This was not being simpifiled due to compute_intrin_iter_space (map for iter var to range) not containing leaf iter vars. 3) Here it fails with: Check failed: is_one(Simplify(value->shape[i])): Argument b_buffer shape mismatch[16, 4] vs [(((((ax1.outer*16) + 15)/16) + 1) - ax1.outer), (((((k.outer*4) + 3)/4) + 1) - k.outer), 16, 4] This is in buffer binding where it thinks expected and buffer bound shape is different. Although if we could simplify expr, this would not be the case. Test Plan: On skylake avx512 machine: python tests/python/contrib/test_gemm_acc16.py Reviewers: Subscribers: Tasks: Tags: * Implemented bounded analyzer which traverses tree and for reduce/for statements binds the bound of the analyzer. Later this is used to simplify expressions. Inspired from ir_mutator_with_analyzer Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: * Addressed comments. Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: * Added ASF header + define macro for the header file: TVM_ARITHMETIC_IR_VISITOR_WITH_ANALYZER_H_ Some lint fixes as well. * Relax the assumption that dom_map must always contain all leaf itervars. Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: * Disable copy constructor and move to raw ptr. Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
Kimish Patel committed
-
- 20 Sep, 2019 1 commit
-
-
* [ARITH] Add Lowering rule for FloorDiv/Mod * add comment about constant folding
Tianqi Chen committed
-
- 16 Sep, 2019 1 commit
-
-
* [tvm][codegen] Make buffer auto broadcast independent to the order of the input arg * fix indent
Zhi committed
-
- 13 Sep, 2019 2 commits
-
-
2) Add EQ support in the loop partition and add test for the same 3) Change typo truc to trunc
Umang Yadav committed -
* Fix int8x4 vectorize * Fix gpu shared/local memory accumulate * Add test_shared_memory for int8x4 * Adjust test format * Fix cpplint
noituIover committed
-
- 09 Sep, 2019 1 commit
-
-
* add more ops * stop vectorization for erf * x * cleanup * fix * add whitelist for vectorizable intrin * add tf converter * fix dense * fix * add missing intrin * fix mxnet frontend * fix nvptx
Haichen Shen committed
-
- 01 Sep, 2019 1 commit
-
-
* init shape func in interpreter and vm compiler * Update interpreter * fix * lint * lint * fix * remove hack * update * fix * fix * update * address comments & update for shape_of * fix lint * update * fix hybrid * lint * fix bug & add take shape func * lint * lint * update * fix flaky test * add todo
Haichen Shen committed
-
- 17 Aug, 2019 1 commit
-
-
Wuwei Lin committed
-
- 07 Aug, 2019 1 commit
-
-
Umang Yadav committed
-
- 01 Aug, 2019 1 commit
-
-
Jian Weng committed
-
- 13 Jul, 2019 1 commit
-
-
* [ARITH][IR] Introduce FloorDiv/Mod * Address review comments * address review comments, fix div sub rule
Tianqi Chen committed
-
- 11 Jul, 2019 1 commit
-
-
* [INFA][IR] Build and Evolve Low-level IR. Remove dep from HalideIR. * Update include/tvm/node/ir_functor.h Co-Authored-By: Jared Roesch <roeschinc@gmail.com> * Update include/tvm/node/ir_functor.h Co-Authored-By: Jared Roesch <roeschinc@gmail.com>
Tianqi Chen committed
-
- 06 Jul, 2019 1 commit
-
-
Tianqi Chen committed
-
- 02 Jul, 2019 1 commit
-
-
* [Codegen] Support broadcast op with symbolic shape * fix case where last dim = 1 * use enum; simplify stride calculation; improve doc * fix lint * improve py doc
Yizhi Liu committed
-
- 01 Jul, 2019 1 commit
-
-
Tianqi Chen committed
-
- 29 Jun, 2019 1 commit
-
-
[PASS] Use new infra for lower warp memory [ARITH] EvalSet recursively evaluates set in case dom_map contains set that need to be relaxed.
Tianqi Chen committed
-
- 28 Jun, 2019 1 commit
-
-
Thierry Moreau committed
-
- 13 Jun, 2019 1 commit
-
-
Tianqi Chen committed
-
- 07 Jun, 2019 1 commit
-
-
Alexander Pivovarov committed
-
- 21 May, 2019 1 commit
-
-
Logan Weber committed
-
- 15 May, 2019 1 commit
-
-
* Register and use custom datatypes in TVM This patch adds the ability to register and use a custom datatype from Python, using the `register_datatype` call. The datatype can then be passed as the `dtype` parameter using the syntax `dtype="custom[<type_name>]bitsxlanes"`. * Removes extra file * Register custom datatypes with TVM; specify Cast and Add lowering This commit adds functionality for registering custom datatypes with TVM, and furthermore adding custom lowering functions to lower those custom datatypes. This commit only adds lowering for the Cast and Add ops; more ops will be added soon. Check out some custom datatype samples in my repository of samples: https://github.com/gussmith23/tvm-custom-datatype-samples * Register and lower casts from Python * Formatting * Fix include; was including too much * Add comment * Add DatatypeRegistered * Add storage size field to custom datatypes This field indicates the bitwidth of the opaque block of data into which instances of the datatype will be stored, when TVM compiles. For example, if I create a datatype with a storage size of 16, then - Constants of that datatype will be created as unsigned 16-bit ints - Calls to external functions taking that datatype will pass the data as unsigned 16-bit ints - External functions returning that datatype will be assumed to return unsigned 16-bit ints. * Change how lowering funcs (Cast and other ops) are named in registry tvm.datatypes.lower.<target>.cast.<dst-type>.<src-type> becomes tvm.datatypes.lower.<target>.Cast.<dst-type>.<src-type> And fixes some sloppy code around how the other ops were being formatted. * Update Python register_datatype to accept storage size * Oops, left out one cast->Cast change * Look up storage size when parsing `custom[typename]` When we encounter this type string in Python, it will be parsed into a Halide type object in C++. Some of my original code supported this parsing, but we now have to attach the storage type to the type (by setting the bits field). * Change how external calls for casting/other ops are done Firstly, we now use the storage size of the custom type when determining input/output types; e.g. a cast to a custom type with storage size 16 is seen as a call to an external function returning an opaque uint of size 16. Secondly, write a macro to handle the other ops. Originally I thought I could handle these at runtime, with a single `_register_op` global. I transitioned instead to using individual `_register_Add` etc. calls generated with a macro, but I don't remember why. * When encountering a custom type immediate, generate UIntImm * Translate custom types to LLVM type * Generate correct return type in Casts Originally I was assuming that the result type from casts was always a custom datatype, and so I was making the Call return a UInt type. * Use TVM-idiomatic recursion style in DatatypesLowerer This was actually a bug, I'm pretty sure; we wouldn't have recursed deep on any complex programs. As a result of making this change, I also uncovered another potential bug, where the datatypes lowering pass would attempt to lower a Load of a custom type. By commenting out the `Mutate_` for Load, I was able to stop the error from cropping up, but frankly, I'm not satisfied with the solution; how is it that we are able to run codegen when Loads of custom datatypes are present in the IR? I have not written any code, to my knowledge, that will support this. Perhaps Load does not care about the underlying datatype? * Use CHECK * Add comment about which Mutate_s are needed * Add comments * Add GetCustomDatatypeRegistered as an extern C function * Formatting, comments, casting * Change how datatype string is formatted * Use bits() instead of GetStorageSize Use bits() instead of GetStorageSize * Change comment * Add datatype.py * Change registered function name (datatypes->datatype) * Remove GetStorageSize * Format custom datatypes like any other datatype Specifically, we now print the bits and lanes after the `custom[...]` string. * Correctly implement datatype lowering in Python * Remove unneeded include * Make function naming consistent * Use CHECK instead of internal_assert * Rename macro * Formatting * Rename functions * Implement Cast lowering `_datatype_register_op` is now able to lower both binary ops and Casts. * Formatting * Formatting * Clang format, google style * Fix std::string/extern "C" warnings * Formatting * Formatting * Lower Allocates and Loads during datatype lowering This should ensure that there are no custom datatypes remaining once datatype lowering is done. This will allow us to remove the code in the LLVM codegen which deals with custom datatypes. * Revert additions to codegen_llvm.cc which are now unneeded * Pass cpplint on lower_datatypes.cc * Add clarifying comment * Remove datatype lowering registration funcs from C++ * Add CHECKs * Remove TODO * Remove all references to storage size * Move and rename function * Rename function * Remove done TODOs and other handled comments * Remove irrelevant Load code and comments * Comment out the IR node types I'm not sure about yet * Add bfloat16 datatype unittest * Fix MakeConstScalar MakeConstScalar for a custom datatype will now call out to a function which can be registered on a per-datatype basis. The function will take a double and return the equivalent value in the custom datatype format. Note that these code paths are not actually used or tested at the moment. I have not yet written an example which uses const scalars of a custom datatype. * Formatting * Change pass name * Allow users to register whatever lowering function they want Tianqi pointed out that users should be able to register whatever lowering function they want, and should not be constrained to registering lowering functions which just call out to external libraries. I still provide a function for making lowering functions which call out to external libraries, for convenience. * Add clarifying comment * Remove unneeded comment * Remove unneeded function * Rename file * Undo unnecessary change * Undo unnecessary change * Make naming consistent Rename "datatypes" to "custom datatypes" in most contexts. * Revert an artifact of old code * Fix build warnings, add TODO * Lint * Remove unnecessary use of extern C by separating decl and impl * Error checking * Remove TODO * Missed a name change * Lint * Python lint * Correctly format datatype * Move bfloat16 to 3rdparty * "custom_datatypes" --> "datatype" in most places I left the pass as "LowerCustomDatatypes" to indicate that we're not lowering anything other than custom datatypes. Otherwise, everything else has been changed. * Upgrade datatype unittest I used a float calculator to generate some real testcases for the unittest. * Separate public includes and private implementation Specifically, create cleaner decoupling between datatypes stuff in packed_func and the datatype registry implementation. * Formatting * Limit custom datatype codes to >128 * Add TODOs * Fix comment * Formatting * Clean up datatype unittest * Remove un-exported functions in public headers; UIntImm->FloatImm More places where I accidentally was using implementation-only functions in public headers. Additionally, store custom datatype immediates as FloatImms. A later change will add new lowering logic to lower these FloatImms to UIntImms. Plus formatting change. * Lint * Use FloatImm (not UIntImm) to hold immediates of custom datatypes This change switches from using UIntImm to FloatImm for storing immediates of custom datatypes. The value of the number is stored in a double, which should be enough precision for now, for most custom types we will explore in the immediate future. In line with this change, we change the datatype lowering so that FloatImms are lowered to UInts of the appropriate size. Originally, this was going to be done by allowing the user to register a double->uint_<storage size>_t conversion which would be called at compile time to convert the value from the FloatImm to a UInt and store it in a UIntImm. After discussions with Tianqi, we decided to take the simpler route, and lower FloatImms just as we lower all other ops: by replacing them with Call nodes. In this case, presumably the user will Call out to a conversion function in their datatype library. The justification for this decision is due to the functionality added in #1486. This pull request adds the ability to load LLVM bytecode in at compile time. This applies in our case as follows: 1. The user writes their custom datatype programs and registers their lowering functions in the same way we've been doing it so far. All operations over custom datatypes are lowered to Calls to the datatype library. 2. The user compiles their datatype library to LLVM bytecode. 3. At TVM compile time, the user loads the LLVM bytecode. Depending on how the datatype library is written, Clang should be able to perform constant folding over the custom datatype immediates, even if their conversions are done with calls to the library. Additionally adds test to test the FloatImm codepath. * Re-add a change I removed accidentally during rebase * Cleanup * Remove unnecessary TVM_DLLs * Add custom datatype utilities source file to Go runtime pack * Revert "Remove unnecessary TVM_DLLs" This reverts commit 4b742b99557fd3bf0ce6617f033c8b444b74eda4. * Mark bfloat code as TVM_DLL * Moves custom datatype runtime utilities to c_runtime_api.cc * Revert "Add custom datatype utilities source file to Go runtime pack" This reverts commit aecbcde0b2cc09a2693955b77037fe20f93b5bfd. * Move datatype parsing to its own function * Change comments * Remove unneeded function * Formatting * Formatting * Documentation * Add kCustomBegin, use it for checking for custom types * Documentation * Formatting * Move static definition to implementation * Remove comment * Decide toBeLowered before lowering arguments of Expr In the past, e.g. when lowering custom datatypes for an Add, we would lower a and b first, and then decide whether the resulting new Add needed to be lowered based on the (new) types of a and b. Now, instead, we need to check the types of a and b first (to see if they're custom types), and then lower them (so they'll become non-custom types), and then lower the new Add. * Revert "Move datatype parsing to its own function" This reverts commit d554a5881afcf69af1c070d882a7651022703a09. This broke parsing. Will figure this out later. There isn't a really clean way to separate this out given how the rest of the function is written. * Replace comment * Documentation * Remove comment and TVM_DLL * Better error messages * Remove artifact of rebase * Separate datatypes parsing to its own function * Add \returns * Comment changes; add TODO * Refactor tests
Gus Smith committed
-
- 13 May, 2019 1 commit
-
-
Salem Derisavi committed
-
- 08 May, 2019 1 commit
-
- 01 May, 2019 1 commit
-
-
Haichen Shen committed
-
- 26 Apr, 2019 1 commit
-
-
1) fixed a functional bug in loop partitioning algorithm that is exposed when double splitting with indivisible factors 2) added a testcase (#2956)
Salem Derisavi committed
-