From cacc4abc84d0d53318c972d0ebf20b78fd653dfc Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Thu, 6 Aug 2026 07:12:44 -0700 Subject: [PATCH 1/2] Add meson build option for ILP64 fixes compiler warning about unused function --- meson.build | 4 ++++ meson.options | 2 ++ mkl/_mklinitmodule.c | 11 ++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 meson.options diff --git a/meson.build b/meson.build index 1b9ce89..16f2efa 100644 --- a/meson.build +++ b/meson.build @@ -16,6 +16,10 @@ py = import('python').find_installation(pure: false) c_args = ['-DNDEBUG'] +if get_option('ilp64') + c_args += '-DMKL_ILP64' +endif + thread_dep = dependency('threads') cc = meson.get_compiler('c') diff --git a/meson.options b/meson.options new file mode 100644 index 0000000..46117a3 --- /dev/null +++ b/meson.options @@ -0,0 +1,2 @@ +option('ilp64', type: 'boolean', value: false, + description: 'Build with MKL ILP64 interface') diff --git a/mkl/_mklinitmodule.c b/mkl/_mklinitmodule.c index 11571dd..3a31792 100644 --- a/mkl/_mklinitmodule.c +++ b/mkl/_mklinitmodule.c @@ -28,8 +28,11 @@ static struct PyMethodDef methods[] = {{NULL, NULL, 0, NULL}}; #define MKL_SERVICE_INLINE inline #endif +#ifdef MKL_ILP64 static MKL_SERVICE_INLINE void _set_mkl_ilp64(void); +#else static MKL_SERVICE_INLINE void _set_mkl_lp64(void); +#endif static MKL_SERVICE_INLINE void _set_mkl_interface(void); static const char *mtlayer; @@ -154,6 +157,7 @@ static void _preload_threading_layer(void) return; } +#ifdef MKL_ILP64 static MKL_SERVICE_INLINE void _set_mkl_ilp64(void) { #ifdef USING_MKL_RT @@ -161,7 +165,7 @@ static MKL_SERVICE_INLINE void _set_mkl_ilp64(void) #endif return; } - +#else static MKL_SERVICE_INLINE void _set_mkl_lp64(void) { #ifdef USING_MKL_RT @@ -169,10 +173,15 @@ static MKL_SERVICE_INLINE void _set_mkl_lp64(void) #endif return; } +#endif static MKL_SERVICE_INLINE void _set_mkl_interface(void) { +#ifdef MKL_ILP64 + _set_mkl_ilp64(); +#else _set_mkl_lp64(); +#endif _preload_threading_layer(); } From 35d3e081f3961fa45111b7810ea5361aac0d0700 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Thu, 6 Aug 2026 08:21:00 -0700 Subject: [PATCH 2/2] add gh-184 to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87995ea..03927eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Added support for free-threaded (GIL-disabled) CPython builds: the Cython extension is compiled with `freethreading_compatible=True` and `_mklinit` declares `Py_MOD_GIL_NOT_USED`, so importing `mkl` no longer re-enables the GIL [gh-213](https://github.com/IntelPython/mkl-service/pull/213) +* Added support for new build option `ilp64` to initialize MKL with the ILP64 interface, which also resolves some build warnings [gh-184](https://github.com/IntelPython/mkl-service/pull/184) ### Changed * Raised the minimum build-time `Cython` requirement to `3.1.0`, the first release providing the `freethreading_compatible` directive [gh-213](https://github.com/IntelPython/mkl-service/pull/213)