Repository navigation
MinGW support - #1806
MinGW support#1806
Conversation
|
Currently disabling distributed/ring (#1784) for Windows, as (at least) the following headers are problematic #include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>Might be possible to replace some with |
|
Using a MinGW toolchain installed via msys2: and {
"$schema": "https://cmake.org/cmake/help/v3.29/_downloads/3e2d73bff478d88a7de0de736ba5e361/schema.json",
"version": 8,
"configurePresets": [
{
"name": "mingw",
"displayName": "MinGW",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc.exe",
"CMAKE_CXX_COMPILER": "g++.exe",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"CMAKE_PREFIX_PATH": "C:/msys64/ucrt64",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"BLAS_INCLUDE_DIRS": "C:/msys64/ucrt64/include/openblas",
"LAPACK_INCLUDE_DIRS": "C:/msys64/ucrt64/include/openblas",
"MLX_BUILD_GGUF": "OFF"
},
"environment": {
"PATH": "C:/msys64/ucrt64/bin;C:/msys64/usr/bin"
}
}
],
"buildPresets": [{
"name": "mingw",
"configurePreset": "mingw"
}]
} |
|
@zcbenz Any ideas for how to manage the distributed/ring implementation on Windows? |
|
I haven't built the latest ring change yet, but I think you can change |
| p = array({0.1, 0.2, 0.3}); | ||
| // Ask for the wrong shape => throws | ||
| CHECK_THROWS_AS(random::bernoulli(p, {2}), std::invalid_argument); | ||
| CHECK_THROWS_AS(random::bernoulli(p, Shape({2})), std::invalid_argument); |
There was a problem hiding this comment.
What's that about? Did it not compile without the cast?
There was a problem hiding this comment.
Yeah, it came up as ambiguous.
There was a problem hiding this comment.
Curious.. it should not be ambigious.. maybe a compiler error.
The only option below that it is implicitly convertible to is Shape. Just curious, do your recall which candidates it was ambiguous between / have the error message handy?
array bernoulli(
const array& p,
const Shape& shape,
const std::optional<array>& key = std::nullopt,
StreamOrDevice s = {});
array bernoulli(
const array& p,
const std::optional<array>& key = std::nullopt,
StreamOrDevice s = {});
template <typename T>
array bernoulli(
T p,
const std::optional<array>& key = std::nullopt,
StreamOrDevice s = {}) {
return bernoulli(array(p), key, s);
}
template <typename T>
array bernoulli(
T p,
const Shape& shape,
const std::optional<array>& key = std::nullopt,
StreamOrDevice s = {}) {
return bernoulli(array(p), shape, key, s);
}
array bernoulli(
const std::optional<array>& key = std::nullopt,
StreamOrDevice s = {});There was a problem hiding this comment.
It might be...
Here's the error for riscv64: https://buildkite.com/julialang/yggdrasil/builds/16987#0194c0f4-e2ce-48b3-86b9-5581d632d04e/6-19873
There was a problem hiding this comment.
And here it is from the mentioned MinGW set-up:
[main] Configuring project: mlx
[driver] Removing C:/Users/Administrator/source/repos/mlx/out/build/mingw/CMakeCache.txt
[driver] Removing C:\Users\Administrator\source\repos\mlx\out\build\mingw\CMakeFiles
[proc] Executing command: C:/msys64/ucrt64/bin/cmake.exe -DCMAKE_C_COMPILER=gcc.exe -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=C:/Users/Administrator/source/repos/mlx/out/install/mingw -DCMAKE_PREFIX_PATH=C:/msys64/ucrt64 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBLAS_INCLUDE_DIRS=C:/msys64/ucrt64/include/openblas -DLAPACK_INCLUDE_DIRS=C:/msys64/ucrt64/include/openblas -DMLX_BUILD_GGUF=OFF -SC:/Users/Administrator/source/repos/mlx -BC:/Users/Administrator/source/repos/mlx/out/build/mingw -G Ninja
[cmake] -- The C compiler identification is GNU 14.2.0
[cmake] -- The CXX compiler identification is GNU 14.2.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/msys64/ucrt64/bin/gcc.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: C:/msys64/ucrt64/bin/g++.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Building MLX for AMD64 processor on Windows
...
[main] Building folder: C:/Users/Administrator/source/repos/mlx/out/build/mingw
[build] Starting build
[proc] Executing command: C:/msys64/ucrt64/bin/cmake.exe --build C:/Users/Administrator/source/repos/mlx/out/build/mingw --parallel 6 --
[build] [1/69] Building CXX object CMakeFiles/mlx.dir/mlx/device.cpp.obj
[build] [2/69] Building CXX object CMakeFiles/mlx.dir/mlx/dtype.cpp.obj
[build] [3/69] Building CXX object CMakeFiles/mlx.dir/mlx/allocator.cpp.obj
...
[build] [61/69] Building CXX object CMakeFiles/mlx.dir/mlx/io/load.cpp.obj
[build] [62/69] Building CXX object tests/CMakeFiles/tests.dir/random_tests.cpp.obj
[build] FAILED: tests/CMakeFiles/tests.dir/random_tests.cpp.obj
[build] ccache C:\msys64\ucrt64\bin\g++.exe -DMLX_VERSION=0.22.0 -IC:/Users/Administrator/source/repos/mlx -IC:/Users/Administrator/source/repos/mlx/out/build/mingw/_deps/doctest-src -g -std=gnu++17 -MD -MT tests/CMakeFiles/tests.dir/random_tests.cpp.obj -MF tests\CMakeFiles\tests.dir\random_tests.cpp.obj.d -o tests/CMakeFiles/tests.dir/random_tests.cpp.obj -c C:/Users/Administrator/source/repos/mlx/tests/random_tests.cpp
[build] In file included from C:/Users/Administrator/source/repos/mlx/tests/random_tests.cpp:5:
[build] C:/Users/Administrator/source/repos/mlx/tests/random_tests.cpp: In function 'void DOCTEST_ANON_FUNC_18()':
[build] C:/Users/Administrator/source/repos/mlx/tests/random_tests.cpp:559:36: error: call of overloaded 'bernoulli(mlx::core::array&, <brace-enclosed initializer list>)' is ambiguous
[build] 559 | CHECK_THROWS_AS(random::bernoulli(p, {2}), std::invalid_argument);
[build] | ~~~~~~~~~~~~~~~~~^~~~~~~~
[build] C:/Users/Administrator/source/repos/mlx/out/build/mingw/_deps/doctest-src/doctest/doctest.h:2156:35: note: in definition of macro 'DOCTEST_CAST_TO_VOID'
[build] 2156 | #define DOCTEST_CAST_TO_VOID(...) __VA_ARGS__;
[build] | ^~~~~~~~~~~
[build] C:/Users/Administrator/source/repos/mlx/out/build/mingw/_deps/doctest-src/doctest/doctest.h:2531:44: note: in expansion of macro 'DOCTEST_ASSERT_THROWS_AS'
[build] 2531 | #define DOCTEST_CHECK_THROWS_AS(expr, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_CHECK_THROWS_AS, "", __VA_ARGS__)
[build] | ^~~~~~~~~~~~~~~~~~~~~~~~
[build] C:/Users/Administrator/source/repos/mlx/out/build/mingw/_deps/doctest-src/doctest/doctest.h:2972:36: note: in expansion of macro 'DOCTEST_CHECK_THROWS_AS'
[build] 2972 | #define CHECK_THROWS_AS(expr, ...) DOCTEST_CHECK_THROWS_AS(expr, __VA_ARGS__)
[build] | ^~~~~~~~~~~~~~~~~~~~~~~
[build] C:/Users/Administrator/source/repos/mlx/tests/random_tests.cpp:559:3: note: in expansion of macro 'CHECK_THROWS_AS'
[build] 559 | CHECK_THROWS_AS(random::bernoulli(p, {2}), std::invalid_argument);
[build] | ^~~~~~~~~~~~~~~
[build] In file included from C:/Users/Administrator/source/repos/mlx/mlx/mlx.h:18,
[build] from C:/Users/Administrator/source/repos/mlx/tests/random_tests.cpp:7:
[build] C:/Users/Administrator/source/repos/mlx/mlx/random.h:166:7: note: candidate: 'mlx::core::array mlx::core::random::bernoulli(T, const std::optional<mlx::core::array>&, mlx::core::StreamOrDevice) [with T = mlx::core::array; mlx::core::StreamOrDevice = std::variant<std::monostate, mlx::core::Stream, mlx::core::Device>]'
[build] 166 | array bernoulli(
[build] | ^~~~~~~~~
[build] C:/Users/Administrator/source/repos/mlx/mlx/random.h:174:7: note: candidate: 'mlx::core::array mlx::core::random::bernoulli(T, const mlx::core::Shape&, const std::optional<mlx::core::array>&, mlx::core::StreamOrDevice) [with T = mlx::core::array; mlx::core::Shape = std::vector<int>; mlx::core::StreamOrDevice = std::variant<std::monostate, mlx::core::Stream, mlx::core::Device>]'
[build] 174 | array bernoulli(
[build] | ^~~~~~~~~
[build] C:/Users/Administrator/source/repos/mlx/mlx/random.h:155:7: note: candidate: 'mlx::core::array mlx::core::random::bernoulli(const mlx::core::array&, const mlx::core::Shape&, const std::optional<mlx::core::array>&, mlx::core::StreamOrDevice)'
[build] 155 | array bernoulli(
[build] | ^~~~~~~~~
[build] C:/Users/Administrator/source/repos/mlx/mlx/random.h:160:7: note: candidate: 'mlx::core::array mlx::core::random::bernoulli(const mlx::core::array&, const std::optional<mlx::core::array>&, mlx::core::StreamOrDevice)'
[build] 160 | array bernoulli(
[build] | ^~~~~~~~~
[build] [63/69] Linking CXX static library libmlx.a
[build] ninja: build stopped: subcommand failed.
[proc] The command: C:/msys64/ucrt64/bin/cmake.exe --build C:/Users/Administrator/source/repos/mlx/out/build/mingw --parallel 6 -- exited with code: 1
[driver] Build completed: 00:00:27.117
[build] Build finished with exit code 1
There was a problem hiding this comment.
Thanks! It looks like the optional<array> is causing the ambiguity. That's good to know. This should not be legit 🤔 since the array needs to be explicitly constructed:
std::optional<array> = {5};
And presumably the optional needs std::in_place to be in-place constructed. But 🤷♂️ .
|
@awni I was wondering whether it would make sense to add some CI for Windows (and possibly other weird platforms) to reduce the need for patches (in JuliaPackaging) from version to version? |
I think it makes sense if the back-end / platform in question is used. I'd like to avoid a situation where we CI for a bunch of platforms that are rarely used. In this case it will mostly slow us down from adding new features to worry about platform compatibility for unused platforms. So TLDR yes but only once the given platform has some non-trivial usage. In this case, I don't think we've reached that point yet. If you feel otherwise let me know. |
8eaf19e to
c04ba54
Compare
awni
left a comment
There was a problem hiding this comment.
Looks good! Will merge when tests clear!
Proposed changes
Tests running on MinGW - addressing #1720.
Also, fixes build on FreeBSD, cf. JuliaPackaging/Yggdrasil#10019.
Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes