fix: use portable binding argument types#1109
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Co-Authored-By: OpenAI Codex <codex@openai.com>
23a6678 to
681b122
Compare
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45e3ae4d68
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #ifndef LAPACK_COMPLEX_CPP | ||
| #define LAPACK_COMPLEX_CPP | ||
| #endif | ||
| #include <lapacke_config.h> |
There was a problem hiding this comment.
Configure LAPACKE in every translation unit
When building the non-MKL backend with MSVC against Reference LAPACK 3.11, this configuration remains local to translation units that include lapack_wrapper.hpp; src/Type.cpp:17 still includes <lapacke.h> directly, so lapack.h encounters its default C99 _Complex declarations and the cytnx target fails to compile. Apply the complex configuration to that direct include as well (or make it a target-wide setting) so the intended MSVC fix covers the complete build.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
set HAVE_LAPACK_CONFIG_H and LAPACK_COMPLEX_CPP in cmake
There was a problem hiding this comment.
MSCV successfully builds because complex types are not used in that translation unit. src/Type.cpp:17 includes <lapacke.h> to define __blasINTsize__, which is not used everywhere. Open issue #1115 for tracing this issue.
|
By MSVC you mean native Windows support? I thought we only support WSL? |
|
I would recommend that we do not start building native Windows wheels at this point since I don't see a large user base here. I believe the priority should be given to stabilize the C++ API. |
ianmccul
left a comment
There was a problem hiding this comment.
I don't know anything about windows (have not used it since windows 98), but the changes here look generally good anyway.
It is worth setting HAVE_LAPACK_CONFIG_H and LAPACK_COMPLEX_CPP in cmake, OR have some common cytnx header that defines these before including lapacke.h, and make sure that all cytnx code that uses lapack-related identifies includes the cytnx lapack header and does not include lapacke.h directly.
I start to build with MSVC because I am on Windows. I thought it will be convenient for codex desktop app if cytnx can be built on Windows, and Windows also support CUDA. If we explicitly do not want to support Windows, we only need to remove Type.hpp change in this PR. |
If that is the case, I will approve the PR chain. |
Problem
Several small C++ type assumptions were portable on the existing Unix builds but fail with MSVC:
ssize_t, which MSVC does not define;permute_nosignflipaccepts label literals through a mutablechar *initializer list;lapacke.hincludeslapack.hdirectly, so definingLAPACK_COMPLEX_CPPwithout loadinglapacke_config.hstill leaves determinant code with non-portable C99_Complextypes;__complex__pointers instead of followinglapack_complex_float/double.Fix
ssize_tcompatibility alias using the signed counterpart ofstd::size_t, while preserving the native POSIX type elsewhere;std::initializer_list<const char *>for label literals and convert them tostd::stringwithout a test-only overload workaround;LAPACK_COMPLEX_CPP, includelapacke_config.hbeforelapacke.h, and keep determinant buffers as C++ complex values;These are type-portability fixes only; dtype IDs, public behavior, copy behavior, and determinant arithmetic are unchanged.
Validation
float/double _Complex, while the new order compiles and maps both LAPACK complex types tostd::complex;lapack_complex_*;Complexmem_cpu.cppobject compiles incrementally with MSVC in the existing Ninja tree;cytnx, the CPython 3.10 module, andtest_mainincrementally;