GithubHelp home page GithubHelp logo

gemm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gemm's Issues

`const` misused as `static`

These global flags need to be static, not const. const is effectively copy+paste of the RHS, so you can't store anything at runtime.

const THREADING_THRESHOLD: AtomicUsize = AtomicUsize::new(DEFAULT_THREADING_THRESHOLD);
const RHS_PACKING_THRESHOLD: AtomicUsize = AtomicUsize::new(DEFAULT_RHS_PACKING_THRESHOLD);
const LHS_PACKING_THRESHOLD_SINGLE_THREAD: AtomicUsize =
AtomicUsize::new(DEFAULT_LHS_PACKING_THRESHOLD_SINGLE_THREAD);
const LHS_PACKING_THRESHOLD_MULTI_THREAD: AtomicUsize =
AtomicUsize::new(DEFAULT_LHS_PACKING_THRESHOLD_MULTI_THREAD);

Support for Mixed precision f32-f16

Hi @sarah-ek,

I have an operation where I need to apply matrix multiplication to f32,f16 to obtain f32 matrix. The addition and multiplication should be done in f32 format.

So: Matmul(f16,f32) -> f32

To do this operation with your package, at the moment I saving( and turning) f16 matrix into f32 buffer matrix, then using gemm for f32xf32 matrix multiplication.

More specifically, I used your f16 matmul code and transformed some part of it so that it is mixed precision.

I am not sure how optimized my code is. If possible I would like to know if you will add support for this.

This type of operation is being adapted more and more in the context of large ML models.

std::any::TypeId is different for types from different versions of the same library

Description

I'm not sure if this is a bug or something else, but I'm hitting this explicit panic in gemm dispatch when using f16.

This is because I'm using f16 from half-rs main branch (half = { git = "https://github.com/starkat99/half-rs.git", branch = "main", optional = true, features = ["num-traits", "rand_distr"] }, whereas this crate is using half-rs from crates.io.

You can see this results in two different versions being compiled by cargo tree:

dfdx v0.11.2 (C:\Users\clowm\Documents\programming\dfdx)
├── half v3.0.0-dev (https://github.com/starkat99/half-rs.git?branch=main#1d7f8622)
├── gemm v0.15.2
...
│   ├── gemm-f16 v0.15.2
...
│   │   ├── half v2.2.1
│   │   │   └── num-traits v0.2.15 (*)
...

The following shows that the two type ids are different for me:

use std::any::TypeId;

fn main() {
    println!("half f16 = {:?}", TypeId::of::<half::f16>());
    println!("gemm f16 = {:?}", TypeId::of::<gemm::f16>());
}

Outputs:

half f16 = TypeId { t: 2603904629608812109 }
gemm f16 = TypeId { t: 1360783734638873359 }

Request

I'm not really sure. Do you have thoughts on best approach here? This could also be an issue if using different versions for num_complex crate.

[Question] Suggested way to use Parallelism for libraries using gemm?

The usages I'm seeing are:

  • rayon::current_num_threads() used a couple places in gemm
  • Rayon(0), does this mean something special or is rayon with 0 threads (i guess sequential?)

For a general purpose library that is not exposing gemm to external users, how should parallelism be configured?

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.