Giter Club home page Giter Club logo

Comments (1)

thumbe3 avatar thumbe3 commented on July 30, 2024 1

At the moment you can't perform stores on part of tensors as far as I know. You can load a and b using 2d indexing and unravelling the output something like this for your use-case. NUM_BLOCKS should be passed as a tl.constexpr and should be the next power of 2 for (N + BLOCK_SIZE - 1//BLOCK_SIZE)

    num_blocks = tl.cdiv(N, BLOCK_SIZE)
    block_offs = tl.arange(0, NUM_BLOCKS)
    per_block_offs = tl.arange(0, BLOCK_SIZE)
    all_offs = block_offs[None, :] * BLOCK_SIZE + per_block_offs[:, None]
    
    # 2d pointers of shape [NUM_BLOCKS, BLOCK_SIZE]
    a = tl.load(a_ptr + all_offs,
                mask=all_offs < N and block_offs[None, :] < num_blocks,
                other=0.0)
    b = tl.load(b_ptr + all_offs,
                mask=all_offs  < N and block_offs[None, :] < num_blocks,
                other=0.0)
  
    # [NUM_BLOCKS, BLOCK_SIZE] --> NUM_BLOCKS * BLOCK_SIZE in which N elements will be filled others = 0
    accum_outs = tl.ravel(a * b)

from triton.

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.