Code Monkey home page Code Monkey logo

mlx-c's Issues

missing functions from ops.h

I noticed that these are missing from ops.h:

/**
 * Extract the number of elements along some axes as a scalar array. Used to
 * allow shape dependent shapeless compilation (pun intended).
 */
array number_of_elements(
    const array& a,
    std::vector<int> axes,
    bool inverted,
    Dtype dtype = int32,
    StreamOrDevice s = {});

/** Bitwise and. */
array bitwise_and(const array& a, const array& b, StreamOrDevice s = {});
array operator&(const array& a, const array& b);

/** Bitwise inclusive or. */
array bitwise_or(const array& a, const array& b, StreamOrDevice s = {});
array operator|(const array& a, const array& b);

/** Bitwise exclusive or. */
array bitwise_xor(const array& a, const array& b, StreamOrDevice s = {});
array operator^(const array& a, const array& b);

/** Shift bits to the left. */
array left_shift(const array& a, const array& b, StreamOrDevice s = {});
array operator<<(const array& a, const array& b);

/** Shift bits to the right. */
array right_shift(const array& a, const array& b, StreamOrDevice s = {});
array operator>>(const array& a, const array& b);

I am not sure about number_of_elements() but the bitwise and arithmetic shift functions should be added.

mlx_compile does not work in C

Here is reproduce code snippet:

#include <stdio.h>
#include <stdlib.h>

#include "mlx/c/mlx.h"

mlx_array inc_fun(mlx_array in) {
  mlx_array y = mlx_array_from_float(1.0);
  mlx_array res = mlx_add(in, y, MLX_GPU_STREAM);
  mlx_free(y);
  return res;
}

int main() {
  mlx_closure cls = mlx_closure_new_unary(inc_fun);

  // jvp
  {
    mlx_enable_compile();
    printf("start compile:\n");
    mlx_compile(cls, true);
    printf("end compile:\n");
  }

    return 0;
}

result:
libc++abi: terminating due to uncaught exception of type std::invalid_argument: [compile] Cannot compile a non-addressable function.

this is where it throws exception

Exception in libc++api

I'm working on some bindings that make use of mlx-c but I'm finding that if I run tests that create arrays right after having previously ran tests i'm getting an error:

libc++abi: terminating due to uncaught exception of type std::__1::system_error: condition_variable wait failed: Invalid argument

My guess is some kind of threadpool issue, is there a way to specify limits? Could this be an error in mlx-c?

missed function

While going back and catching older mlx functions that got missed while building, I ran across

array tensordot(
    const array& a,
    const array& b,
    const std::pair<std::vector<int>, std::vector<int>>& dims,
    StreamOrDevice s /* = {} */

The unusual signature isn't in mlx-c (the normal one with a single int is present).

Planned release cadence?

What is the planned release cadence for mlx-c? Will mlx-c follow the weekly release cadence of mlx?

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.