Git Product home page Git Product logo

Comments (4)

htyu avatar htyu commented on July 21, 2024 1

yea. I think maybe doing more things in a loop results in more register pressures and cause perf problem. Will need verify with some profiling though

It's very likely. With two separated loops, the intermediate result _tmp8 will be stored to SMEM via tl.sum to free some regsiters, which isn't too bad (much better than tl.store).

from pytorch.

shunting314 avatar shunting314 commented on July 21, 2024

this codegen might be something we should try to fix on the inductor side. Since splitting loops up resulted in speedups, maybe we should explore doing some kernels in more loops.

yea. I think maybe doing more things in a loop results in more register pressures and cause perf problem. Will need verify with some profiling though

from pytorch.

jansel avatar jansel commented on July 21, 2024

Maybe we should actually do 5 loops here:

  1. max_a -- evict last
  2. sum_a (in reverse order to maximize cache hits) -- evict first
  3. max_b -- evict last
  4. sum_b (in reverse order to maximize cache hits) -- evict first
  5. output

from pytorch.

htyu avatar htyu commented on July 21, 2024

Maybe we should actually do 5 loops here:

  1. max_a
  2. sum_a (in reverse order to maximize cache hits)
  3. max_b
  4. sum_b (in reverse order to maximize cache hits)
  5. output

This sounds reasonable to me. In general I would not fuse loops that do not have data dependencies into one. When they have data dependencies, fusion can be helpful in that the intermediate results from the first loop can be pipelined directly to the second loop in the same loop iteration. When there are no dependencies, loop fission (loop distribution) would be the way to go usually.

from pytorch.

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.