GithubHelp home page GithubHelp logo

Increasing max alignment length about gkl-rs HOT 4 OPEN

philipc avatar philipc commented on September 26, 2024
Increasing max alignment length

from gkl-rs.

Comments (4)

philipc avatar philipc commented on September 26, 2024

For both the C and rust code, the main reason for this constraint is the size of the backtrack array, which is a two dimensional array of i16. I think that changing this to i32 would roughly double the memory usage and maybe cause some slowdown, but I don't know how much without measuring.

In addition to replacing i16 with i32, you would need to change the AVX instructions that do the packing (_mm256_packs_epi32). I'm reluctant to change the C code to do this, since then we stop being the same as upstream GKL, which is the main reason for having that C code there. However, it would be feasible to change the rust code and see how it affects performance.

from gkl-rs.

philipc avatar philipc commented on September 26, 2024

Hmm, I'm not sure I have that right... let me refresh my memory of how this works.

from gkl-rs.

philipc avatar philipc commented on September 26, 2024

I think the backtrack array only contains the insert/delete flags, so it could even be u8. I added assert!(btrack <= 15); here and it was never hit during the tests:

gkl-rs/src/smithwaterman.rs

Lines 523 to 524 in 9eec442

let btrack =
unsafe { *backtrack.offset((antidiag * backtrack_stride + backtrack_ind) as isize) };

So I don't think the backtrack array is the reason for the limit.

Instead, I'd be concerned about overflows in the 32-bit calculations in compute, but I'd have to look closer to determine where they might occur.

from gkl-rs.

philipc avatar philipc commented on September 26, 2024

I think the only place that overflow can occur is here:

let m11 = v.add(h00, sbt11);

Underflow isn't a concern because we always take the maximum of two values, so it is limited by low_init_value.

So the limit is that MAX_SW_SEQUENCE_LENGTH * MAXIMUM_SW_MATCH_VALUE < i32::MAX. Currently the code limits these values individually, but I don't see why we couldn't limit the product instead.

from gkl-rs.

Related Issues (4)

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.