GithubHelp home page GithubHelp logo

Comments (4)

rohany avatar rohany commented on July 3, 2024

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.

remysucre avatar remysucre commented on July 3, 2024

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.

rohany avatar rohany commented on July 3, 2024

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.

remysucre avatar remysucre commented on July 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.