Giter Club home page Giter Club logo

Comments (5)

gevtushenko avatar gevtushenko commented on June 26, 2024 1

Hello @iclementine and thank you for reporting this issue! I can verify that vectorization doesn't happen due to the extra template parameter. It's also the case for the warp load algorithm. I have a local fix that removes extra template parameters and leads to vectorized loads, but I don't think we can merge it right now. The issue is that vectorized load guarantees that:

    /* - The following conditions will prevent vectorization and loading will fall
     *   back to cub::BLOCK_LOAD_DIRECT:
     *   - The block input offset is not quadword-aligned
     */

There are no checks of the input alignment. When given a pointer that's not aligned to the vectorized type, block / warp load leads to invalid loads. I believe this has to be addressed before enabling vectorization.

from cub.

iclementine avatar iclementine commented on June 26, 2024 1

@iclementine thank you for noticing that! Could you please reopen the issue against https://github.com/NVIDIA/cccl? We are transitioning to that repo at the moment, so all the issue tracking happens there. Also, please update the issue name to include warp-scope.

@senior-zero Thank you. I've reopen an issue at NVIDIA/cccl#431.

from cub.

iclementine avatar iclementine commented on June 26, 2024

Thank you, @senior-zero. Yes, InputT is a template parameter of BlockLoad( I missed that.)

BTW, I also tried removing that template parameter which enables vectorized load. But I've found another issue that some functions like ThreadLoad (which is used by BlockLoad) does not have const T* as input parameter, which prevents passing in const T* to BlockLoad::Load in some cases. The non-constness propagates all the way to user code. I hope there will be a fixe to that too.

https://github.com/NVIDIA/cub/blob/b2e8bccb8c0cd15279974fe4b9b8d6fcd1842b57/cub/block/block_load.cuh#L189C33-L189C33

    #pragma unroll
    for (int ITEM = 0; ITEM < VECTORS_PER_THREAD; ITEM++)
    {
        vec_items[ITEM] = ThreadLoad<MODIFIER>(vec_ptr + ITEM);
    }

https://github.com/NVIDIA/cub/blob/b2e8bccb8c0cd15279974fe4b9b8d6fcd1842b57/cub/thread/thread_load.cuh#L304C1-L312C1

template <typename T>
__device__ __forceinline__ T ThreadLoad(
    T                       *ptr,
    Int2Type<LOAD_DEFAULT>  /*modifier*/,
    Int2Type<true>          /*is_pointer*/)
{
    return *ptr;
}

from cub.

gevtushenko avatar gevtushenko commented on June 26, 2024

@iclementine thank you for noticing that! Could you please reopen the issue against https://github.com/NVIDIA/cccl? We are transitioning to that repo at the moment, so all the issue tracking happens there. Also, please update the issue name to include warp-scope.

from cub.

gevtushenko avatar gevtushenko commented on June 26, 2024

@iclementine thank you! I'm closing this one in this case.

from cub.

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.