Comments (4)
Yes, I believe fusing without iterating over the position space is supported for only dense dimensions currently. I'm not sure what the best way of fusing co-iteration loops looks like.
from taco.
Hmm, if I add some pos
commands, taco generates code successfully but the code uses an undefined variable iposr
:
remywang@m16 build % ./bin/taco "q = r(i,j) * s(i,j)" -f=r:ss -s="pos(i,ipos,r)" -s="pos(j,jpos,r)" -s="fuse(ipos,jpos,f)"
// Generated by the Tensor Algebra Compiler (tensor-compiler.org)
int compute(taco_tensor_t *q, taco_tensor_t *r, taco_tensor_t *s) {
double* restrict q_vals = (double*)(q->vals);
int* restrict r1_pos = (int*)(r->indices[0][0]);
int* restrict r1_crd = (int*)(r->indices[0][1]);
int* restrict r2_pos = (int*)(r->indices[1][0]);
int* restrict r2_crd = (int*)(r->indices[1][1]);
double* restrict r_vals = (double*)(r->vals);
int s1_dimension = (int)(s->dimensions[0]);
int s2_dimension = (int)(s->dimensions[1]);
double* restrict s_vals = (double*)(s->vals);
double q_val = 0.0;
for (int32_t f = r1_pos[0] * (r2_pos[(iposr + 1)] - r2_pos[iposr]) + r2_pos[iposr]; f < (r1_pos[1] * (r2_pos[(iposr + 1)] - r2_pos[iposr]) + r2_pos[iposr]); f++) {
int32_t iposr = f / (r2_pos[(iposr + 1)] - r2_pos[iposr]);
if (iposr < r1_pos[0] || iposr >= r1_pos[1])
continue;
int32_t i = r1_crd[iposr];
int32_t jposr = f % (r2_pos[(iposr + 1)] - r2_pos[iposr]);
if (jposr < r2_pos[iposr] || jposr >= r2_pos[(iposr + 1)])
continue;
int32_t j = r2_crd[jposr];
int32_t js = i * s2_dimension + j;
q_val += r_vals[jposr] * s_vals[js];
}
q_vals[0] = q_val;
return 0;
}
In general I'm pretty confused by what pos
is supposed to do.
from taco.
Take a look at http://tensor-compiler.org/senanayake-oopsla20-taco-scheduling.pdf, section 2 (and later in the paper) for some details on pos
. The key idea of pos is to enable iteration over the non-zero values of a tensor only, and apply further transformations such as strip-mining to this space of non-zeros.
The scheduling system doesn't seem to throw an error (it doesn't do the best pre-condition checking), but your schedule is invalid. Here's a valid schedule doing maybe what you intended:
bin/taco "q = r(i,j) * s(i,j)" -f=r:ss -s="fuse(i, j, f)", -s="pos(f, fpos, r)"
which first fuses i
and j
into f
, and then declares f
to range over the position space of r
-- over the non-zeros of r
. This is useful then to strip-mine fpos
, which generates statically load-balanced iterations over the non-zeros of r
.
from taco.
I see, thanks! I'll leave this open for the uncaught errors, but feel free to close if those are not of high priority.
from taco.
Related Issues (20)
- Add taco as 3rd party lib by CMake FetchContent_Declare HOT 1
- Is TACO capable of doing caculation with extra itervar? HOT 2
- Can every index be sparse? HOT 8
- pytaco.tensor_sum() gives a wrong answer
- Reshape HOT 1
- Complex number realization for the python interface HOT 1
- tests fail on macOS ppc/ppc64; on 10.6.8 x86_64 two tests fail HOT 15
- Is it possible to generate OpenCL kernels with TACO? HOT 6
- Memory leak with `pytaco`
- Failure due to CUDA errors when generating code for CPU?
- Online tool cannot connect to server
- convolution HOT 2
- Scheduling Language more information. HOT 1
- Building Taco failed HOT 1
- Using IndexSetVar defined at runtime
- Output transformed C++ kernel code from the TACO C++ source code HOT 1
- Incorrect code generated when contraction index is not innermost
- kernel seg fault when processing large tensors HOT 1
- Double Occurrence of Parameters in Kernels Generated with CLI tool.
- COO sparse tensor contraction produces missing & duplicated entries
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taco.