Skip to content

Commit 731ed20

Browse files
RobertorosmaninhostephenchoucaInfinoidweiya711roastduck
authored
Llvm-backend update with Master (#1)
* Reimplemented parts of attribute query lowering and some optimizations * Add a test case for mixing sparse/dense formats in matrix multiply The test case does A=BC, and tries all permutations of Dense, CSR, CSC, and COO. It is disabled for now, enable it once sparse output works. * Add in hoisted workspace reuse and remove guard for divisible bound and split * Fix some workspaces tests * Use CUDA_LIBRARIES instead of hardcoding the path to libcudart Hardcoded paths don't work when using Debian's packaged version of cuda, as the library paths don't match. CMake's find_package(CUDA) sets CUDA_LIBRARIES to the path of libcudart, so just use that instead. * Add TACO_NVCC var to complement TACO_NVCCFLAGS This is useful for passing specific arguments to nvcc. In my case, I wanted to force nvcc to use a specific version of g++. * Updated automated test workflow * Updated automated test workflow * fix -s arg parser * Prototypes automatically generating code to to have sparse iteration over a dense workspace * don't run autoscheduling commands if manual schedule is provided in command line tool fixes tensor-compiler#336 * fix fuse bound calculation, which was unnecessarily enlarged. Fixes tensor-compiler#337 * Fixes bugs in check for accelerating workspace * Fixes bug in concreteNotation check. All workspace tests pass. * Removes print statements * fix handling of operator precedence in CUDA backend. Fixes tensor-compiler#338 * Only hoists out malloc + free from where statement when possible. Emits loop to zero every element in a temporary when it is hoisted before the producer is called. Changes the codegens to keep pointer names constant * Fix build failures on ubuntu 16.04 * Fix python bindings when building with clang++-10 Fix a few instances of this build error in pytaco: .../python_bindings/src/pyTensor.cpp:406:53: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'? * Use exceptions for error reporting in all cases Previously, exceptions were used only when the Python bindings were enabled. This meant that C++ applications could only handle errors gracefully when the Python bindings were enabled. Change it to consistently use exceptions in all cases. * Adds negation to pytaco tensor interface * Removes initialization loop from before producer when accelerating a dense workspacE * Places index list size above the producer loop when accelerating a dense workspace. This should make the transition to multithreading easier and fixes a bug in the original code * Fixes workspace reset * If underived variables are used to index a workspace, we allocate space for the workspace based on the size of the sizes of the input tensors * Relaxes requirements for spmm transformation * Checks if first mode of last tensor has locate for spmm transform * Changes SPMM tranform requirement. Unsure about this * Fix whitespace in tools/taco.cpp. (No functional changes) * Report an error properly in the taco CLI tool. * Use the existing Lexer to parse scheduling directives Add a schedule parser function. Add test cases for the schedule parser function. Use the function in the taco command-line tool. Return usage messages when the user passes in the wrong number of parameters. * Silence a warning about cmake policy CMP0054. * lower,index_notation: fix compilation warnings Fix a few compilation warnings caused by taking copies of loop variables instead of references. * index_notation,error: deduplicate dimension checking routines Currently, there are two dimension checking methods in TACO. The first returned a boolean, and the second returned a user readable string detailing the error. Both methods had nearly identical code. Therefore, this commit merges them into a single function that returns a boolean and the error, if it exists. * lower: fix a bug causing undefined variables when applying fuse Fixes tensor-compiler#355. This commit fixes a bug where the fuse transformation would not generate necessary locator variables when applied to iteration over two dense variables. * Revert "lower: fix a bug causing undefined variables when applying fuse" * Add -help and -help=schedule parameters to CLI * lower: fix a bug causing undefined variables when applying fuse Fixes tensor-compiler#355. This commit fixes a bug where the fuse transformation would not generate necessary locator variables when applied to iteration over two dense variables. Additionally, this commit adds a test for when a dense iteration results in a transposition of a tensor. * Emit unsequenced insertion code * Zeroelss updates * Emit code to use attribute query results during assembly * include,src: introduce a true break statement, rename current to continue The current `ir::Break` statement actually translates to a `continue`. This commit renames this to `ir::Continue`, and adds a new `ir::Break` node that actually translates to a `break`. This new node will be used by upcoming windowing work. * Don't emit append code if using ungrouped insertion * Clear the needsCompile flag in tensor->compileSource() Fixes tensor-compiler#366. * Add an error message for invalid input tensor names. * Fix warnings in python bindings * tensor,codegen: fix a bug where kernel cache could be modified This commit fixes a bug where upon recompilation of an index statement, entries in the kernel cache could be inadvertently modified, leading to confusing segfaults. An example of the bug is included in the added test, where the second call to `c(i, j) = a(i, j)` would hit the cache, but then find a module that had code that corresponded to `c(i, j) = a(i, j) + b(i, j)`. * Implemented assemble scheduling command + don't sort sparse accelerator if performing reduction * Assume inputs are zeroless when computing attribute queries * Replace workspaces in attribute queries * Enable parallelization of forall statements with results assembled by ungrouped insertion * Fixed various bugs * Fixed various bugs * Deleted redundant code * Fix workspaces test on ubuntu 16.04 Fixes: tensor-compiler#380 * Add code coverage targets to cmake * Fix warnings in Release builds * Fixed attribute query compute code not being emitted + optimize computation of Boolean temporaries when always assigned true * Emit init_edges code * Added parallel SpGEMM test * Fixed heuristic for inserting accelerators for workspaces indexed by derived index variables * Removed debug print statements * Updated CMake requirements * Added correctness checks for ungrouped insertion * Fix a bug in CLI parsing of bound() This bug was introduced in tensor-compiler#352. * Strengthened precondition for assemble command * Remove pybind11 * Make pybind11 a submodule * Modify cmake * fix cmake * Removes forcecast in function overload * Add comment to python code explaining when conversion happen * Don't emit atomic pragma for non-reduction assignments * *: add support for windowing of tensors This commit adds support for windowing of tensors in the existing index notation DSL. For example: ``` A(i, j) = B(i(1, 4), j) * C(i, j(5, 10)) ``` causes `B` to be windowed along its first mode, and `C` to be windowed along its second mode. In this commit any mix of windowed and non-windowed modes are supported, along with windowing the same tensor in different ways in the same expression. The windowing expressions correspond to the `:` operator to slice dimensions in `numpy`. Currently, only windowing by integers is supported. Windowing is achieved by tying windowing information to particular `Iterator` objects, as these are created for each `Tensor`-`IndexVar` pair. When iterating over an `Iterator` that may be windowed, extra steps are taken to either generate an index into the windowed space, or to recover an index from a point in the windowed space. * Update Cmake to pull python binding during any build * Add a SpTV+openmp+atomics test case for tensor-compiler#316 * Improve CI test coverage Add a build step that covers the OpenMP and Python features. Make it run `make test` to run all available test suites. * Raise internal error if trying to generate code to assemble sparse accelerator in parallel * *: add the ability to stride window access This commit extends the windowing syntax to include an optional third parameter to a window expression on an index variable: ``` a(i) = b(i(0, n, 5 /* stride */)) ``` This stride parameters means that the window should be accessed along the provided stride, which defaults to 1. Striding is implemented with a similar idea as windowing, where coordinates in the stride are mapped to a canonical index space of `[0,n)`. For compressed modes, coordinates that don't match the stride are skipped. * Fixed various bugs * Fixed removal of redundant loops * lower: fix a bug when using OpenMP and windowing Fixes tensor-compiler#409. This commit fixes a bug where position loops parallelized with OpenMP that operated over windowed tensor modes would fail to compile. This commit also fixes some compilation errors compiling windowing tests on Ubuntu. * Unbreak cmake build of python bindings * Remove redundant allocation * *: add support for using arbitrary indexing sets to window tensors This commit adds support for using vectors to index arbitrary dimensions of tensors. It works by packing the vector into a sparse tensor, and coiterating over the sparse tensor to efficiently filter the chosen dimensions. The syntax of indexing sets look as follows: ``` A(i) = B(i({1, 3, 5})) ``` which means that only elements 1, 3, and 5 from `B` will be used in the computation. * index_notation: implement the `divide` transformation The divide transformation divides a loop up into `n` equal components, whereas split breaks a loop up into a components of size `n`. It also enables support for the transformation in the TACO CLI. * Enable CI tests for array_algebra branch * Suppress GCC warnings * Fixed heuristic for inserting sparse accelerator * Revert "Fixed heuristic for inserting sparse accelerator" This reverts commit 4e264ce. * Fixed heuristic for inserting sparse accelerator * Fix package version issue in CI tests Run "apt-get update" to update the package list. * cuda: fix windowing test with cuda Fixes tensor-compiler#422. This commit ensures that the allocation clearing logic is applied to the CUDA backend as well. The windowing test caught this because TACO was automatically parallelizing the loop onto the GPU. * index_notation,tensor: small bugfixes for index sets * Fixes a runtime error when using index sets on tensors not of integer types * Fixes a compile error when using a vector typed variable as argument for an index set. * Allow CLI precompute() to specify the workspace name * Add tracking/reporting of build info * CLI tool treats double hyphens as a single hyphen * lowerer_impl: fix some striding bugs Fixes some formulaic errors in generated striding code along with a test that revealed them. * Better error message for guarding unguardable loops * Use full precision when IR printing float constants The default precision when printing a floating point value is 6 digits. This causes a lot of double values to get truncated. Print these with full precision to avoid losing data. * Don't emit redundant code to append edges when inserting into result * index_notation: fix a bug where windows would be dropped through `+=` Fixes tensor-compiler#451. This commit fixes a bug where windows applied to index variables would be dropped when assigned to via the `+=` operator. * Fixed printing of scheduling commands in command-line tool output * Fixed precompute transformation and attempt at fixing tensor-compiler#389. Also generate more optimized attribute query code for parallel sparse tensor addition * Modified MTTKRP test to use schedule with precompute * assemble command now no longer uses fresh index variables in inserted attribute query computations by default * Fixed typo in command-line tool usage * Fixed assemble command with dense arrays + improved heuristics for determining whether result needs to be explicitly zero-initialized * Fixed how parallelize command checks for races * Fixing merge issues Co-authored-by: Stephen Chou <[email protected]> Co-authored-by: Mark Glines <[email protected]> Co-authored-by: Olivia Hsu <[email protected]> Co-authored-by: Stephen Chou <[email protected]> Co-authored-by: roastduck <[email protected]> Co-authored-by: Rawn <[email protected]> Co-authored-by: Ryan Senanayake <[email protected]> Co-authored-by: Rohan Yadav <[email protected]> Co-authored-by: Changwan Hong <[email protected]> Co-authored-by: Rohan Yadav <[email protected]> Co-authored-by: Sam Kaplan <[email protected]>
1 parent 92f0a09 commit 731ed20

File tree

263 files changed

+6648
-40417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+6648
-40417
lines changed

.github/workflows/buildandtest.yml

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ on:
44
push:
55
branches:
66
- master
7+
- array_algebra
78
pull_request:
89
branches:
910
- master
11+
- array_algebra
1012

1113
jobs:
1214
build-test-cpu:
13-
name: builds taco for cpu and runs all gtest
15+
name: builds taco with no options for cpu and runs all tests
1416
runs-on: ubuntu-18.04
15-
17+
1618
steps:
1719
- uses: actions/checkout@v2
1820
- name: create_build
@@ -21,14 +23,17 @@ jobs:
2123
run: cmake ..
2224
working-directory: build
2325
- name: make
24-
run: make -j8
26+
run: make -j2
2527
working-directory: build
2628
- name: test
27-
run: bin/taco-test
29+
run: make test
30+
env:
31+
CTEST_OUTPUT_ON_FAILURE: 1
32+
CTEST_PARALLEL_LEVEL: 2
2833
working-directory: build
2934

3035
build-test-cpu-release:
31-
name: builds taco release for cpu and runs all gtest
36+
name: builds taco release for cpu and runs all tests
3237
runs-on: ubuntu-18.04
3338

3439
steps:
@@ -39,28 +44,56 @@ jobs:
3944
run: cmake -DCMAKE_BUILD_TYPE=Release ..
4045
working-directory: build
4146
- name: make
42-
run: make -j8
47+
run: make -j2
4348
working-directory: build
4449
- name: test
45-
run: bin/taco-test
50+
run: make test
51+
env:
52+
CTEST_OUTPUT_ON_FAILURE: 1
53+
CTEST_PARALLEL_LEVEL: 2
54+
working-directory: build
55+
56+
build-test-cpu-openmp-python-asserts:
57+
name: builds taco with compile-time asserts, openmp, and python and runs all tests
58+
runs-on: ubuntu-18.04
59+
60+
steps:
61+
- uses: actions/checkout@v2
62+
- name: apt-get update
63+
run: sudo apt-get update
64+
- name: install numpy and scipy
65+
run: sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-numpy python3-scipy
66+
- name: create_build
67+
run: mkdir build
68+
- name: cmake
69+
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENMP=ON -DPYTHON=ON ..
70+
working-directory: build
71+
- name: make
72+
run: make -j2
73+
working-directory: build
74+
- name: test
75+
run: make test
76+
env:
77+
CTEST_OUTPUT_ON_FAILURE: 1
78+
CTEST_PARALLEL_LEVEL: 2
4679
working-directory: build
4780

4881
build-gpu:
4982
name: build taco for gpu, but does not run tests
5083
runs-on: ubuntu-18.04
51-
84+
5285
steps:
5386
- uses: actions/checkout@v2
5487
- name: download cuda
5588
run: wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
5689
- name: install cuda
5790
run: sudo sh cuda_10.2.89_440.33.01_linux.run --silent --toolkit --installpath="$GITHUB_WORKSPACE/cuda"
5891
- name: add path
59-
run: echo "::add-path::$GITHUB_WORKSPACE/cuda/bin"
92+
run: echo "$GITHUB_WORKSPACE/cuda/bin" >> $GITHUB_PATH
6093
- name: set ld_library_path
61-
run: echo "::set-env name=LD_LIBRARY_PATH::$GITHUB_WORKSPACE/cuda/lib64"
62-
- name: set library_path
63-
run: echo "::set-env name=LIBRARY_PATH::$GITHUB_WORKSPACE/cuda/lib64"
94+
run: echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/cuda/lib64" >> $GITHUB_ENV
95+
- name: set library_path
96+
run: echo "LIBRARY_PATH=$GITHUB_WORKSPACE/cuda/lib64" >> $GITHUB_ENV
6497
- name: print environment
6598
run: |
6699
echo ${PATH}
@@ -72,5 +105,5 @@ jobs:
72105
run: cmake -DCUDA=ON ..
73106
working-directory: build
74107
- name: make
75-
run: make -j8
108+
run: make -j2
76109
working-directory: build

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "python_bindings/pybind11"]
2+
path = python_bindings/pybind11
3+
url = https://github.com/pybind/pybind11

CMakeLists.txt

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
11
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
2-
project(taco)
2+
if(POLICY CMP0048)
3+
cmake_policy(SET CMP0048 NEW)
4+
endif()
5+
if(POLICY CMP0054)
6+
cmake_policy(SET CMP0054 NEW)
7+
endif()
8+
project(taco
9+
VERSION 0.1
10+
LANGUAGES C CXX
11+
)
312
option(CUDA "Build for NVIDIA GPU (CUDA must be preinstalled)" OFF)
413
option(PYTHON "Build TACO for python environment" OFF)
514
option(OPENMP "Build with OpenMP execution support" OFF)
6-
option(LLVM "Build with LLVM backend support" OFF)
7-
option(ENABLE_TESTS "Enable tests" ON)
815

16+
option(LLVM "Build with LLVM backend support")
17+
option(ENABLE_TESTS "Enable tests" ON)
18+
option(COVERAGE "Build with code coverage analysis" OFF)
19+
set(TACO_FEATURE_CUDA 0)
20+
set(TACO_FEATURE_OPENMP 0)
21+
set(TACO_FEATURE_PYTHON 0)
922

1023
if(CUDA)
1124
message("-- Searching for CUDA Installation")
1225
find_package(CUDA REQUIRED)
1326
add_definitions(-DCUDA_BUILT)
27+
set(TACO_FEATURE_CUDA 1)
1428
endif(CUDA)
1529
if(OPENMP)
1630
message("-- Will use OpenMP for parallel execution")
1731
add_definitions(-DUSE_OPENMP)
32+
set(TACO_FEATURE_OPENMP 1)
1833
endif(OPENMP)
1934

2035
if(PYTHON)
2136
message("-- Will build Python extension")
2237
add_definitions(-DPYTHON)
38+
set(TACO_FEATURE_PYTHON 1)
2339
endif(PYTHON)
2440

2541
if (LLVM)
@@ -83,15 +99,26 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
8399
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
84100

85101
set(OPTIMIZE "-O3" CACHE STRING "Optimization level")
102+
86103
if(CUDA)
87104
set(C_CXX_FLAGS "$ENV{CXXFLAGS} -lcudart -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Woverloaded-virtual -pedantic-errors -Wno-deprecated")
88105
else()
89106
set(C_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Woverloaded-virtual -pedantic-errors -Wno-deprecated")
90107
endif(CUDA)
108+
91109
if(OPENMP)
92110
set(C_CXX_FLAGS "-fopenmp ${C_CXX_FLAGS}")
93111
endif(OPENMP)
94112

113+
if(COVERAGE)
114+
find_program(PATH_TO_GCOVR gcovr REQUIRED)
115+
# add coverage tooling to build flags
116+
set(C_CXX_FLAGS "${C_CXX_FLAGS} -g -fprofile-arcs -ftest-coverage")
117+
# name the coverage files "foo.gcno", not "foo.cpp.gcno"
118+
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
119+
message("-- Code coverage analysis (gcovr) enabled")
120+
endif(COVERAGE)
121+
95122
set(C_CXX_FLAGS "${C_CXX_FLAGS}")
96123
set(CMAKE_C_FLAGS "${C_CXX_FLAGS}")
97124
set(CMAKE_CXX_FLAGS "${C_CXX_FLAGS} -std=c++17")
@@ -107,7 +134,7 @@ include_directories(${TACO_INCLUDE_DIR})
107134

108135
set(TACO_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
109136

110-
install(DIRECTORY ${TACO_INCLUDE_DIR}/ DESTINATION include)
137+
install(DIRECTORY ${TACO_INCLUDE_DIR}/ DESTINATION include FILES_MATCHING PATTERN "*.h")
111138

112139
add_subdirectory(src)
113140

@@ -119,8 +146,69 @@ endif()
119146
add_subdirectory(tools)
120147
add_subdirectory(apps)
121148
string(REPLACE " -Wmissing-declarations" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
149+
150+
find_package(Git QUIET)
151+
if(GIT_FOUND AND EXISTS "${TACO_PROJECT_DIR}/.git")
152+
# Update submodules as needed
153+
option(GIT_SUBMODULE "Check submodules during build" ON)
154+
if(GIT_SUBMODULE)
155+
message(STATUS "Submodule update")
156+
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
157+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
158+
RESULT_VARIABLE GIT_SUBMOD_RESULT)
159+
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
160+
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
161+
endif()
162+
endif()
163+
# get git revision
164+
execute_process(
165+
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
166+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
167+
RESULT_VARIABLE GIT_REVPARSE_RESULT
168+
OUTPUT_VARIABLE TACO_GIT_SHORTHASH
169+
OUTPUT_STRIP_TRAILING_WHITESPACE
170+
)
171+
if(NOT GIT_REVPARSE_RESULT EQUAL "0")
172+
message(NOTICE "'git rev-parse --short HEAD' failed with ${GIT_REVPARSE_RESULT}, git version info will be unavailable.")
173+
set(TACO_GIT_SHORTHASH "")
174+
endif()
175+
else()
176+
set(TACO_GIT_SHORTHASH "")
177+
endif()
178+
179+
if(NOT EXISTS "${TACO_PROJECT_DIR}/python_bindings/pybind11/CMakeLists.txt")
180+
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
181+
endif()
182+
122183
if(PYTHON)
123184
add_subdirectory(python_bindings)
185+
message("-- Will build Python extension")
186+
add_definitions(-DPYTHON)
124187
endif(PYTHON)
188+
125189
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-declarations")
126190
add_custom_target(src DEPENDS apps)
191+
192+
if(COVERAGE)
193+
# code coverage analysis target
194+
add_custom_target(gcovr
195+
COMMAND mkdir -p coverage
196+
COMMAND ${CMAKE_MAKE_PROGRAM} test
197+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
198+
)
199+
add_custom_command(TARGET gcovr
200+
COMMAND echo "Running gcovr..."
201+
COMMAND ${PATH_TO_GCOVR} -r ${CMAKE_SOURCE_DIR} --html --html-details -o coverage/index.html ${CMAKE_BINARY_DIR}
202+
COMMAND echo "See coverage/index.html for coverage information."
203+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
204+
)
205+
add_dependencies(gcovr taco-test)
206+
if(PYTHON)
207+
add_dependencies(gcovr core_modules)
208+
endif(PYTHON)
209+
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES coverage)
210+
endif(COVERAGE)
211+
212+
string(TIMESTAMP TACO_BUILD_DATE "%Y-%m-%d")
213+
configure_file("include/taco/version.h.in" "include/taco/version.h" @ONLY)
214+
install(FILES "${CMAKE_BINARY_DIR}/include/taco/version.h" DESTINATION "include/taco")

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,25 @@ To run the Python test suite individually:
9292
python3 build/python_bindings/unit_tests.py
9393

9494

95+
## Code coverage analysis
96+
97+
To enable code coverage analysis, configure with `-DCOVERAGE=ON`. This requires
98+
the `gcovr` tool to be installed in your PATH.
99+
100+
For best results, the build type should be set to `Debug`. For example:
101+
102+
cmake -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON ..
103+
104+
Then to run code coverage analysis:
105+
106+
make gcovr
107+
108+
This will run the test suite and produce some coverage analysis. This process
109+
requires that the tests pass, so any failures must be fixed first.
110+
If all goes well, coverage results will be output to the `coverage/` folder.
111+
See `coverage/index.html` for a high level report, and click individual files
112+
to see the line-by-line results.
113+
95114
# Library example
96115

97116
The following sparse tensor-times-vector multiplication example in C++

apps/tensor_times_vector/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 2.8.12)
2+
if(POLICY CMP0048)
3+
cmake_policy(SET CMP0048 NEW)
4+
endif()
25
project(tensor_times_vector)
36

47
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

include/taco/codegen/module.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <vector>
66
#include <string>
77
#include <utility>
8+
#include <random>
89

910
#include "taco/target.h"
1011
#include "taco/ir/ir.h"
@@ -21,8 +22,6 @@ class Module {
2122
setJITTmpdir();
2223
}
2324

24-
void reset();
25-
2625
/// Compile the source into a library, returning its full path
2726
std::string compile();
2827

@@ -82,6 +81,10 @@ class Module {
8281

8382
void setJITLibname();
8483
void setJITTmpdir();
84+
85+
static std::string chars;
86+
static std::default_random_engine gen;
87+
static std::uniform_int_distribution<int> randint;
8588
};
8689

8790
} // namespace ir

include/taco/error.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,9 @@ struct ErrorReport {
5757
if (condition) {
5858
return;
5959
}
60-
#ifdef PYTHON
6160
explodeWithException();
62-
#else
63-
explode();
64-
#endif
6561
}
6662

67-
void explode();
68-
6963
void explodeWithException();
7064
};
7165

include/taco/format.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ namespace taco {
1212
class ModeFormat;
1313
class ModeFormatPack;
1414
class ModeFormatImpl;
15+
class AttrQuery;
16+
class IndexVar;
1517

1618

1719
/// A Format describes the data layout of a tensor, and the sparse index data
@@ -95,7 +97,7 @@ class ModeFormat {
9597
/// Properties of a mode format
9698
enum Property {
9799
FULL, NOT_FULL, ORDERED, NOT_ORDERED, UNIQUE, NOT_UNIQUE, BRANCHLESS,
98-
NOT_BRANCHLESS, COMPACT, NOT_COMPACT
100+
NOT_BRANCHLESS, COMPACT, NOT_COMPACT, ZEROLESS, NOT_ZEROLESS
99101
};
100102

101103
/// Instantiates an undefined mode format
@@ -126,6 +128,7 @@ class ModeFormat {
126128
bool isUnique() const;
127129
bool isBranchless() const;
128130
bool isCompact() const;
131+
bool isZeroless() const;
129132

130133
/// Returns true if a mode format has a specific capability, false otherwise
131134
bool hasCoordValIter() const;
@@ -134,6 +137,16 @@ class ModeFormat {
134137
bool hasInsert() const;
135138
bool hasAppend() const;
136139

140+
/// Returns true if a mode format has ungrouped insertion functions with
141+
/// specific attributes, false otherwise
142+
bool hasSeqInsertEdge() const;
143+
bool hasInsertCoord() const;
144+
bool isYieldPosPure() const;
145+
146+
std::vector<AttrQuery> getAttrQueries(
147+
std::vector<IndexVar> parentCoords,
148+
std::vector<IndexVar> childCoords) const;
149+
137150
/// Returns true if mode format is defined, false otherwise. An undefined mode
138151
/// type can be used to indicate a mode whose format is not (yet) known.
139152
bool defined() const;

0 commit comments

Comments
 (0)